# CMPS 160 # Painterly Rendering # Makefile for Assignment 2 # # Builds executeable with user code in main.cc by default # # If you have some.jpg and you want to make it into a ppm for use with # your program run "make some.ppm" (also works for .jpeg .bmp .gif .png) # # Use "make demo" to package the binary and documentation for sharing. # # XXX: If your program uses multiple object files, update the # USEROBJECTS variable below (example: helper.cc becomes helper.o) USEROBJECTS = main.o CXXFLAGS = -I/usr/X11R6/include/GL \ -Wall -g \ -L/usr/X11R6/lib LIBS = -lglut -lGL -lGLU CONVERT = convert GTAR = tar PROG = paint DEMO = $(PROG)_demo all: $(PROG) README # executable linking step $(PROG): ppm_canvas.o $(USEROBJECTS) $(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS) # image convertion rules (requires ImageMagik) %.ppm: %.jpg $(CONVERT) -format ppm $< $@ %.ppm: %.jpeg $(CONVERT) -format ppm $< $@ %.ppm: %.bmp $(CONVERT) -format ppm $< $@ %.ppm: %.gif $(CONVERT) -format ppm $< $@ %.ppm: %.png $(CONVERT) -format ppm $< $@ # mandatory README reminder message, fails build README: @ echo "" @ echo "Don't forget to make a README before you submit your project!" @ echo "" @ echo "Should include:" @ echo " - your name and email" @ echo " - partners' names (if any)" @ echo " - how to run your program" @ echo " - how to use it while its running" @ echo " - a brief description of painting method" @ echo "" @ false # cleanup rules .PHONY: clean spotless clean: -rm *.o spotless: clean -rm $(PROG) -rm $(DEMO).tgz # demo export rules demo: $(DEMO).tgz @ echo "" @ echo "Your demo package is in $(DEMO).tgz" @ echo "" $(DEMO).tgz: $(PROG) README cp $(PROG) $(DEMO) cp README $(DEMO).README $(GTAR) -czf $@ $(DEMO) $(DEMO).README rm $(DEMO) $(DEMO).README