# Makefile # ---------------------------------------------------------------- # COMP 290-001: Algorithm Library Design, Lutz Kettner, 01/11/2000 # Example of a C++ Library with a dummy function. # This makefile runs on Linux (RedHat 6.1) with g++. CPPFLAGS = -g -I. OBJ = foo.o Init.o # default setting is static library and test program default: static app doc static: libExample.a shared: libExample.so libExample.a: $(OBJ) rm -f libExample.a ar cr libExample.a $(OBJ) # ranlib libExample.a # ranlib was needed previously to create a # sorted table of contents in the lib archive. libExample.so: $(OBJ) g++ -shared -o libExample.so $(OBJ) foo.o: foo.C EX/foo.h EX/Init.h EX/Template_init.h g++ -c $(CPPFLAGS) foo.C Init.o: Init.C EX/Init.h EX/Template_init.h g++ -c $(CPPFLAGS) Init.C # Note: the following test application uses the static or the shared # library, whichever happens to be in the current directory. HEADER = EX/foo.h EX/Template_init.h EX/Init.h app: app.o g++ -o app app.o -L. -lExample app.o: app.C $(HEADER) g++ -c $(CPPFLAGS) app.C # We create the documentation using doxygen. doc: doxygen doxygen.cfg # A typical makefile has a clean and/or a cleanall rule that removes all # temporary files that can be created again from the sources. clean: rm -f app *.o libExample.a libExample.so cleanall: clean rm -fr html