diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2009-02-24 14:04:18 +0100 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2009-02-24 14:04:18 +0100 |
commit | c8808247d13af4a326e69e9c81f8dbf9a62af610 (patch) | |
tree | 7fe13322fc0dc64894c448ebc393c0a9a73c726a /makefiles | |
parent | cac9269b115502071175436828c698d7cb4ddc5c (diff) | |
download | wolfbones-c8808247d13af4a326e69e9c81f8dbf9a62af610.tar.gz wolfbones-c8808247d13af4a326e69e9c81f8dbf9a62af610.tar.bz2 |
better testing: added TEST_ variables in makefiles, added TEST_<feature> macros in test_*.c for easier testing of stub functions
Diffstat (limited to 'makefiles')
-rw-r--r-- | makefiles/clean.mk | 13 | ||||
-rw-r--r-- | makefiles/compiler.mk | 8 | ||||
-rw-r--r-- | makefiles/depend.mk | 19 | ||||
-rw-r--r-- | makefiles/sub.mk | 4 |
4 files changed, 28 insertions, 16 deletions
diff --git a/makefiles/clean.mk b/makefiles/clean.mk index c924fee..d416905 100644 --- a/makefiles/clean.mk +++ b/makefiles/clean.mk @@ -1,9 +1,12 @@ # cleans up directories # # requires: -# - BINS, OBJS, CPPOBJS, BIN_OBJS -# - CMODULES, CPPMODULES -# - SUBDIRS +# - SUBDIRS: for recursive cleaning +# - local_clean, local_distclean targets in local GNUmakefile +# - all artifacts to clean: +# - BINS, TEST_BINS, TEST_CPP_BINS, CPP_BINS +# - OBJS, CPPOBJS, BIN_OBJS, TEST_BIN_OBJS, CPP_BIN_OBJS, TEST_CPP_BIN_OBJS +# - CMODULES, CPPMODULES # # provides: # - target: clean @@ -19,8 +22,8 @@ clean: clean_recursive local_clean -@rm -f *.bak 2>/dev/null -@rm -f *~ 2>/dev/null -@rm -f *.d port/*.d 2>/dev/null - -@rm -f $(BINS) $(CPP_BINS) 2>/dev/null - -@rm -f $(OBJS) $(CPP_OBJS) $(BIN_OBJS) $(CPP_BIN_OBJS) 2>/dev/null + -@rm -f $(BINS) $(CPP_BINS) $(TEST_BINS) $(TEST_CPP_BINS) 2>/dev/null + -@rm -f $(OBJS) $(CPP_OBJS) $(BIN_OBJS) $(TEST_BIN_OBJS) $(CPP_BIN_OBJS) $(TEST_CPP_BIN_OBJS) 2>/dev/null -@rm -f exec/* -@rm -f *.core -@rm -f $(CMODULES) $(CPPMODULES) diff --git a/makefiles/compiler.mk b/makefiles/compiler.mk index 668a579..581f9c6 100644 --- a/makefiles/compiler.mk +++ b/makefiles/compiler.mk @@ -4,7 +4,11 @@ # - INCLUDE_DIRS # # provides: -# - BIN_OBJS: the object files we need for the binaries (containing the main) +# - BIN_OBJS: the object files we need for the binaries which we build always +# - CPP_BIN_OBJS: same for binaries which have C++ code in them +# - TEST_BIN_OBJS: same as BIN_OBJS but for test binaries compiled only when +# testing +# - TEST_CPP_BIN_OBJS: same for C++ tests # # start of gcc section @@ -218,4 +222,6 @@ CCPP_LINK = $(CCPP) $(CCPP_LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $(CPPOBJS) $< BIN_OBJS = $(BINS:$(EXE)=.o) +TEST_BIN_OBJS = $(TEST_BINS:$(EXE)=.o) CPP_BIN_OBJS = $(CPP_BINS:$(EXE)=.o) +TEST_CPP_BIN_OBJS = $(TEST_CPP_BINS:$(EXE)=.o) diff --git a/makefiles/depend.mk b/makefiles/depend.mk index 14e816b..bcdb5b2 100644 --- a/makefiles/depend.mk +++ b/makefiles/depend.mk @@ -4,7 +4,8 @@ # requires: # - compilers CC and CCPP # - INCLUDEDIRS -# - OBJS, CPP_OBJS and BIN_OBJS +# - OBJS, CPP_OBJS and BIN_OBJS, CPP_BIN_OBJS +# - TEST_BINS, TEST_BIN_OBJS, TEST_CPP_BINS, TEST_CPP_BIN_OBJS # # provides: # - included dependency files @@ -15,12 +16,12 @@ ifeq "$(COMPILER)" "gcc" %.d : %.c @echo Generating dependencies for $< - @$(CC) -MM -MT $@ $(CFLAGS) $< | \ + @$(CC) -DMAKE_DEPENDENCIES -MM -MT $@ $(CFLAGS) $< | \ sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ %.d : %.cpp @echo Generating dependencies for $< - @$(CCPP) -MM -MT $@ $(CCPPFLAGS) $< | \ + @$(CCPP) -DMAKE_DEPENDENCIES -MM -MT $@ $(CCPPFLAGS) $< | \ sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ endif @@ -29,7 +30,7 @@ ifeq "$(COMPILER)" "tcc" %.d : %.c @echo Generating dependencies for $< - @makedepend $(INCLUDE_DIRS) -I/usr/lib/tcc/include -f - $< > $@ + @makedepend -DMAKE_DEPENDENCIES $(INCLUDE_DIRS) -I/usr/lib/tcc/include -f - $< > $@ endif @@ -37,12 +38,12 @@ ifeq "$(COMPILER)" "icc" %.d : %.c @echo Generating dependencies for $< - @$(CC) -MM -MT $@ $(CFLAGS) $< | \ + @$(CC) -DMAKE_DEPENDENCIES -MM -MT $@ $(CFLAGS) $< | \ sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ %.d : %.cpp @echo Generating dependencies for $< - @$(CCPP) -MM -MT $@ $(CCPPFLAGS) $< | \ + @$(CCPP) -DMAKE_DEPENDENCIES -MM -MT $@ $(CCPPFLAGS) $< | \ sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ endif @@ -51,14 +52,16 @@ ifeq "$(COMPILER)" "spro" %.d : %.c @echo Generating dependencies for $< - @$(CC) -xM1 $(INCLUDE_DIRS) $< > $@ + @$(CC) -DMAKE_DEPENDENCIES -xM1 $(INCLUDE_DIRS) $< > $@ %.d : %.cpp @echo Generating dependencies for $< - @$(CCPP) -xM1 $(INCLUDE_DIRS) $< > $@ + @$(CCPP) -DMAKE_DEPENDENCIES -xM1 $(INCLUDE_DIRS) $< > $@ endif -include $(OBJS:.o=.d) -include $(CPP_OBJS:.o=.d) -include $(BIN_OBJS:.o=.d) -include $(CPP_BIN_OBJS:.o=.d) +-include $(TEST_BIN_OBJS:.o=.d) +-include $(TEST_CPP_BIN_OBJS:.o=.d) diff --git a/makefiles/sub.mk b/makefiles/sub.mk index 5a5d606..567e144 100644 --- a/makefiles/sub.mk +++ b/makefiles/sub.mk @@ -12,12 +12,12 @@ -include $(TOPDIR)/makefiles/compiler.mk .PHONY: all $(SUBDIRS) local_all -all: local_all $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(CPP_BIN_OBJS) $(BINS) $(CPP_BINS) $(CMODULES) $(CPPMODULES) +all: $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(CPP_BIN_OBJS) $(BINS) $(CPP_BINS) $(CMODULES) $(CPPMODULES) local_all @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ (set -e; $(MAKE) -C $$d all || exit 1); done) .PHONY: test local_test -test: local_test $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(BINS) $(CPP_BINS) $(CMODULES) $(CPPMODULES) +test: $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(BINS) $(CPP_BINS) $(TEST_BINS) $(TEST_CPP_BINS) $(CMODULES) $(CPPMODULES) local_test @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ (set -e; $(MAKE) -C $$d test || exit 1); done) |