# Makefile for cahn_hilliard microstructural evolution visualization INDENT = astyle --style=allman --add-brackets VIEWER = eog CC = clang LFLAGS = -O3 CFLAGS = -Weverything -Wextra -pedantic -std=c99 $(LDFLAGS) LDLIBS = $(shell gsl-config --libs) -lfftw3 -lgd -lm .SUFFIXES: .SUFFIXES: .c .o .h .res .gp .PHONY: clean veryclean indent gifs anim target = ch sources = cahn-hilliard.c evolve.c snapshot.c objects = $(sources:.c=.o) headers = functions.h gif = $(target).gif readme = output/README ## help : Default action is to show what commands are available. help: Makefile @sed -n 's/^##//p' $< $(objects): $(sources) $(headers) ## ch : Compile and link the executable $(target): $(objects) ${CC} $(LFLAGS) -o $@ $^ $(LDLIBS) ## gifs : Generate the snapshots gifs $(readme): $(target) ./$(target) ## anim : Create the animation anim: $(gif) $(gif): output/README gifsicle -o $@ -d10 -l100 -O output/*.gif ## view : View the animation view: $(gif) $(VIEWER) $^ ## indent : Indent the source code indent: $(INDENT) $(sources) ## clean : Remove the auto-generated files clean: rm -f *.o *~ $(target) rm -f *.*.orig ## veryclean : Remove the auto-generated files, ## the snapshots, and the animation veryclean: clean rm -f output/*.gif output/README $(gif) ## settings : Show variables and settings. settings: @echo ' ' @echo 'sources :' $(sources) @echo 'objects :' $(objects) @echo 'target :' $(target) @echo 'gif :' $(gif) @echo ' ' @echo 'INDENT :' $(INDENT) @echo ' ' @echo 'CC :' $(CC) @echo 'LDFLAGS :' $(LDFLAGS) @echo 'CFLAGS :' $(CFLAGS) @echo 'LDLIBS :' $(LDLIBS) @echo ' '