From: Michael D. Lowis Date: Wed, 30 Dec 2015 03:36:40 +0000 (-0500) Subject: Added config.mk for user-specific configuration X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=da41cad55cdafa1a5061ecdfb226412674d7bd6d;p=projs%2Fatf.git Added config.mk for user-specific configuration --- diff --git a/.gitignore b/.gitignore index 4d40434..3672b54 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ *.ko *.obj *.elf +*.d +*.gcno +*.gcda # Libraries *.lib @@ -21,3 +24,4 @@ *.i*86 *.x86_64 *.hex +config.mk diff --git a/Makefile b/Makefile index f628280..a90128a 100644 --- a/Makefile +++ b/Makefile @@ -15,15 +15,29 @@ CFLAGS += ${INCS} ${CPPFLAGS} LDFLAGS += ${LIBS} ARFLAGS = rcs +# commands +COMPILE = @echo CC $@; ${CC} ${CFLAGS} -c -o $@ $< +LINK = @echo LD $@; ${LD} -o $@ $^ ${LDFLAGS} +ARCHIVE = @echo AR $@; ${AR} ${ARFLAGS} $@ $^ +CLEAN = @rm -f + #------------------------------------------------------------------------------ # Build Targets and Rules #------------------------------------------------------------------------------ -SRCS = source/atf.c -OBJS = ${SRCS:.c=.o} -TEST_SRCS = tests/main.c tests/test_signals.c -TEST_OBJS = ${TEST_SRCS:.c=.o} +LIBNAME = atf +LIB = lib${LIBNAME}.a + +DEPS = ${OBJS:.o=.d} +OBJS = source/atf.o + +TEST_BIN = test${LIBNAME} +TEST_DEPS = ${TEST_OBJS:.o=.d} +TEST_OBJS = tests/main.o tests/test_signals.o -all: options libatf.a testatf +# load user-specific settings +-include config.mk + +all: options ${LIB} tests options: @echo "Toolchain Configuration:" @@ -34,22 +48,28 @@ options: @echo " AR = ${AR}" @echo " ARFLAGS = ${ARFLAGS}" -libatf.a: ${OBJS} - @echo AR $@ - @${AR} ${ARFLAGS} $@ ${OBJS} +tests: ${TEST_BIN} + +${LIB}: ${OBJS} + ${ARCHIVE} -testatf: ${TEST_OBJS} libatf.a - @echo LD $@ - @${LD} -o $@ ${TEST_OBJS} libatf.a ${LDFLAGS} +${TEST_BIN}: ${TEST_OBJS} ${LIB} + ${LINK} -./$@ @echo "Note: It is expected that exactly 2 of the tests will fail." .c.o: - @echo CC $< - @${CC} ${CFLAGS} -c -o $@ $< + ${COMPILE} clean: - @rm -f libatf.a testatf ${OBJS} ${TEST_OBJS} + ${CLEAN} ${LIB} ${TEST_BIN} ${OBJS} ${TEST_OBJS} + ${CLEAN} ${OBJS:.o=.gcno} ${OBJS:.o=.gcda} + ${CLEAN} ${TEST_OBJS:.o=.gcno} ${TEST_OBJS:.o=.gcda} + ${CLEAN} ${DEPS} ${TEST_DEPS} + +# load dependency files +-include ${DEPS} +-include ${TEST_DEPS} -.PHONY: all options +.PHONY: all options tests diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..b4b59ae --- /dev/null +++ b/config.mk @@ -0,0 +1,17 @@ +#------------------------------------------------------------------------------ +# User and Platform Specific Configuration Options +#------------------------------------------------------------------------------ +# Override the tools used with platform specific ones +#CC = cc +#LD = ${CC} +#AR = ar + +# GCC dependency generation +#COMPILE += && ${CC} ${INCS} -MM -MT $@ -MF ${@:.o=.d} ${<:.o=.c} + +# Enable output of debug symbols +#CFLAGS += -g + +# Enable output of coverage information +#CFLAGS += --coverage +#LDFLAGS += --coverage