MyMake


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
  1. -f filename: filename will be the name of the makefile, otherwise the default name ’Makefile’ is assumed.
  2. -n: Only displays the commands that would be run, doesn’t actually execute them. 
  3. -B: Do not check timestamps for target and input (i.e. always recompile).
  4. -m log: The log from make4061 will be stored on file log
Note: options can be combined together as e.g. 
./mymake -f <makefile> <specificTarget> -m <output>

Makefile Format
  1. The target line starts on the first character of a line.
  2. ”:” will follow the target and list of dependencies with one or more spaces between them will follow ”:”.
  3. A target is not required to have a dependence
  4. A target will have at most one command (possibly none).
  5. Command line always starts with a tab but not spaces.
  6. Commands can be any executable Linux program or shell command.
  7. 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.
  8. Lines that start with a ”#” will be commented out and ignored.
  9. Duplicated target name is not allowed.

 Authored with Kyle Gee while at the University of Minnesota - Twin Cities.