forked from LLNL/cardioid
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
35 lines (29 loc) · 1.19 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
include Makefile.arch
ARCHES ?= $(ARCHGUESS)
TESTS ?= seq
PYTHON ?= python
test: $(foreach ARCH,$(ARCHES),$(foreach TEST,$(TESTS),test-$(ARCH)-$(TEST)))
build: $(foreach ARCH,$(ARCHES),build-$(ARCH))
clean: $(foreach ARCH,$(ARCHES),$(foreach TEST,$(TESTS),clean-$(ARCH)-$(TEST)))
mkdir-%:
@mkdir -p $(patsubst mkdir-%,build/%,$@)
.PRECIOUS: build/%/CMakeCache.txt
build/%/CMakeCache.txt: mkdir-%
(cd $(patsubst mkdir-%,build/%,$<) && cmake -C $(patsubst mkdir-%,../../arch/%.txt,$<) ../..)
build-%: build/%/CMakeCache.txt
$(MAKE) --no-print-directory -C build/$(patsubst build-%,%,$@)
cleanbuild-%:
$(MAKE) --no-print-directory -C build/$(patsubst cleanbuild-%,%,$@) clean
define TEST_RULE
.PRECIOUS: test/scratch/$1/$2/results.tap
test/scratch/$1/$2/results.tap : build-$1
mkdir -p test/scratch/$1/$2
$$(PYTHON) test/runner.py -b $1 -p $2 >| $$@ 2>&1
test-$1-$2 : test/scratch/$1/$2/results.tap
@cat $$<
clean-$1-$2: cleanbuild-$1
rm -f test/scratch/$1/$2/results.tap
endef
ALL_ARCH=$(patsubst arch/%.txt,%,$(wildcard arch/*.txt))
ALL_PROFILE=$(patsubst test/profiles/%,%,$(wildcard test/profiles/*))
$(foreach arch,$(ALL_ARCH),$(foreach profile,$(ALL_PROFILE),$(eval $(call TEST_RULE,$(arch),$(profile)))))