Sample Makefile

Everyone always has trouble with their first makefile. So to make things easier, here's a sample makefile that you can tailor to suit your needs (though this should probably be sufficient for most small applications). You can always check out the GNU Make manual, which is VERY thorough.

To use this makefile, save your makefile under the name "makefile" or "Makefile". Next, change all the settings above the ##### RULES ##### line that need changing. Mostly you will just need to change the SRC line and the OUT line, and the CC line if you want to use gcc instead of cc. And remember, if you want to make a smaller executable, you can always run "strip filename" to take all the excess symbols from the file. Also, be sure to use TABS and not SPACES if you cut-and-paste this from your web browser, otherwise make will be really confused. You can get a copy of the entire makefile here if you like.

When you are all done, just type "make clean; make" and your program should build beautifully.

[an error occurred while processing this directive]

This page created by Paul Brannan
Last modified: Friday, 22-Feb-2002 10:04:21 EST
URL: http://hubcap.clemson.edu/~cout/hubcap/makefile.html