6
|
1 # GnuMakefile for dstress
|
0
|
2
|
|
3 OBJ_DIR = obj
|
|
4 LOG = log.txt
|
|
5
|
|
6 ifndef DMD
|
|
7 DMD = dmd
|
|
8 endif
|
|
9
|
|
10 ifdef DEFLAGS
|
|
11 X_DEFLAGS = $(DFLAGS)
|
|
12 endif
|
|
13
|
|
14 DFLAGS = $(X_DFLAGS) -od$(OBJ_DIR)
|
|
15
|
|
16 ifndef FIND
|
|
17 FIND = find
|
|
18 endif
|
|
19
|
|
20 ifndef RM
|
|
21 RM = rm -rf
|
|
22 endif
|
|
23
|
|
24 ifndef ECHO
|
|
25 ECHO = echo
|
|
26 endif
|
|
27
|
|
28 ifndef TOUCH
|
|
29 TOUCH = touch
|
|
30 endif
|
|
31
|
6
|
32 ifndef MAKE
|
|
33 MAKE = make
|
|
34 endif
|
|
35
|
0
|
36 to_log = >> $(LOG) 2>&1
|
|
37 ext_run = exe
|
|
38 ext_norun = bin
|
|
39 ext_nocompile = no
|
|
40 ext_compile = o
|
|
41 ext_source = d
|
6
|
42 ext_source_html = html
|
0
|
43
|
|
44 dest_run = $(sort $(subst .$(ext_source),.$(ext_run),$(shell $(FIND) run -regex ".*\\.$(ext_source)" ) ) )
|
6
|
45 dest_run += $(sort $(subst .$(ext_source_html),.$(ext_run),$(shell $(FIND) run -regex ".*\\.$(ext_source_html)" ) ) )
|
|
46
|
0
|
47 dest_norun = $(sort $(subst .$(ext_source),.$(ext_norun),$(shell $(FIND) norun -regex ".*\\.$(ext_source)" ) ) )
|
6
|
48 dest_norun += $(sort $(subst .$(ext_source_html),.$(ext_norun),$(shell $(FIND) norun -regex ".*\\.$(ext_source_html)" ) ) )
|
|
49
|
0
|
50 dest_compile = $(sort $(subst .$(ext_source),.$(ext_compile),$(shell $(FIND) compile -regex ".*\\.$(ext_source)" ) ) )
|
6
|
51 dest_compile += $(sort $(subst .$(ext_source_html),.$(ext_compile),$(shell $(FIND) compile -regex ".*\\.$(ext_source_html)" ) ) )
|
|
52
|
|
53
|
0
|
54 dest_nocompile = $(sort $(subst .$(ext_source),.$(ext_nocompile),$(shell $(FIND) nocompile -regex ".*\\.$(ext_source)" ) ) )
|
6
|
55 dest_nocompile += $(sort $(subst .$(ext_source_html),.$(ext_nocompile),$(shell $(FIND) nocompile -regex ".*\\.$(ext_source_html)" ) ) )
|
0
|
56
|
|
57 all : compile nocompile run norun
|
|
58
|
|
59 nocompile : $(dest_nocompile)
|
|
60
|
|
61 %.$(ext_nocompile) : %.$(ext_source)
|
|
62 @if $(DMD) $(DFLAGS) -of$@ $< $(to_log); then $(ECHO) "XPASS: $(subst .$(ext_nocompile),,$@)"; $(RM) $@; else $(ECHO) "FAIL: $(subst .$(ext_nocompile),,$@)"; $(TOUCH) $@; fi
|
|
63
|
6
|
64 %.$(ext_nocompile) : %.$(ext_source_html)
|
|
65 @if $(DMD) $(DFLAGS) -of$@ $< $(to_log); then $(ECHO) "XPASS: $(subst .$(ext_nocompile),,$@)"; $(RM) $@; else $(ECHO) "FAIL: $(subst .$(ext_nocompile),,$@)"; $(TOUCH) $@; fi
|
|
66
|
|
67
|
0
|
68 compile : $(dest_compile)
|
|
69
|
|
70 %.$(ext_compile) : %.$(ext_source)
|
|
71 @if $(DMD) -c -of$@ $< $(to_log) ; then $(ECHO) "PASS: $(subst .$(ext_compile),,$@)"; $(TOUCH) $@; else $(ECHO) "XFAIL: $(subst .$(ext_compile),,$@)"; $(RM) $@; fi
|
|
72
|
6
|
73 %.$(ext_compile) : %.$(ext_source_html)
|
|
74 @if $(DMD) -c -of$@ $< $(to_log) ; then $(ECHO) "PASS: $(subst .$(ext_compile),,$@)"; $(TOUCH) $@; else $(ECHO) "XFAIL: $(subst .$(ext_compile),,$@)"; $(RM) $@; fi
|
|
75
|
|
76
|
0
|
77 run : $(dest_run)
|
|
78
|
|
79 %.$(ext_run) : %.$(ext_source)
|
|
80 @if $(DMD) $(DFLAGS) -of$@ $< $(to_log); then if $@ $(to_log); then $(ECHO) "PASS: $(subst .$(ext_run),,$@)"; else $(ECHO) "XFAIL: $(subst .$(ext_run),,$@)"; $(RM) $@; fi else $(ECHO) "XFAIL: $(subst .$(ext_run),,$@) (compiling error)"; fi
|
|
81
|
6
|
82 %.$(ext_run) : %.$(ext_source_html)
|
|
83 @if $(DMD) $(DFLAGS) -of$@ $< $(to_log); then if $@ $(to_log); then $(ECHO) "PASS: $(subst .$(ext_run),,$@)"; else $(ECHO) "XFAIL: $(subst .$(ext_run),,$@)"; $(RM) $@; fi else $(ECHO) "XFAIL: $(subst .$(ext_run),,$@) (compiling error)"; fi
|
|
84
|
0
|
85 norun : $(dest_norun)
|
|
86
|
|
87 %.$(ext_norun) : %.$(ext_source)
|
|
88 @if $(DMD) $(DFLAGS) -of$@ $< $(to_log); then if $@ $(to_log); then $(ECHO) "XPASS: $(subst .$(ext_norun),,$@)"; else $(ECHO) "FAIL: $(subst .$(ext_norun),,$@)"; $(RM) $@; fi else $(ECHO) "XFAIL: $(subst .$(ext_run),,$@) (compiling error)"; fi
|
|
89
|
6
|
90 %.$(ext_norun) : %.$(ext_source_html)
|
|
91 @if $(DMD) $(DFLAGS) -of$@ $< $(to_log); then if $@ $(to_log); then $(ECHO) "XPASS: $(subst .$(ext_norun),,$@)"; else $(ECHO) "FAIL: $(subst .$(ext_norun),,$@)"; $(RM) $@; fi else $(ECHO) "XFAIL: $(subst .$(ext_run),,$@) (compiling error)"; fi
|
|
92
|
|
93
|
0
|
94 clean_log :
|
|
95 $(RM) $(LOG)
|
|
96
|
|
97 clean :
|
|
98 $(RM) $(OBJ_DIR)/*.* $(dest_run) $(dest_norun) $(dest_compile) $(dest_nocompile)
|