Running Make to Build SpecTclBuilding your Tailored SpecTclBuilding your Tailored SpecTclModifying Makefile

Modifying Makefile

A Makefile is a dependency description file for the Unix make program. See "man make" for more information about the make program and "info make" for detailed information about make dependency files.

If you have written additional C++ program files that need to be built and incorporated into your tailored version of SpecTcl, you must add them to the make dependency file before running make. To add a module to the makefile, you need to add the intended object name to the OBJECTS definition and provide a rule compile your C++ module.

Edit the Makefile and locate the OBJECTS definition. On an unmodified Makefile, this line will look like:

OBJECTS=MySpecTclApp.o 

Following along with our example, we have created a new source file named MyEventProcessor.cpp which needs to be compiled to make MyEventProcessor.o and incorporated into our modified SpecTcl. Our modified OJBECTS definition will look like:

OBJECTS=MySpecTclApp.o  MyEventProcessor.o

We must now add a compilation rule that tells Make what MyEventProcessor.o depends on and how to build it. When the any of the files MyEventProcessor.o depends on are newer than MyEventProcessor.o (or if MyEventProcesor.o does not exist), Make will automatically trigger this compilation rule.

To do this, go to the end of the Makefile and add the line:

MyEventProcessor.o: MyEventProcessor.cpp MyEventProcessor.h
        $(CXXCOMPILE) MyEventProcessor.cpp

Note that the whitespace before $(COMPILE) is a tab character, not spaces. If you use spaces, make will fail.


Report documentation errors to Ron Fox (fox@nscl.msu.edu)or NSCL's Bugzilla page

Running Make to Build SpecTclBuilding your Tailored SpecTclBuilding your Tailored SpecTclModifying Makefile