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