Creating a target file with the make command
To create a file containing the completed program called a target file, the make program:
- Finds the name of the target file in the description file or in the make command
- Ensures that the files on which the target file depends exist and are up-to-date
- Determines if the target file is up-to-date with the files on which it depends.
If the target file or one of the parent files is out-of-date, the make command creates the target file using one of the following:
- Commands from the description file
- Internal rules to create the file (if they apply)
- Default rules from the description file
If all files in the procedure are up-to-date when running the make program, the make command displays a message to indicate that the file is up-to-date, and then stops. If some files have changed, themake command builds only those files that are out-of-date. The command does not rebuild files that are already current.
When the make command runs commands to create a target file, it replaces macros with their values, writes each command line, and then passes the command to a new copy of the shell.