# # Download and place this file into your project directory # Rename it to 'Makefile' (without quotes) and modify as needed # # wget http://www.phys.uconn.edu/~rozman/Courses/P2200_16F/downloads/Makefile.sample # mv Makefile.sample Makefile # # or # # wget http://www.phys.uconn.edu/~rozman/Courses/P2200_16F/downloads/Makefile.sample -O Makefile # INDENT = astyle --style=allman --add-brackets GNUPLOT = gnuplot PDFVIEWER = evince CC = clang LDFLAGS = -O CFLAGS = -Weverything -Wextra -pedantic $(LDFLAGS) LDLIBS = .SUFFIXES: .SUFFIXES: .c .o .h .res .gp .PHONY: clean veryclean indent sources = $(wildcard *.c) objects = $(sources:.c=.o) target = hanoi pdf = $(target).pdf result = $(target).res ## help : Default action is to show what commands are available. help: Makefile @sed -n 's/^##//p' $< ## hanoi : Compile and link the executable $(target) : $(objects) $(CC) $(LDFLAGS) $(objects) -o $@ ## res : Run the calculations res: $(result) $(result): $(target) ./$(target) > $(target).res ## pdf : Graph the results pdf: $(pdf) $(pdf): $(result) $(GNUPLOT) $(target).gp ## view : Open the graph in a pdf viewer view: $(pdf) $(PDFVIEWER) $(pdf) 2> /dev/null & ## indent : Indent the source code indent: $(INDENT) $(sources) ## clean : Remove the auto-generated files clean : rm -f *.o rm -f *.*~ rm -f *.*.orig ## veryclean : Remove the auto-generated files, ## the tests results, and the graph veryclean : clean rm -f $(target) $(pdf) $(result) ## settings : Show variables and settings. settings: @echo ' ' @echo 'sources :' $(sources) @echo 'objects :' $(objects) @echo 'target :' $(target) @echo 'result :' $(result) @echo 'pdf :' $(pdf) @echo ' ' @echo 'INDENT :' $(INDENT) @echo 'GNUPLOT :' $(GNUPLOT) @echo ' ' @echo 'CC :' $(CC) @echo 'LDFLAGS :' $(LDFLAGS) @echo 'CFLAGS :' $(CFLAGS) @echo 'LDLIBS :' $(LDLIBS) @echo ' '