LATEX = pdflatex PDFVIEWER = evince EDITOR = /usr/bin/emacs -fn 9x15 -g 90x34+100+40 GNUPLOT = gnuplot CC = clang LDFLAGS = -O3 ifeq ($(CC),clang) CFLAGS = -Weverything -Wextra -pedantic $(LDFLAGS) else CFLAGS = -Wall -Wextra -pedantic $(LDFLAGS) endif LDLIBS = .PHONY: pdf edit view clean veryclean .SUFFIXES: .SUFFIXES: .c .o .gp .res %.res: %.c $(CC) $(CFLAGS) $< -o $* $(LDLIBS) ./$* > $*.res rm -f ./$* %.tex: %.gp %.res $(GNUPLOT) $*.gp binary = recursive_sum source = $(binary).c gpfile = $(binary).gp resfile = $(binary).res latexfile = $(binary) all: $(binary) hanoi res: $(resfile) pdf: $(latexfile).tex $(gpfile) $(resfile) while ($(LATEX) $(latexfile) ; \ grep -q "Rerun to get cross" $(latexfile).log ) do true ; \ done view: pdf $(PDFVIEWER) $(latexfile).pdf 2> /dev/null & clean: rm -f *.o *~ rm -f $(latexfile).log rm -f $(latexfile).aux rm -f $(latexfile)-inc-eps-converted-to.pdf $(latexfile)-inc.eps rm -f $(latexfile).res rm -f $(latexfile).tex rm -f $(latexfile).pdf rm -f $(binary) hanoi