| 7.2 Simple Programming under Linux | ||
| Learn advanced Linux commands | ||
|
make Run the "make" utility to build (compile, link, etc) a project described in the Makefile found in the current directory. make is used to bring a system "up to date", whenever a change in one file requires an action elsewhere. make is "intelligent" in that it will not make changes unless the change is required, as determined by the file modification date/time. Normally used for buiding software packages (compiling, linking ...), make is also used for other tasks, e.g., system administration. Makefile looks as follows: target
: prerequisites where target is usually a file (but does not have to be, it can be a "phony" target), and prerequisites are files on which target depends. If target does not exist or is older than any prerequisites, "commands" are executed. The first line above is called "the rule", the second "the action". Please note that any action line must start with the tab character. Here is an example Makefile that makes an executable file called "edit": my_program
: main.o command.o To use this
Makefile to create an executable file called "my_program', I
type: make. It works backwards to determine the dependencies,
so first it compiles "command.c" to the object file "command.o", then
it compiles "main.c" to "main.o", and finally it links "main.o" and "command.o"
into the executable "my_program". Next > Back to "Learn Linux Commands"
|
||

