-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (39 loc) · 1.84 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
48
49
50
51
52
53
####################################################################################################
#### this Makefile allows to build target by giving the flavour options in the top directory
#### e.g. make DUE=rollback CKPT=disk
####################################################################################################
# options to build differently behavioured same targets
# what our options can be, note that same order than values defiend in global.h
DUE_OPTS:=none async path rollback lossy
CKPT_OPTS:=none disk mem
# enough to number all our options
numbers:=$(shell seq 0 4)
# lousy defaults
DUE=none
CKPT=none
#check if variables in list of allowed values
ifeq ($(filter $(DUE),$(DUE_OPTS)),)
$(error Please choose DUE from "$(DUE_OPTS)")
else ifeq ($(filter $(CKPT),$(CKPT_OPTS)),)
$(error Please choose CKPT from $(CKPT_OPTS))
endif
# use function to find number of variable in list. 0-numbered.
pos=$(filter $(addprefix $(1), $(numbers)), $(join $(2), $(numbers)))
D:=$(subst $(DUE),,$(call pos, $(DUE), $(DUE_OPTS)))
C:=$(subst $(CKPT),,$(call pos, $(CKPT), $(CKPT_OPTS)))
FLAVOUR=-DDUE=$D -DCKPT=$C
DIR=$(DUE)_$(CKPT)
empty=
space=$(empty) $(empty)
#####################################################################################################
# Finally defining directories and targets
DESTDIR:=$(subst $(space),_,$(DIR))
.PHONY : default clean all ompssall plainall debug ompssdebug plaindebug conv ompssconv plainconv speedup ompssspeedup plainspeedup instr ompssinstr plaininstr
default:ompssall
all ompssall plainall debug ompssdebug plaindebug conv ompssconv plainconv speedup ompssspeedup plainspeedup instr ompssinstr plaininstr: $(DESTDIR)
+$(MAKE) -C $(DESTDIR) -f ../Makefile.sub "FLAVOUR=$(FLAVOUR)" VPATH=../src $(@)
clean:
rm -rf async_* lossy_* none_* path_* rollback_*
.SECONDEXPANSION:
$(DESTDIR):
mkdir -p $(DESTDIR)