|
|
|
Server Tutorial 1 - MakefilesUp until now, the code that we've written has all resided within one main program. Compiling just the one main program is pretty straight-forward, and we haven't really needed any help in compiling them, beyond typing in the compile command at the command line prompt, and maybe setting a couple of options. However, it's very rare that anything beyond 'toy' or 'practice' programs are small enough to put into one main program. As the tasks we want the computer to perform become more complex, it makes sense to have the main program call sub-programs (also known as procedures), which may in turn call other sub-programs. In addition, there exist libraries of existing programs that we can refer to instead of writing them again and re-inventing the wheel. Compiling sophisticated programs that refer to each other (And may in fact be written in separate files) becomes incredibly messy without a tool to help in the compilation process. Makefiles are extremely useful as a tool to help programmers compiling their code, especially when programs are written in more than one file. Makefiles also help speed up the infamous edit-compile-debug loop by significantly accelerating the compile process. However, just like programs, makefiles come with their own special, equally rigorous syntax that must be adhered to precisely in order to correctly compile our code. The Tutorial portion of this Module on Makefiles discusses how to construct makefiles and obey the rigorous syntax. The Review section will give us a chance to explore what we've learned about developing sophisticated programs that require complex compilation rules, and the Reflect section will give us a chance to think about other ways of applying Makefile rules and where we can take these constructs from here. Download the tar file make.tar to access the examples for this module. Proceed to the Tutorial -> |