Mercurial > projects > dstress
annotate Makefile @ 41:84e813a3e99b
fixed Makefile so that an edited makefile triggers a rebuild of outdated targets
author | thomask |
---|---|
date | Thu, 14 Oct 2004 10:27:10 +0000 |
parents | 315459a24bf4 |
children | 1f7f839145de |
rev | line source |
---|---|
6 | 1 # GnuMakefile for dstress |
0 | 2 |
32 | 3 ifndef OBJ_DIR |
0 | 4 OBJ_DIR = obj |
32 | 5 endif |
6 | |
7 ifndef LOG | |
0 | 8 LOG = log.txt |
32 | 9 endif |
0 | 10 |
11 ifndef DMD | |
12 DMD = dmd | |
13 endif | |
14 | |
15 ifndef FIND | |
16 FIND = find | |
17 endif | |
18 | |
19 ifndef RM | |
20 RM = rm -rf | |
21 endif | |
22 | |
23 ifndef ECHO | |
24 ECHO = echo | |
25 endif | |
26 | |
27 ifndef TOUCH | |
28 TOUCH = touch | |
29 endif | |
30 | |
6 | 31 ifndef MAKE |
32 MAKE = make | |
33 endif | |
34 | |
0 | 35 to_log = >> $(LOG) 2>&1 |
36 ext_run = exe | |
37 ext_norun = bin | |
38 ext_nocompile = no | |
39 ext_compile = o | |
40 ext_source = d | |
6 | 41 ext_source_html = html |
0 | 42 |
41
84e813a3e99b
fixed Makefile so that an edited makefile triggers a rebuild of outdated targets
thomask
parents:
32
diff
changeset
|
43 all : Makefile compile nocompile run norun |
6 | 44 |
17 | 45 .PHONY: all compile nocompile run norun clean distclean clean_log log |
6 | 46 |
47 | |
41
84e813a3e99b
fixed Makefile so that an edited makefile triggers a rebuild of outdated targets
thomask
parents:
32
diff
changeset
|
48 nocompile : Makefile $(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)" ) ) ) |
17 | 49 |
41
84e813a3e99b
fixed Makefile so that an edited makefile triggers a rebuild of outdated targets
thomask
parents:
32
diff
changeset
|
50 %.$(ext_nocompile) : %.$(ext_source) Makefile |
17 | 51 @if $(DMD) $(DFLAGS) -c -of$@ $< $(to_log); then $(ECHO) "XPASS: $(subst .$(ext_nocompile),,$@)"; $(RM) $@; else $(ECHO) "FAIL: $(subst .$(ext_nocompile),,$@)"; $(TOUCH) $@; fi |
52 | |
41
84e813a3e99b
fixed Makefile so that an edited makefile triggers a rebuild of outdated targets
thomask
parents:
32
diff
changeset
|
53 %.$(ext_nocompile) : %.$(ext_source_html) Makefile |
31 | 54 @if $(DMD) $(DFLAGS) -c -of$@ $< $(to_log); then $(ECHO) "XPASS: $(subst .$(ext_nocompile),,$@)"; $(RM) $@; else $(ECHO) "FAIL: $(subst .$(ext_nocompile),,$@)"; $(TOUCH) $@; fi |
17 | 55 |
32 | 56 |
41
84e813a3e99b
fixed Makefile so that an edited makefile triggers a rebuild of outdated targets
thomask
parents:
32
diff
changeset
|
57 compile : Makefile $(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 | 58 |
41
84e813a3e99b
fixed Makefile so that an edited makefile triggers a rebuild of outdated targets
thomask
parents:
32
diff
changeset
|
59 %.$(ext_compile) : %.$(ext_source) Makefile |
31 | 60 @if $(DMD) $(DFLAGS) -c -of$@ $< $(to_log) ; then $(ECHO) "PASS: $(subst .$(ext_compile),,$@)"; $(TOUCH) $@; else $(ECHO) "XFAIL: $(subst .$(ext_compile),,$@)"; $(RM) $@; fi |
0 | 61 |
41
84e813a3e99b
fixed Makefile so that an edited makefile triggers a rebuild of outdated targets
thomask
parents:
32
diff
changeset
|
62 %.$(ext_compile) : %.$(ext_source_html) Makefile |
31 | 63 @if $(DMD) $(DFLAGS) -c -of$@ $< $(to_log) ; then $(ECHO) "PASS: $(subst .$(ext_compile),,$@)"; $(TOUCH) $@; else $(ECHO) "XFAIL: $(subst .$(ext_compile),,$@)"; $(RM) $@; fi |
6 | 64 |
65 | |
41
84e813a3e99b
fixed Makefile so that an edited makefile triggers a rebuild of outdated targets
thomask
parents:
32
diff
changeset
|
66 run : Makefile $(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 | 67 |
41
84e813a3e99b
fixed Makefile so that an edited makefile triggers a rebuild of outdated targets
thomask
parents:
32
diff
changeset
|
68 %.$(ext_run) : %.$(ext_source) Makefile |
17 | 69 @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 | 70 |
41
84e813a3e99b
fixed Makefile so that an edited makefile triggers a rebuild of outdated targets
thomask
parents:
32
diff
changeset
|
71 %.$(ext_run) : %.$(ext_source_html) Makefile |
17 | 72 @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 | 73 |
17 | 74 |
41
84e813a3e99b
fixed Makefile so that an edited makefile triggers a rebuild of outdated targets
thomask
parents:
32
diff
changeset
|
75 norun : Makefile $(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 | 76 |
41
84e813a3e99b
fixed Makefile so that an edited makefile triggers a rebuild of outdated targets
thomask
parents:
32
diff
changeset
|
77 %.$(ext_norun) : %.$(ext_source) Makefile |
17 | 78 @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 | 79 |
41
84e813a3e99b
fixed Makefile so that an edited makefile triggers a rebuild of outdated targets
thomask
parents:
32
diff
changeset
|
80 %.$(ext_norun) : %.$(ext_source_html) Makefile |
17 | 81 @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 | 82 |
32 | 83 |
17 | 84 log : distclean all |
85 | |
32 | 86 |
17 | 87 distclean : clean_log clean |
32 | 88 |
6 | 89 |
0 | 90 clean_log : |
91 $(RM) $(LOG) | |
92 | |
93 clean : | |
17 | 94 $(RM) $(OBJ_DIR)/?*.o run/?*.$(ext_run) norun/?*.$(ext_norun) compile/?*.$(ext_compile) nocompile/?*.$(ext_nocompile) |