view Makefile @ 0:3269e4627918

init dstress
author svnowner
date Sat, 25 Sep 2004 22:33:30 +0000
parents
children e238a15dbc74
line wrap: on
line source

# $Header: /home/th/Dokumente/Entwicklung/MEIN_CVS/MiniD/src/Makefile,v 1.8 2004/09/23 09:29:40 th Exp $

OBJ_DIR = obj
LOG	= log.txt

ifndef DMD
DMD	= dmd
endif

ifdef DEFLAGS
X_DEFLAGS = $(DFLAGS)
endif

DFLAGS 	= $(X_DFLAGS) -od$(OBJ_DIR)

ifndef FIND
FIND	= find 
endif 

ifndef RM
RM	= rm -rf
endif

ifndef ECHO
ECHO	= echo
endif

ifndef TOUCH
TOUCH	= touch
endif

to_log = >> $(LOG) 2>&1
ext_run = exe
ext_norun = bin
ext_nocompile = no
ext_compile = o
ext_source = d

dest_run = $(sort $(subst .$(ext_source),.$(ext_run),$(shell $(FIND) run -regex ".*\\.$(ext_source)" ) ) )
dest_norun = $(sort $(subst .$(ext_source),.$(ext_norun),$(shell $(FIND) norun -regex ".*\\.$(ext_source)" ) ) )
dest_compile = $(sort $(subst .$(ext_source),.$(ext_compile),$(shell $(FIND) compile -regex ".*\\.$(ext_source)" ) ) )
dest_nocompile = $(sort $(subst .$(ext_source),.$(ext_nocompile),$(shell $(FIND) nocompile -regex ".*\\.$(ext_source)" ) ) )

all : compile nocompile run norun 

nocompile : $(dest_nocompile)

%.$(ext_nocompile) : %.$(ext_source)
	@if $(DMD) $(DFLAGS) -of$@ $< $(to_log); then $(ECHO) "XPASS: $(subst .$(ext_nocompile),,$@)"; $(RM) $@; else $(ECHO) "FAIL:  $(subst .$(ext_nocompile),,$@)"; $(TOUCH) $@; fi

compile : $(dest_compile)

%.$(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

run : $(dest_run)

%.$(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

norun : $(dest_norun)

%.$(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

clean_log :
	$(RM) $(LOG)

clean :
	$(RM) $(OBJ_DIR)/*.* $(dest_run) $(dest_norun) $(dest_compile) $(dest_nocompile)