-
Notifications
You must be signed in to change notification settings - Fork 3
/
GNUmakefile
57 lines (40 loc) · 1.78 KB
/
GNUmakefile
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
define SEARCH_FOR_MAKE
$(wildcard $1/*/GNUmakefile) $(wildcard $1/*/makefile) $(wildcard $1/*/Makefile)
endef
TestDirsWithGNUmakefile := $(call SEARCH_FOR_MAKE, Tests)
TestDirs := $(dir $(TestDirsWithGNUmakefile))
RunTestDirs := $(TestDirs:%=run-%)
ExampleDirsWithGNUmakefile := $(call SEARCH_FOR_MAKE, Examples)
ExampleDirs := $(dir $(ExampleDirsWithGNUmakefile))
CleanTestDirs := $(TestDirs:%=clean-%)
CleanExampleDirs := $(ExampleDirs:%=clean-%)
RealCleanTestDirs := $(TestDirs:%=realclean-%)
RealCleanExampleDirs := $(ExampleDirs:%=realclean-%)
.PHONY: all run examples clean realclean $(TestDirs) $(ExampleDirs)
# User needs to specify GRCHOMBO_SOURCE location, e.g. using
# export GRCHOMBO_SOURCE = ~/GRChombo/Source
export GRFOLRES_SOURCE = $(shell pwd)/Source
ECHO?=@ # set this to null on the command line to increase verbosity
test: $(TestDirs)
run: test $(RunTestDirs)
examples: $(ExampleDirs)
all: run examples
clean: $(CleanTestDirs) $(CleanExampleDirs)
realclean: $(RealCleanTestDirs) $(RealCleanExampleDirs)
$(TestDirs):
$(info ################# Making test $@ #################)
$(ECHO)$(MAKE) -C $@ --no-print-directory all
$(RunTestDirs):
$(info ################# Running test $@ #################)
$(ECHO)$(MAKE) -C $(@:run-%=%) --no-print-directory run
$(ExampleDirs):
$(info ################# Making example $@ #################)
$(ECHO)$(MAKE) -C $@ --no-print-directory all
$(CleanTestDirs):
$(ECHO)$(MAKE) -C $(@:clean-%=%) --no-print-directory clean NODEPENDS=TRUE
$(CleanExampleDirs):
$(ECHO)$(MAKE) -C $(@:clean-%=%) --no-print-directory clean NODEPENDS=TRUE
$(RealCleanTestDirs):
$(ECHO)$(MAKE) -C $(@:realclean-%=%) --no-print-directory realclean NODEPENDS=TRUE
$(RealCleanExampleDirs):
$(ECHO)$(MAKE) -C $(@:realclean-%=%) --no-print-directory realclean NODEPENDS=TRUE