Modify makefile to use incremental compilation
This commit is contained in:
parent
873c0f2156
commit
02eb3d92c4
94
makefile
94
makefile
|
@ -1,11 +1,11 @@
|
||||||
.PHONY: all test
|
.PHONY: all test clean
|
||||||
|
|
||||||
DC ?= dmd
|
DC ?= dmd
|
||||||
GIT ?= git
|
GIT ?= git
|
||||||
DMD := $(DC)
|
DMD := $(DC)
|
||||||
GDC := gdc
|
GDC := gdc
|
||||||
LDC := ldc2
|
LDC := ldc2
|
||||||
OBJ_DIR := obj
|
|
||||||
LIB_SRC := \
|
LIB_SRC := \
|
||||||
$(shell find containers/src -name "*.d")\
|
$(shell find containers/src -name "*.d")\
|
||||||
$(shell find dsymbol/src -name "*.d")\
|
$(shell find dsymbol/src -name "*.d")\
|
||||||
|
@ -17,6 +17,13 @@ LIB_SRC := \
|
||||||
$(shell find stdx-allocator/source -name "*.d")
|
$(shell find stdx-allocator/source -name "*.d")
|
||||||
PROJECT_SRC := $(shell find src/ -name "*.d")
|
PROJECT_SRC := $(shell find src/ -name "*.d")
|
||||||
SRC := $(LIB_SRC) $(PROJECT_SRC)
|
SRC := $(LIB_SRC) $(PROJECT_SRC)
|
||||||
|
|
||||||
|
UT_OBJ_DIR = unittest-obj
|
||||||
|
OBJ_DIR := obj
|
||||||
|
OBJ = $(SRC:.d=.o)
|
||||||
|
PROJECT_OBJ = $(PROJECT_SRC:.d=.o)
|
||||||
|
LIB_OBJ = $(LIB_SRC:.d=.o)
|
||||||
|
|
||||||
INCLUDE_PATHS = \
|
INCLUDE_PATHS = \
|
||||||
-Isrc \
|
-Isrc \
|
||||||
-Iinifiled/source \
|
-Iinifiled/source \
|
||||||
|
@ -33,41 +40,78 @@ override DMD_FLAGS += $(DFLAGS)
|
||||||
override LDC_FLAGS += $(DFLAGS)
|
override LDC_FLAGS += $(DFLAGS)
|
||||||
override GDC_FLAGS += $(DFLAGS)
|
override GDC_FLAGS += $(DFLAGS)
|
||||||
DMD_TEST_FLAGS = -w -g -Jbin -version=StdLoggerDisableWarning
|
DMD_TEST_FLAGS = -w -g -Jbin -version=StdLoggerDisableWarning
|
||||||
override LDC_FLAGS += -O5 -release -oq -d-version=StdLoggerDisableWarning
|
override LDC_FLAGS += -O5 -release -oq -d-version=StdLoggerDisableWarning -Jbin
|
||||||
override GDC_FLAGS += -O3 -frelease -d-version=StdLoggerDisableWarning
|
override GDC_FLAGS += -O3 -frelease -d-version=StdLoggerDisableWarning -Jbin
|
||||||
SHELL:=/usr/bin/env bash
|
SHELL:=/usr/bin/env bash
|
||||||
|
|
||||||
all: dmdbuild
|
DMD_BIN = bin/dmd/dscanner
|
||||||
ldc: ldcbuild
|
LDC_BIN = bin/ldc/dscanner
|
||||||
gdc: gdcbuild
|
GDC_BIN = bin/gdc/dscanner
|
||||||
|
|
||||||
githash:
|
GITHASH = bin/githash.txt
|
||||||
mkdir -p bin && ${GIT} describe --tags > bin/githash.txt
|
|
||||||
|
|
||||||
debug: githash
|
OBJ_BY_DMD = $(addprefix $(OBJ_DIR)/dmd/, $(OBJ))
|
||||||
|
UT_OBJ_BY_DMD = $(addprefix $(UT_OBJ_DIR)/dmd/, $(PROJECT_OBJ))
|
||||||
|
|
||||||
|
OBJ_BY_LDC = $(addprefix $(OBJ_DIR)/ldc/, $(OBJ))
|
||||||
|
UT_OBJ_BY_LDC = $(addprefix $(UT_OBJ_DIR)/ldc/, $(PROJECT_OBJ))
|
||||||
|
|
||||||
|
OBJ_BY_GDC = $(addprefix $(OBJ_DIR)/gdc/, $(OBJ))
|
||||||
|
UT_OBJ_BY_GDC = $(addprefix $(UT_OBJ_DIR)/gdc/, $(PROJECT_OBJ))
|
||||||
|
|
||||||
|
$(OBJ_DIR)/dmd/%.o: %.d
|
||||||
|
@test -d $(dir $@) || mkdir -p $(dir $@)
|
||||||
|
${DC} ${DMD_FLAGS} ${VERSIONS} ${INCLUDE_PATHS} -c $< -of=$@
|
||||||
|
|
||||||
|
$(UT_OBJ_DIR)/dmd/%.o: %.d
|
||||||
|
@test -d $(dir $@) || mkdir -p $(dir $@)
|
||||||
|
${DC} ${DMD_TEST_FLAGS} ${VERSIONS} -unittest ${INCLUDE_PATHS} -c $< -of=$@
|
||||||
|
|
||||||
|
$(OBJ_DIR)/ldc/%.o: %.d
|
||||||
|
@test -d $(dir $@) || mkdir -p $(dir $@)
|
||||||
|
${DC} ${LDC_FLAGS} ${VERSIONS} ${INCLUDE_PATHS} -c $< -of=$@
|
||||||
|
|
||||||
|
$(UT_OBJ_DIR)/ldc/%.o: %.d
|
||||||
|
@test -d $(dir $@) || mkdir -p $(dir $@)
|
||||||
|
${DC} ${LDC_TEST_FLAGS} ${VERSIONS} -unittest ${INCLUDE_PATHS} -c $< -of=$@
|
||||||
|
|
||||||
|
$(OBJ_DIR)/gdc/%.o: %.d
|
||||||
|
@test -d $(dir $@) || mkdir -p $(dir $@)
|
||||||
|
${DC} ${GDC_FLAGS} ${VERSIONS} ${INCLUDE_PATHS} -c $< -o $@
|
||||||
|
|
||||||
|
$(UT_OBJ_DIR)/gdc/%.o: %.d
|
||||||
|
@test -d $(dir $@) || mkdir -p $(dir $@)
|
||||||
|
${DC} ${GDC_TEST_FLAGS} ${VERSIONS} -unittest ${INCLUDE_PATHS} -c $< -o $@
|
||||||
|
|
||||||
|
all: ${DMD_BIN}
|
||||||
|
ldc: ${LDC_BIN}
|
||||||
|
gdc: ${GDC_BIN}
|
||||||
|
|
||||||
|
${GITHASH}:
|
||||||
|
mkdir -p bin && ${GIT} describe --tags --always > ${GITHASH}
|
||||||
|
|
||||||
|
debug: ${GITHASH}
|
||||||
${DC} -w -g -Jbin -ofdsc ${VERSIONS} ${DEBUG_VERSIONS} ${INCLUDE_PATHS} ${SRC}
|
${DC} -w -g -Jbin -ofdsc ${VERSIONS} ${DEBUG_VERSIONS} ${INCLUDE_PATHS} ${SRC}
|
||||||
|
|
||||||
dmdbuild: githash
|
${DMD_BIN}: ${GITHASH} ${OBJ_BY_DMD}
|
||||||
${DC} ${DMD_FLAGS} -ofbin/dscanner ${VERSIONS} ${INCLUDE_PATHS} ${SRC}
|
${DC} -of${DMD_BIN} ${OBJ_BY_DMD}
|
||||||
rm -f bin/dscanner.o
|
|
||||||
|
|
||||||
gdcbuild: githash
|
${GDC_BIN}: ${GITHASH} ${OBJ_BY_GDC}
|
||||||
${GDC} ${GDC_FLAGS} -obin/dscanner ${VERSIONS} ${INCLUDE_PATHS} ${SRC} -Jbin
|
${GDC} -o${GDC_BIN} ${OBJ_BY_GDC}
|
||||||
|
|
||||||
ldcbuild: githash
|
${LDC_BIN}: ${GITHASH} ${OBJ_BY_LDC}
|
||||||
${LDC} ${LDC_FLAGS} -of=bin/dscanner ${VERSIONS} ${INCLUDE_PATHS} ${SRC} -Jbin
|
${LDC} -of=${DMD_BIN} ${OBJ_BY_LDC}
|
||||||
|
|
||||||
# compile the dependencies separately, s.t. their unittests don't get executed
|
# compile the dependencies separately, s.t. their unittests don't get executed
|
||||||
bin/dscanner-unittest-lib.a: ${LIB_SRC}
|
bin/dmd/dscanner-unittest-lib.a: ${LIB_SRC}
|
||||||
${DC} ${DMD_TEST_FLAGS} -c ${INCLUDE_PATHS} ${LIB_SRC} -of$@
|
${DC} ${DMD_TEST_FLAGS} -c ${VERSIONS} ${INCLUDE_PATHS} ${LIB_SRC} -of$@
|
||||||
|
|
||||||
test: bin/dscanner-unittest-lib.a githash
|
test: bin/dmd/dscanner-unittest-lib.a ${GITHASH} ${UT_OBJ_BY_DMD}
|
||||||
${DC} ${DMD_TEST_FLAGS} -unittest ${INCLUDE_PATHS} bin/dscanner-unittest-lib.a ${PROJECT_SRC} -ofbin/dscanner-unittest
|
${DC} bin/dmd/dscanner-unittest-lib.a ${UT_OBJ_BY_DMD} -ofbin/dmd/dscanner-unittest
|
||||||
./bin/dscanner-unittest
|
./bin/dmd/dscanner-unittest
|
||||||
rm -f bin/dscanner-unittest
|
|
||||||
|
|
||||||
lint: dmdbuild
|
lint: ${DMD_BIN}
|
||||||
./bin/dscanner --config .dscanner.ini --styleCheck src
|
./${DMD_BIN} --config .dscanner.ini --styleCheck src
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf dsc
|
rm -rf dsc
|
||||||
|
|
Loading…
Reference in New Issue