-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
47 lines (33 loc) · 1.5 KB
/
Makefile
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
all: test
image:
exiftool -overwrite_original -recurse -EXIF= images
cd images; find . -iname '*.png' -print0 | xargs -0 optipng -o7 -preserve
cd images; find . -iname '*.jpg' -print0 | xargs -0 jpegoptim --max=90 --strip-all --preserve --totals --all-progressive
TESTEXE := ./testers/wrapper.py
TESTTARGETS = $(addsuffix -diff, $(TESTNAMES))
TN = $(eval TN := $$(shell cat testers/tests.txt))$(TN)
TESTSTLS = $(addprefix things/testers/,$(addsuffix _tester.stl,$(TESTNAMES)))
REFSTLS = $(addprefix things/testers/REFERENCE_,$(addsuffix _tester.stl,$(TESTNAMES)))
testers/tests.txt:
@echo Constructing test list
@$(TESTEXE)
# cat can fail if run as part of variable evaluation because it happens before the rule to
# make tests.txt executes. instead run cat as part of a rule and populate an included makefile,
# which causes make to reload and then TESTTARGETS will be populated correctly
testers/.Makefile: testers/tests.txt
@echo TESTNAMES = $(TN) > $@
include testers/.Makefile
-include testers/.*.depends
things/testers/REFERENCE_%_tester.stl:
@echo Generating a reference .stl for $*
@$(TESTEXE) -g --reference $*
things/testers/%_tester.stl: testers/%-tester.scad
@echo Generating an .stl for $*
@$(TESTEXE) -D testers/.$*.depends -g $*
.PHONY: test image clean-test
.NOTINTERMEDIATE: $(TESTSTLS) $(REFSTLS)
%-diff: things/testers/REFERENCE_%_tester.stl things/testers/%_tester.stl
@$(TESTEXE) -d $*
test: testers/tests.txt $(TESTTARGETS)
clean-test:
-rm $(TESTSTLS) testers/.*.depends testers/.Makefile