refactor makefile a bit more

This commit is contained in:
Steffen Jaeckel 2016-01-23 19:00:23 +01:00
parent d1eeecb137
commit 23cad07701

View File

@ -213,10 +213,6 @@ library: $(LIBNAME)
$(OBJECTS): $(HEADERS) $(OBJECTS): $(HEADERS)
.PHONY: testprof/$(LIBTEST)
testprof/$(LIBTEST):
cd testprof ; CFLAGS="$(CFLAGS)" LIBTEST_S=$(LIBTEST_S) CC="$(CC)" LD="$(LD)" AR="$(AR)" RANLIB="$(RANLIB)" $(MAKE)
$(LIBNAME): $(OBJECTS) $(LIBNAME): $(OBJECTS)
ifneq ($V,1) ifneq ($V,1)
@echo " * ${AR} $@" @echo " * ${AR} $@"
@ -227,6 +223,23 @@ ifneq ($V,1)
endif endif
${silent} $(RANLIB) $@ ${silent} $(RANLIB) $@
.PHONY: testprof/$(LIBTEST)
testprof/$(LIBTEST):
CFLAGS="$(CFLAGS)" LIBTEST_S=$(LIBTEST_S) CC="$(CC)" LD="$(LD)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" RANLIB="$(RANLIB)" V="$(V)" $(MAKE) -C testprof
timing: library testprof/$(LIBTEST) $(TIMINGS)
ifneq ($V,1)
@echo " * ${CC} $@"
endif
${silent} $(CC) $(LDFLAGS) $(TIMINGS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TIMING)
.PHONY: test
test: library testprof/$(LIBTEST) $(TESTS)
ifneq ($V,1)
@echo " * ${CC} $@"
endif
${silent} $(CC) $(LDFLAGS) $(TESTS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TEST)
# build the demos from a template # build the demos from a template
define DEMO_template define DEMO_template
$(1): demos/$(1).o library $(1): demos/$(1).o library
@ -238,12 +251,6 @@ endef
$(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo)))) $(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo))))
timing: library testprof/$(LIBTEST) $(TIMINGS)
$(CC) $(LDFLAGS) $(TIMINGS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TIMING)
.PHONY: test
test: library testprof/$(LIBTEST) $(TESTS)
$(CC) $(LDFLAGS) $(TESTS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TEST)
#This rule installs the library and the header files. This must be run #This rule installs the library and the header files. This must be run