0
|
1 # $Header: /home/th/Dokumente/Entwicklung/MEIN_CVS/MiniD/src/Makefile,v 1.8 2004/09/23 09:29:40 th Exp $
|
|
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
|
|
32 to_log = >> $(LOG) 2>&1
|
|
33 ext_run = exe
|
|
34 ext_norun = bin
|
|
35 ext_nocompile = no
|
|
36 ext_compile = o
|
|
37 ext_source = d
|
|
38
|
|
39 dest_run = $(sort $(subst .$(ext_source),.$(ext_run),$(shell $(FIND) run -regex ".*\\.$(ext_source)" ) ) )
|
|
40 dest_norun = $(sort $(subst .$(ext_source),.$(ext_norun),$(shell $(FIND) norun -regex ".*\\.$(ext_source)" ) ) )
|
|
41 dest_compile = $(sort $(subst .$(ext_source),.$(ext_compile),$(shell $(FIND) compile -regex ".*\\.$(ext_source)" ) ) )
|
|
42 dest_nocompile = $(sort $(subst .$(ext_source),.$(ext_nocompile),$(shell $(FIND) nocompile -regex ".*\\.$(ext_source)" ) ) )
|
|
43
|
|
44 all : compile nocompile run norun
|
|
45
|
|
46 nocompile : $(dest_nocompile)
|
|
47
|
|
48 %.$(ext_nocompile) : %.$(ext_source)
|
|
49 @if $(DMD) $(DFLAGS) -of$@ $< $(to_log); then $(ECHO) "XPASS: $(subst .$(ext_nocompile),,$@)"; $(RM) $@; else $(ECHO) "FAIL: $(subst .$(ext_nocompile),,$@)"; $(TOUCH) $@; fi
|
|
50
|
|
51 compile : $(dest_compile)
|
|
52
|
|
53 %.$(ext_compile) : %.$(ext_source)
|
|
54 @if $(DMD) -c -of$@ $< $(to_log) ; then $(ECHO) "PASS: $(subst .$(ext_compile),,$@)"; $(TOUCH) $@; else $(ECHO) "XFAIL: $(subst .$(ext_compile),,$@)"; $(RM) $@; fi
|
|
55
|
|
56 run : $(dest_run)
|
|
57
|
|
58 %.$(ext_run) : %.$(ext_source)
|
|
59 @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
|
|
60
|
|
61 norun : $(dest_norun)
|
|
62
|
|
63 %.$(ext_norun) : %.$(ext_source)
|
|
64 @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
|
|
65
|
|
66 clean_log :
|
|
67 $(RM) $(LOG)
|
|
68
|
|
69 clean :
|
|
70 $(RM) $(OBJ_DIR)/*.* $(dest_run) $(dest_norun) $(dest_compile) $(dest_nocompile)
|