Purpose of Program
The purpose of this program is to emulate the Make utility. It does this by building executable programs or librarys from source files specified in a makefile. The program does this by parsing a makefile, and then builds the targets from themakefile using fork, exec, and wait.
How to compile program
This is the shell command to compile the program: ~$ gcc -o mymake mymake.c util.c
How to use the program from the shell
This is the shell command to use the program: ./mymake Default behavior executes the first target of the makefile "Makefile"
./mymake may be used with the following options.
Supported Options
- -f filename: filename will be the name of the makefile, otherwise the default name ’Makefile’ is assumed.
- -n: Only displays the commands that would be run, doesn’t actually execute them.
- -B: Do not check timestamps for target and input (i.e. always recompile).
- -m log: The log from make4061 will be stored on file log
./mymake -f <makefile> <specificTarget> -m <output>
Makefile Format
- The target line starts on the first character of a line.
- ”:” will follow the target and list of dependencies with one or more spaces between them will follow ”:”.
- A target is not required to have a dependence
- A target will have at most one command (possibly none).
- Command line always starts with a tab but not spaces.
- Commands can be any executable Linux program or shell command.
- Lines that do not start with a target, or commands that do not start with a tab are not valid, and make4061 will be terminated.
- Lines that start with a ”#” will be commented out and ignored.
- Duplicated target name is not allowed.
Authored with Kyle Gee while at the University of Minnesota - Twin Cities.