This file located in the nachos/code directory contains information for
automatically building the Makefiles in each subdirectory.
If you would like to add a file to be compiled when running gmake
in the threads directory for example, you will have to edit the
section relavent to the threads compilation
For example : To add a new file test.cc located in the threads directory
to the Makefile in the threads directory
1. Locate the section in Makefile.common marked by THREAD_C (for makes files in
other directories find the appropriate sections : USERPROG_C, NETWORK_C, etc)
add a reference to test.cc by adding the filename ../threads/test.cc
This is to ensure that your new file will be part of the compilation.
You may notice that some lines end with a \, this is signify the line
continues on the next. Make sure you understand this because it is
required that lines be continuous or specifically mentioned to continue
on the next line for proper functioning
2. Locate the section marked by THREAD_O
add a reference to test.o by adding the filename test.o to the list.
This is to ensure you new file is linked in to the executable.
3. If you also want to add a ".h" file, you must similarly modify the THREAD_H section
Step 2 : Running gmake depend
The command gmake depend will find all the dependancies and automatically create
Makefiles for you. So go to the directory you want to create a new file, continuing from the
previous example : go to the threads directory and type gmake depend. If everything
goes according to plan you should have a new make file created
Step 3 : Congratulations, you are now ready compile with your new file
Run the command gmake to compile everything including your new file!