How to Write Makefile?
Make is like a chef, which use recipes to produce software. And the recipe is called Makefile. Inside makefile, there are lots of targets. # Makefile basic syntax, this line is comment. target: prerequisites # space-separated list <tab> shell-commands # command run in shell Basics Make uses file modification timestamps (mtime) to determine if a target needs rebuilding: If the target does not exist, make runs the following commands. If any prerequisite is newer than the target, make runs the command to rebuild it. If the target is newer than all prerequisites, make does nothing. If any prerequisite is missing, make tries to make missing prerequisite, and this new prerequisite must be newer than target, go to 2. Prerequisite list could be empty. E.g. phony targets. Phony targets could also have prerequisites. Make makes the target always the newest. $ make <target> # default Makefile, capital M $ make -f <makefile> # specify a makefile If target is missing in make command line, the first target in Makefile is the default target. ...