# Makefile for pi calculation via polygon perimeter GNUPLOT = gnuplot PDFVIEWER = evince INDENT = astyle --style=allman --add-brackets CC = clang LDFLAGS = -O3 ifeq ($(CC),clang) CFLAGS = -Weverything -Wextra -pedantic $(LDFLAGS) else CFLAGS = -Wall -Wextra -pedantic $(LDFLAGS) endif LDLIBS = -lm .SUFFIXES: .SUFFIXES: .c .o .gp .pdf .PHONY: clean veryclean sources = pi-poly-u.c %.res: %.c $(CC) $(CFLAGS) $< -o $* $(LDLIBS) ./$* > $*.res rm -f ./$* ## help : Default action is to show what commands are available. help: Makefile @sed -n 's/^##//p' $< ## pdf : Compile and run the code and generate the pdf graph pdf: pi-poly-u.res $(GNUPLOT) pi-poly-u.gp ## indent : Indent the source code indent: $(INDENT) $(sources) ## clean : Remove the auto-generated files clean: rm -f *.*~ rm -f *.o rm -f *.c.orig ## veryclean : Remove the auto-generated files, the tests results, and the pdf veryclean : clean rm -f pi-poly-u.res pi-poly-u.pdf pi-poly