Compiling Generated C Code : Details of Compilation and Linking : Using make to Link and Compile

Using make to Link and Compile

The compile and link phase compiles the generated code and handwritten code into a library called out_lib.a, and links it with the runtime modules and the user-specified libraries into an executable prototype.

Every time you modify your specification and generate code, you have to follow this procedure. The mechanism that manages this process is the make.

The advantage of make on “flat” compilations is that it can manage incremental compilation. That is, compiling only what is necessary due to the latest changes.

The input to make are two dependency files: Makefile and User_Makefile. They contain lists of files and dependencies that determine what has to be re-compiled after every change in the source files.

The Makefile lists all the generated files that should remain intact. The User_Makefile compiles the user_activities template and additional files added by the user.