Here's a link to the
GNU Make Manual. Right now, the gnu.org server is not responding... at least through my connection. You may need to wait a while for it to clear up or search for an alternate website.
Also, you need to make sure which make program you are using. GNU make is not the only one floating around. Thought, GNU make will respond to a help invocation with output similar to this:
Code:
user@localhost$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-pc-linux-gnu
The make manual will answer all your questions in detail, but I'll try to hit all of them in brief.
The make program relies on Makefiles to tell it what to do (most of the time). There are some "implicit" rules that make will default to if the Makefile does not specify everything.
The thing is, make is a tool to automate the software compilation process. In that regard, it's similar to a shell script. Aside from the implicit rules I mentioned earlier, make has no "intelligence" on how to accomplish any specific task: you must explicitly tell it what to do.
You do this by defining "targets." Each target can list individual files as dependencies, other targets as dependencies, or both. After listing the dependencies, you provide instructions to "build" the target.
The strength of make is that the target dependencies describe the relationships between files. Once done, make can "figure out" (a) which instructions need to be performed and (b) the order those instructions need to be performed to "build" a specified target.
For a project that has hundreds of source code files, you don't want to recompile them all when you made a minor change to a single file--you only want to recompile those pieces that depend on the file changed. That's what make brings to the table.