############################################################ # Sample Makefile for OpenGL Programs # # Visualization Course, Fall 2001, Yap. # # Please use this as pattern to organize your projects # How to use this make file: # # If you want to compile a program named XXX.c or XXX.cc, type # # > make p=XXX # # You can always use the default, and simply type "make". # To test the default program, type "make test" # ############################################################ ############################################################ # Variables ############################################################ # version is "v" v= # program is "p" p=gleyzer # program is "pv" pv=$(p)$(v) # platform (either "unix" or "cyg") pf = cyg pf = unix # compiler CC = gcc CC = g++ # extension ifeq ($(CC),gcc) ext = c else ext = cc endif # Runtime libraries ifeq ($(pf),cyg) LIBS= -L\bin -lglut32 -LC:\WINNT\system32 -lopengl32 -lglu32 INC= -I\usr\include else LIBS = -L/usr/X11R6/lib -L/usr/unsupported/installers/chenli/lib \ -lglut -lGL -lGLU -lXmu -lXi -lXext -lX11 -lm -lsocket -lnsl INC = -I/usr/include -I/usr/unsupported/installers/chenli/include endif ############################################################ # Compilation Targets # # You can compile any program "foo" by calling # # % make p=foo # ############################################################ $(pv).exe exe: $(pv).o $(CC) $(pv).o $(LIBS) -o $(pv) $(pv).o o: $(pv).$(ext) $(CC) -c $(INC) $(pv).$(ext) test run: $(pv).exe $(pv) ############################################################ # House keeping functions ############################################################ tar: tar -cvf T.tar * save: ifeq ($(pf),unix) ci -l *.$(ext) Make* *html else cp *.$(ext) Make* *html RCS endif clean: -@rm -f *.o veryclean: clean -@rm -f *.exe ############################################################ # THE END ############################################################