

All of the progA*.cpp files have an #include statement for a file progA1.h. Program progB is produced by compiling file utilities.cpp and progB1.cpp and linking together the resulting. progA is produced by compiling files utilities.cpp, progA1.cpp, and progA2.cpp and linking together the resulting. Suppose that we are engaged in a project to produce 2 programs, progA and progB.

The command used to produce the dependent file from the files it depends upon.Ī makefile may also include various macros/abbreviations designed to simplify the task of dealing with many instances of the same commands or files. The key bits of information in a makefile, therefore areįor each file, a list of other files it depends upon, and When the make program is run, it then checks to be sure that all of the needed files exist, and that each needed file has been updated more recently than all of the files it depends upon. We say that a file file1 depends upon a second file file2 if the file2 is used as input to some command used to produce file1.
HOW TO MAKE A MAKEFILE FOR C PROGRAM CODE
o files produced by compiling a single source code file). In a makefile, you record the steps necessary to build both the final file (e.g., your executable program) and each intermediate file (e.g., the. The Unix program make is designed to simplify such project management. Even more of a problem is passing them on to someone else (e.g., your instructor) and expecting them to know what to do to build your project from the source code. When you begin to develop projects that involve multiple files that need to be compiled or otherwise processed, keeping them all up-to-date can be a problem.
