############################################################ # 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 ############################################################ ########### DEFAULT PROGRAM ############################### # program is "p" p=tingjen p=stroke # version is "v" v= # program is "pv" pv=$(p)$(v) ########### PLATFORM (unix or cyg) ####################### pf = cyg pf = unix ########### COMPILER ##################################### CC = g++ CC = gcc ########### EXTENSION #################################### ext = cc ext = c ########### RUNTIME and INCLUDE LIBRARY ############################## ifeq ($(pf),cyg) LIBS= -L\bin -lglut32 -LC:\WINNT\system32 -lopengl32 -lglu32 -lm 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/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): $(pv).exe $(pv) ################################################## # Housekeeping ################################################## tar: -@tar -cvf t.tar *.c *.cc Makefile save: -@ci -l *.c *.cc Makefile cp: -@cp *.cc Makefile RCS clean: -@rm -f *.o veryclean: clean -@rm -f *.exe rotate tingjen