File: Makefile

package info (click to toggle)
nml 0.7.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,792 kB
  • sloc: python: 18,398; ansic: 109; makefile: 69
file content (53 lines) | stat: -rw-r--r-- 2,008 bytes parent folder | download
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
.PHONY: clean all
.DEFAULT:

_V ?= @
_E ?= @echo
_SE ?= echo

TEST_FILES = $(basename $(shell ls *.nml))
EXAMPLES = $(shell ls ../examples)
NMLC ?= $(abspath ../nmlc)
# Note: Manually overriding NML_FLAGS may break the regression test
NML_FLAGS ?= -s -c --verbosity=1

.PHONY: $(TEST_FILES) $(EXAMPLES) clean

all: $(TEST_FILES) $(EXAMPLES)

$(TEST_FILES):
	$(_V) echo "Running test $@"
	$(_V) mkdir -p output nml_output output2
# First pass : check compilation of source nml and generation of optimised nml
	$(_V) $(NMLC) $(NML_FLAGS) --nfo output/$@.nfo --grf output/$@.grf $@.nml --nml nml_output/$@.nml
	$(_V) diff -u --strip-trailing-cr expected/$@.nfo output/$@.nfo
	$(_V) diff expected/$@.grf output/$@.grf
# Second pass : check compilation of optimised nml
	$(_V) $(NMLC) $(NML_FLAGS) -n --nfo output2/$@.nfo --grf output2/$@.grf nml_output/$@.nml
	$(_V) diff -u --strip-trailing-cr expected/$@.nfo output2/$@.nfo
	$(_V) diff expected/$@.grf output2/$@.grf

$(EXAMPLES):
	$(_V) echo "Testing example $@"
	$(_V) mkdir -p output nml_output output2
# First pass as above
# We must change directory, because nmlc provides no way to set a base directory for realsprite files.
	$(_V) cd ../examples/$@/ && \
		$(NMLC) $(NML_FLAGS) -n \
		--nfo ../../regression/output/example_$@.nfo \
		--nml ../../regression/nml_output/example_$@.nml \
		--grf ../../regression/output/example_$@.grf \
		example_$@.nml && cd ../../regression
	$(_V) diff -u --strip-trailing-cr expected/example_$@.nfo output/example_$@.nfo
	$(_V) diff expected/example_$@.grf output/example_$@.grf
# Second pass
	$(_V) cd ../examples/$@/ && \
		$(NMLC) $(NML_FLAGS) -n \
		--nfo ../../regression/output2/example_$@.nfo \
		--grf ../../regression/output2/example_$@.grf \
		../../regression/nml_output/example_$@.nml && cd ../../regression
	$(_V) diff -u --strip-trailing-cr expected/example_$@.nfo output2/example_$@.nfo
	$(_V) diff expected/example_$@.grf output2/example_$@.grf

clean:
	$(_V) rm -rf output nml_output output2 .nmlcache