Linux Commands Examples

A great documentation place for Linux commands


GNU make utility to maintain groups of programs


make [ -f makefile ] [ options ] ... [ targets ] ...

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!



Running commands in parallel with a limit of simultaneous number of commands

One simple idea:

Check for i modulo 20 and execute the wait shell-command before do_something.


./configure && make && make install

You should use the least privileges that work. That's usually:

./configure && make && sudo make install

How to run Vim command from the shell?

From the vim(1) man page:


-c {command}

{command} will be executed after the first file has been read. {command} is interpreted as an Ex command. If the {command} contains spaces it must be enclosed in double quotes (this depends on the shell that is used). Example: Vim "+set si" main.c

Note: You can use up to 10 "+" or "-c" commands.


What happens when I run "./configure" in Linux?

Some of the tests are historic. In some cases the software package is really old and has been around long enough that they tried to build on old systems that didn't have all the resources that we have now. But you might as well leave these old checks in - it doesn't cost much in the way of size.

Some of the checks are for multiple ways of doing things. If you can do something with A or B, then you check for any of those. The check for A may fail, but then the check for B succeeds, and you use B just as well.

And some of the checks are for optional things. If there is a feature X that isn't necessary but a "cool to have" then you can check for X, and include that feature in the build if you can, but leave it out and have a serviceable package (without X).

Then some features are truly necessary, and any failure will abort the package build.

So, it really depends on the feature; are there alternatives, and do we really need this or is this a "nice to have".

The other thing to consider is that the configure is pretty much run once, at build time. Any extra configure steps are just that one time, and don't affect runtime in any way at all. You may wait an extra 5 minutes at configure, but that's it. It's usually not a bad tradeoff in extra steps/trying to make a more stable build.


Why is 'sudo' often omitted in installation instructions?

"sudo" may not be required if, for example, you have already run "su" and your session is running in elevated permissions. That negates the need to run sudo. Generally the use of sudo is preferred, but it is not strictly the only way to reach the same goal.


Quick introduction to Linux needed

I think it would made your life much more easier if you install Ubuntu and use the repository explorer to install Qt and all the dependencies. After that you can download Qt creator from the Qt web page and done, you can start developing. (However I would recommend you to go through some basic Linux tutorials for basic commands and so on).


Tool to run a command when file changed

You can use inotifywait from inotifytools:

This command simply blocks for inotify events, making it appropriate for use in shell scripts. It can watch any set of files and directories, and can recursively watch entire directory trees.


“make & make install” software on Linux

Well, first two places to start are GNU make manual and GNU autoconf manual. and You don't need to understand everything now, but it will give you a feeling of what is going on behind the scenes.

Basically, when you configure a program, a make file for your system is made. Today a lot of software development is done using finished code which is packed is so called libraries. This way programmers don't need to focus on some things which are very important but at the same time irrelevant to their program. Take for example graphical user interface. In today's programs it is a necessary evil, because we don't have anything more advanced at the moment. Although many programs need to have GUI, it isn't particularly interesting to the programmer who is making the program. He'll want to focus on its main function instead. That is why GUI libraries are often used.

When you compile a program, the compiler needs to know where to find all the libraries program is using. The make will use makefile configured by autoconf to tell compiler where to find them. Autoconf will detect your system and appropriately configure makefile.

Also you may have noticed that source code of programs is contained in many files. These files are usually separately compiled. Make also takes care of the order in which these files need to be compiled. Once all files are compiled, they need to be linked together into one program. Linker does that. In the end, you get executable file which you can call.

Another interesting thing is that there is no need to call compiler by hand. Make will call it and use appropriate settings automagically.

Now about the errors you are getting: The undefined reference errors are because somehow autoconf configured a makefile for your system without correctly detecting all dependencies. Your program needs zlib to be correctly installed before compiling it. Autoconf should have told you that, but it seems that you started make which started compiler which cannot find zlib and produces errors.

The first error is made because of something called conditional compiling. Basically, you can tell autoconf that you don't want to use a part of the program. Then autoconf modifies makefile in such way that a part of the program isn't compiled. It seems to me that when Magick++ was compiled, some options were turned off. It is basically telling you that you need to turn them on.

A little bit about shared libraries. Once a program uses a library it can used as a static library which is linked so it is a part of the program or as a dynamic library which isn't actually part of the program. Static libraries are good when you want program which doesn't depend on anything else, but they take space in RAM and is several programs are using same library, each one will have to load it in RAM for its own use. Things are a bit different with dynamic libraries. Once a program is started, it loads the library into RAM and uses it. The library isn't a part of the program, so it needs to be separately installed. However, if several programs are using same library, it only needs to be loaded once into RAM and same copy will be used by all programs. This is almost always used with GUI libraries.

In the end since your computer doesn't have INTERNET access, be prepared for lots and lots of suffering. You'll never know when some program needs some obscure dependency or when a version of program you have installed is incompatible with the version your new program needs.


"make menuconfig" throwing cannot find -lc error in my Fedora 11 PC

Install glibc-devel packages, should be fine then


Make command in Ubuntu linux

"The make utility executes a list of shell commands associated with each target, typically to create or update a file of the same name. makefile contains entries that describe how to bring a target up to date with respect to those on which it depends, which are called dependencies."


Linux tool to autodownload and build from SourceForge?

If I understood your question right, then there is no such generic tool for "auto-build" all projects. Every project has its own specific steps to checking dependencies, downloading source, compiling & installing. If someone can build a certain application manually, he/she could write an auto-build script for that certain app, then share the script to the public for everyone's convenience.

Additionally, you can try to use ArchLinux, its AUR package manager is functioning in a similar way e.g. getting source code tarballs, installing dependencies, compiling, and installing. If one want to create such a package, read the AUR User Guidelines.


Ubuntu terminal characters required in Makefiles

Check for whitespace after the backslash \ on the previous line. This can cause the error. Also try converting tabs to spaces (here inside vim):


Firefox on ARM debian

Doesn't it come with a precompiled or apt-get-able ice weasel? Their website says so, at least.

Firefox is a long, involved build for a desktop, so doing on a pin of a system is probably not the best bet. A lot of distros for that hardware seem to already have official firefox binaries for apt-get install firefox.


How do installation in linux (Fedora)?

That software is ridiculously old. XView hasn't been used for ages, and getting it working on a modern Linux system would be rather difficult. PVM and OpenInventor are doable, but you'd probably have to modify the source code of the program or locate old versions of those libraries to get it to work.

I strongly suggest you take a look at some of the more modern robotics software included with Fedora, some of which has similar functionality to the software you mention.


The purpose of the make utility is to determine automatically which pieces of a large program need to be recompiled, and issue the commands to recompile them. The manual describes the GNU implementation of make, which was written by Richard Stallman and Roland McGrath, and is currently maintained by Paul Smith. Our examples show C programs, since they are most common, but you can use make with any programming language whose compiler can be run with a shell command. In fact, make is not limited to programs. You can use it to describe any task where some files must be updated automatically from others whenever the others change.

To prepare to use make, you must write a file called the makefile that describes the relationships among files in your program, and the states the commands for updating each file. In a program, typically the executable file is updated from object files, which are in turn made by compiling source files.

Once a suitable makefile exists, each time you change some source files, this simple shell command:


suffices to perform all necessary recompilations. The make program uses the makefile data base and the last-modification times of the files to decide which of the files need to be updated. For each of those files, it issues the commands recorded in the data base.

make executes commands in the makefile to update one or more target names, where name is typically a program. If no -f option is present, make will look for the makefiles GNUmakefile, makefile, and Makefile, in that order.

Normally you should call your makefile either makefile or Makefile. (We recommend Makefile because it appears prominently near the beginning of a directory listing, right near other important files such as README.) The first name checked, GNUmakefile, is not recommended for most makefiles. You should use this name if you have a makefile that is specific to GNU make, and will not be understood by other versions of make. If makefile is ’-’, the standard input is read.

make updates a target if it depends on prerequisite files that have been modified since the target was last modified, or if the target does not exist.


-b, -m

These options are ignored for compatibility with other versions of make.

-B, --always-make

Unconditionally make all targets.

-C dir, --directory=dir

Change to directory dir before reading the makefiles or doing anything else. If multiple -C options are specified, each is interpreted relative to the previous one: -C / -C etc is equivalent to -C /etc. This is typically used with recursive invocations of make.


Print debugging information in addition to normal processing. The debugging information says which files are being considered for remaking, which file-times are being compared and with what results, which files actually need to be remade, which implicit rules are considered and which are applied---everything interesting about how make decides what to do.


Print debugging information in addition to normal processing. If the FLAGS are omitted, then the behavior is the same as if -d was specified. FLAGS may be a for all debugging output (same as using -d), b for basic debugging, v for more verbose basic debugging, i for showing implicit rules, j for details on invocation of commands, and m for debugging while remaking makefiles.

-e, --environment-overrides

Give variables taken from the environment precedence over variables from makefiles.

-f file, --file=file, --makefile=FILE

Use file as a makefile.

-i, --ignore-errors

Ignore all errors in commands executed to remake files.

-I dir, --include-dir=dir

Specifies a directory dir to search for included makefiles. If several -I options are used to specify several directories, the directories are searched in the order specified. Unlike the arguments to other flags of make, directories given with -I flags may come directly after the flag: -Idir is allowed, as well as -I dir. This syntax is allowed for compatibility with the C preprocessor’s -I flag.

-j [jobs], --jobs[=jobs]

Specifies the number of jobs (commands) to run simultaneously. If there is more than one -j option, the last one is effective. If the -j option is given without an argument, make will not limit the number of jobs that can run simultaneously.

-k, --keep-going

Continue as much as possible after an error. While the target that failed, and those that depend on it, cannot be remade, the other dependencies of these targets can be processed all the same.

-l [load], --load-average[=load]

Specifies that no new jobs (commands) should be started if there are others jobs running and the load average is at least load (a floating-point number). With no argument, removes a previous load limit.

-L, --check-symlink-times

Use the latest mtime between symlinks and target.

-n, --just-print, --dry-run, --recon

Print the commands that would be executed, but do not execute them.

-o file, --old-file=file, --assume-old=file

Do not remake the file file even if it is older than its dependencies, and do not remake anything on account of changes in file. Essentially the file is treated as very old and its rules are ignored.

-p, --print-data-base

Print the data base (rules and variable values) that results from reading the makefiles; then execute as usual or as otherwise specified. This also prints the version information given by the -v switch (see below). To print the data base without trying to remake any files, use make -p -f/dev/null.

-q, --question

’’Question mode’’. Do not run any commands, or print anything; just return an exit status that is zero if the specified targets are already up to date, nonzero otherwise.

-r, --no-builtin-rules

Eliminate use of the built-in implicit rules. Also clear out the default list of suffixes for suffix rules.

-R, --no-builtin-variables

Don’t define any built-in variables.

-s, --silent, --quiet

Silent operation; do not print the commands as they are executed.

-S, --no-keep-going, --stop

Cancel the effect of the -k option. This is never necessary except in a recursive make where -k might be inherited from the top-level make via MAKEFLAGS or if you set -k in MAKEFLAGS in your environment.

-t, --touch

Touch files (mark them up to date without really changing them) instead of running their commands. This is used to pretend that the commands were done, in order to fool future invocations of make.

-v, --version

Print the version of the make program plus a copyright, a list of authors and a notice that there is no warranty.

-w, --print-directory

Print a message containing the working directory before and after other processing. This may be useful for tracking down errors from complicated nests of recursive make commands.


Turn off -w, even if it was turned on implicitly.

-W file, --what-if=file, --new-file=file, --assume-new=file

Pretend that the target file has just been modified. When used with the -n flag, this shows you what would happen if you were to modify that file. Without -n, it is almost the same as running a touch command on the given file before running make, except that the modification time is changed only in the imagination of make.


Warn when an undefined variable is referenced.


Copyright (C) 1992, 1993, 1996, 1999 Free Software Foundation, Inc. This file is part of GNU make.

GNU make is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

GNU make is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GNU make; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

exit status

GNU make exits with a status of zero if all makefiles were successfully parsed and no targets that were built failed. A status of one will be returned if the -q flag was used and make determines that a target needs to be rebuilt. A status of two will be returned if any errors were encountered.


This man page is an extract of the documentation of GNU make. It is updated only occasionally, because the GNU project does not use nroff. For complete, current documentation, refer to the Info file which is made from the Texinfo source file make.texi.


See the chapter ’Problems and Bugs’ in The GNU Make Manual.

see also

The GNU Make Manual


This manual page contributed by Dennis Morse of Stanford University. It has been reworked by Roland McGrath. Further updates contributed by Mike Frysinger.

How can this site be more helpful to YOU ?

give  feedback