# Makefile to build the D runtime library core components for Posix # Designed to work with GNU make # Targets: # make # Same as make all # make lib # Build the common library # make doc # Generate documentation # make clean # Delete unneeded files created by build process LIB_BASE=libdruntime-core LIB_BUILD= LIB_TARGET=$(LIB_BASE)$(LIB_BUILD).a LIB_MASK=$(LIB_BASE)*.a CP=cp -f RM=rm -f MD=mkdir -p ADD_CFLAGS= ADD_DFLAGS= CFLAGS_RELEASE=-O $(ADD_CFLAGS) CFLAGS_DEBUG=-g $(ADD_CFLAGS) CFLAGS=$(CFLAGS_RELEASE) DFLAGS_RELEASE=-release -O -inline -w -nofloat $(ADD_DFLAGS) DFLAGS_DEBUG=-g -w -nofloat $(ADD_DFLAGS) DFLAGS=$(DFLAGS_RELEASE) TFLAGS_RELEASE=-O -inline -w -nofloat $(ADD_DFLAGS) TFLAGS_DEBUG=-g -w -nofloat $(ADD_DFLAGS) TFLAGS=$(TFLAGS_RELEASE) DOCFLAGS=-version=DDoc CC=gcc LC=$(AR) -qsv DC=dmd INC_DEST=../../import LIB_DEST=../../lib DOC_DEST=../../doc .SUFFIXES: .s .S .c .cpp .d .html .o .s.o: $(CC) -c $(CFLAGS) $< -o$@ .S.o: $(CC) -c $(CFLAGS) $< -o$@ .c.o: $(CC) -c $(CFLAGS) $< -o$@ .cpp.o: g++ -c $(CFLAGS) $< -o$@ .d.o: $(DC) -c $(DFLAGS) -Hf$*.di $< -of$@ # $(DC) -c $(DFLAGS) $< -of$@ .d.html: $(DC) -c -o- $(DOCFLAGS) -Df$*.html $< targets : lib doc all : lib doc core : lib lib : core.lib doc : core.doc ###################################################### OBJ_CORE= \ core/bitmanip.o \ core/exception.o \ core/memory_.o \ core/runtime.o \ core/thread.o \ core/vararg.o OBJ_STDC= \ core/stdc/errno.o ALL_OBJS= \ $(OBJ_CORE) \ $(OBJ_STDC) ###################################################### DOC_CORE= \ core/bitmanip.html \ core/exception.html \ core/memory.html \ core/runtime.html \ core/thread.html \ core/vararg.html ###################################################### ALL_DOCS= ###################################################### unittest : make -fposix.mak DC="$(DC)" LIB_BUILD="" DFLAGS="$(DFLAGS_RELEASE) -unittest" release : make -fposix.mak DC="$(DC)" LIB_BUILD="" DFLAGS="$(DFLAGS_RELEASE)" debug : make -fposix.mak DC="$(DC)" LIB_BUILD="-d" DFLAGS="$(DFLAGS_DEBUG)" ###################################################### core.lib : $(LIB_TARGET) $(LIB_TARGET) : $(ALL_OBJS) $(RM) $@ $(LC) $@ $(ALL_OBJS) core.doc : $(ALL_DOCS) echo Documentation generated. ###################################################### ### bitmanip core/bitmanip.o : core/bitmanip.d $(DC) -c $(DFLAGS) core/bitmanip.d -of$@ ### memory core/memory_.o : core/memory.d $(DC) -c $(DFLAGS) -Hf$*.di $< -of$@ ### thread core/thread.o : core/thread.d $(DC) -c $(DFLAGS) -d -Hf$*.di core/thread.d -of$@ ### vararg core/vararg.o : core/vararg.d $(DC) -c $(TFLAGS) -Hf$*.di core/vararg.d -of$@ ###################################################### clean : find . -name "*.di" | xargs $(RM) $(RM) $(ALL_OBJS) $(RM) $(ALL_DOCS) find . -name "$(LIB_MASK)" | xargs $(RM) install : $(MD) $(INC_DEST) find . -name "*.di" -exec cp -f {} $(INC_DEST)/{} \; $(MD) $(DOC_DEST) find . -name "*.html" -exec cp -f {} $(DOC_DEST)/{} \; $(MD) $(LIB_DEST) find . -name "$(LIB_MASK)" -exec cp -f {} $(LIB_DEST)/{} \;