1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
# Common rules for all tests.
#
# The tests only have to define the following variables and rules:
#
# - ROOT: the root of the source
# - PDFS: the list of Pdf files to be generated.
# - For each of the Pdf files, a rule that generates either a .deps file or a
# .clusters file (there is a rule that automatically generates a clusted .deps
# from a .clusters if required).
# Define new file types.
.SUFFIXES: .log .deps .dot .pdf .clusters
# Allow including this file from anywhere.
## (only works with GNU make-3.81)
##.SECONDEXPANSION:
# Do not delete intermediate dot files from chained implicit rules.
.PRECIOUS: %.log %.deps %.dot %.clusters
OS = $(shell uname)
ifeq ($(OS),Darwin)
PSTOPDF=pstopdf -i -o
else
PSTOPDF=ps2pdf -
endif
FOOD_FLAGS= --internal-only
all: $(PDFS)
# Generate the raw list of dependencies for the entire codebase.
raw.deps: $(ROOT)
sfood -v $(FOOD_FLAGS) $(ROOT) 2>&1 > $@ | tee raw.log
# Implicit rules.
.deps.dot:
cat $< | sfood-graph -p > $@
.dot.pdf:
cat $< | dot -Tps | $(PSTOPDF) $@
# Implicit rule to convert the raw.deps file simply from the existence of a
# .clusters file.
%.deps: %.clusters raw.deps
cat raw.deps | sfood-cluster -f $< > $@
# Clean everything but the costly raw dependencies.
clean:
ls -1 *.deps | grep -v ^raw.deps | xargs rm -f
rm -f *.dot *.ps *.pdf *.clusters
# Really clean everything.
realclean: clean
rm -f raw.deps raw.log
|