changeset 17:deb014248067

cleanup of makefile
author thomask
date Fri, 08 Oct 2004 21:11:00 +0000
parents 0fcca61f008f
children 33a25c1e1cfc
files Makefile
diffstat 1 files changed, 26 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Oct 08 07:38:21 2004 +0000
+++ b/Makefile	Fri Oct 08 21:11:00 2004 +0000
@@ -7,12 +7,6 @@
 DMD	= dmd
 endif
 
-ifdef DEFLAGS
-X_DEFLAGS = $(DFLAGS)
-endif
-
-DFLAGS 	= $(X_DFLAGS) -od$(OBJ_DIR)
-
 ifndef FIND
 FIND	= find 
 endif 
@@ -41,58 +35,52 @@
 ext_source = d
 ext_source_html = html
 
-dest_run = $(sort $(subst .$(ext_source),.$(ext_run),$(shell $(FIND) run -regex ".*\\.$(ext_source)" ) ) )
-dest_run += $(sort $(subst .$(ext_source_html),.$(ext_run),$(shell $(FIND) run -regex ".*\\.$(ext_source_html)" ) ) )
-
-dest_norun = $(sort $(subst .$(ext_source),.$(ext_norun),$(shell $(FIND) norun -regex ".*\\.$(ext_source)" ) ) )
-dest_norun += $(sort $(subst .$(ext_source_html),.$(ext_norun),$(shell $(FIND) norun -regex ".*\\.$(ext_source_html)" ) ) )
-
-dest_compile = $(sort $(subst .$(ext_source),.$(ext_compile),$(shell $(FIND) compile -regex ".*\\.$(ext_source)" ) ) )
-dest_compile += $(sort $(subst .$(ext_source_html),.$(ext_compile),$(shell $(FIND) compile -regex ".*\\.$(ext_source_html)" ) ) )
-
+all : compile nocompile run norun
 
-dest_nocompile = $(sort $(subst .$(ext_source),.$(ext_nocompile),$(shell $(FIND) nocompile -regex ".*\\.$(ext_source)" ) ) )
-dest_nocompile += $(sort $(subst .$(ext_source_html),.$(ext_nocompile),$(shell $(FIND) nocompile -regex ".*\\.$(ext_source_html)" ) ) )
-
-all : compile nocompile run norun 
-
-nocompile : $(dest_nocompile)
-
-%.$(ext_nocompile) : %.$(ext_source)
-	@if $(DMD) -c -of$@ $< $(to_log); then $(ECHO) "XPASS: $(subst .$(ext_nocompile),,$@)"; $(RM) $@; else $(ECHO) "FAIL:  $(subst .$(ext_nocompile),,$@)"; $(TOUCH) $@; fi
-
-%.$(ext_nocompile) : %.$(ext_source_html)
-	        @if $(DMD) -c -of$@ $< $(to_log); then $(ECHO) "XPASS: $(subst .$(ext_nocompile),,$@)"; $(RM) $@; else $(ECHO) "FAIL:  $(subst .$(ext_nocompile),,$@)"; $(TOUCH) $@; fi
+.PHONY: all compile nocompile run norun clean distclean clean_log log
 
 
-compile : $(dest_compile)
+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)" ) ) )
+
+%.$(ext_nocompile) : %.$(ext_source)
+	@if $(DMD) $(DFLAGS) -c -of$@ $< $(to_log); then $(ECHO) "XPASS: $(subst .$(ext_nocompile),,$@)"; $(RM) $@; else $(ECHO) "FAIL:  $(subst .$(ext_nocompile),,$@)"; $(TOUCH) $@; fi
+
+%.$(ext_nocompile) : %.$(ext_source_html)
+	@if $(DMD) $(DEFLAGS) -c -of$@ $< $(to_log); then $(ECHO) "XPASS: $(subst .$(ext_nocompile),,$@)"; $(RM) $@; else $(ECHO) "FAIL:  $(subst .$(ext_nocompile),,$@)"; $(TOUCH) $@; fi
+
+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)" ) ) )
 
 %.$(ext_compile) : %.$(ext_source)
-	@if $(DMD) -c -of$@ $< $(to_log) ; then $(ECHO) "PASS:  $(subst .$(ext_compile),,$@)"; $(TOUCH) $@; else $(ECHO) "XFAIL: $(subst .$(ext_compile),,$@)"; $(RM) $@; fi
+	@if $(DMD) $(DEFLAGS) -c -of$@ $< $(to_log) ; then $(ECHO) "PASS:  $(subst .$(ext_compile),,$@)"; $(TOUCH) $@; else $(ECHO) "XFAIL: $(subst .$(ext_compile),,$@)"; $(RM) $@; fi
 
-%.$(ext_compile) : %.$(ext_source_html)
-	        @if $(DMD) -c -of$@ $< $(to_log) ; then $(ECHO) "PASS:  $(subst .$(ext_compile),,$@)"; $(TOUCH) $@; else $(ECHO) "XFAIL: $(subst .$(ext_compile),,$@)"; $(RM) $@; fi
+%.$(ext_compile) : %.$(ext_source_html) 
+	@if $(DMD) $(DEFLAGS) -c -of$@ $< $(to_log) ; then $(ECHO) "PASS:  $(subst .$(ext_compile),,$@)"; $(TOUCH) $@; else $(ECHO) "XFAIL: $(subst .$(ext_compile),,$@)"; $(RM) $@; fi
 
 
-run : $(dest_run)
+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)" ) ) )
 
 %.$(ext_run) : %.$(ext_source)
-	@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
+	@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
 
 %.$(ext_run) : %.$(ext_source_html)
-	        @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
+	@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
 
-norun : $(dest_norun)
+
+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)" ) ) )
 
 %.$(ext_norun) : %.$(ext_source)
-	@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
+	@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
 
 %.$(ext_norun) : %.$(ext_source_html)
-	        @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
+	@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
 
+log : distclean all
+	
+distclean : clean_log clean
 
 clean_log :
 	$(RM) $(LOG)
 
 clean :
-	$(RM) $(OBJ_DIR)/*.* $(dest_run) $(dest_norun) $(dest_compile) $(dest_nocompile)
+	$(RM) $(OBJ_DIR)/?*.o run/?*.$(ext_run) norun/?*.$(ext_norun) compile/?*.$(ext_compile) nocompile/?*.$(ext_nocompile)
+