From: Leandro Lucarella Date: Thu, 24 Dec 2009 23:20:57 +0000 (-0300) Subject: Put built stuff in a separated build directory X-Git-Url: https://git.llucax.com/software/dgc/cdgc.git/commitdiff_plain/9aada2930522a2ef5f46d66e947b7b535ecb1b75?hp=ed081900ebd31e9a96c4220641039828ed6b6afd Put built stuff in a separated build directory --- diff --git a/.gitignore b/.gitignore index 01d1dee..567609b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -*.o -cdgc.so +build/ diff --git a/Makefile b/Makefile index 1868ac9..90a932f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ +# Build directory +B := build + # D compiler to use DC := ldc @@ -36,22 +39,25 @@ sources := \ gcx.d # Default target -all: cdgc.so +all: $B/cdgc.so # Make the GC shared object -cdgc.so: $(sources:.d=.o) +$B/cdgc.so: $(patsubst %.d,$B/%.o,$(sources)) # General pattern rules ####################### -%.so: DCFLAGS += $(DC_SO_OPT) +$B/%.so: DCFLAGS += $(DC_SO_OPT) -%.so: +$B/%.so: $(if $V,,@echo ' $(LD) $@') $(if $V,,@) $(LD) $(LDFLAGS) $(LD_SO_OPT) $(LD_OUTPUT_OPTION) $^ -%.o: %.d +$B/%.o: %.d $(if $V,,@echo ' $(DC) $@') $(if $V,,@) $(DC) $(DCFLAGS) $(DC_OBJ_OPT) $(DC_OUTPUT_OPTION) $< + +__dummy := $(shell mkdir -p $B) + diff --git a/cdgcrun b/cdgcrun index 85a0bf7..d40a699 100755 --- a/cdgcrun +++ b/cdgcrun @@ -5,6 +5,6 @@ # # To run "myprogram my arguments" using the CDGC. -export LD_PRELOAD=./cdgc.so +export LD_PRELOAD=./build/cdgc.so exec "$@"