some build updates

This commit is contained in:
Joe Thornber 2013-03-25 12:56:03 +00:00
parent bc25afd686
commit 7d3ab79789
2 changed files with 23 additions and 15 deletions

View File

@ -86,15 +86,19 @@ INSTALL_DIR = $(INSTALL) -m 755 -d
INSTALL_PROGRAM = $(INSTALL) -m 755 $(STRIP) INSTALL_PROGRAM = $(INSTALL) -m 755 $(STRIP)
INSTALL_DATA = $(INSTALL) -p -m 644 INSTALL_DATA = $(INSTALL) -p -m 644
.PHONY: test-programs ifeq ("@TESTING@", "yes")
TEST_INCLUDES=\
test-programs: $(TEST_PROGRAMS) -Igmock-1.6.0/include \
-Igmock-1.6.0/gtest/include
else
TEST_INCLUDES=
endif
.SUFFIXES: .d .SUFFIXES: .d
%.d: %.cc %.d: %.cc
@echo " [DEP] $<" @echo " [DEP] $<"
$(CXX) -MM -MT $(subst .cc,.o,$<) $(INCLUDES) $(CXXFLAGS) $< > $@.$$$$;\ $(CXX) -MM -MT $(subst .cc,.o,$<) $(INCLUDES) $(TEST_INCLUDES) $(CXXFLAGS) $< > $@.$$$$;\
sed 's,\([^ :]*\)\.o[ :]*,\1.o $@ : Makefile ,g' < $@.$$$$ > $@; \ sed 's,\([^ :]*\)\.o[ :]*,\1.o $@ : Makefile ,g' < $@.$$$$ > $@; \
$(RM) $@.$$$$ $(RM) $@.$$$$
@ -172,10 +176,15 @@ cache_check: $(CACHE_CHECK_OBJECTS) cache/check.o
@echo " [LD] $@" @echo " [LD] $@"
$(V) $(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS) $(V) $(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS)
DEPEND_FILES=\
$(subst .cc,.d,$(SOURCE)) \
$(subst .cc,.d,$(TEST_SOURCE)) \
$(subst .cc,.d,$(PROGRAM_SOURCE))
.PHONY: clean distclean .PHONY: clean distclean
clean: clean:
$(RM) *.o unit-tests/*.o *.d unit-tests/*.d unit-tests/*.gmo $(TEST_PROGRAMS) $(PROGRAMS) $(OBJECTS) $(GMOCK_OBJECTS) lib/*.a $(RM) *.o unit-tests/*.o $(DEPEND_FILES) unit-tests/*.gmo $(TEST_PROGRAMS) $(PROGRAMS) $(OBJECTS) $(GMOCK_OBJECTS) lib/*.a
distclean: clean distclean: clean
$(RM) config.cache config.log config.status configure.h version.h Makefile unit-tests/Makefile $(RM) config.cache config.log config.status configure.h version.h Makefile unit-tests/Makefile
@ -193,11 +202,6 @@ install: $(PROGRAMS)
ifeq ("@TESTING@", "yes") ifeq ("@TESTING@", "yes")
include unit-tests/Makefile include unit-tests/Makefile
endif
-include $(subst .cc,.d,$(SOURCE))
-include $(subst .cc,.d,$(TEST_SOURCE))
-include $(subst .cc,.d,$(PROGRAM_SOURCE))
.PHONEY: features .PHONEY: features
@ -205,3 +209,7 @@ features: thin_check cache_check
cucumber --no-color --format progress cucumber --no-color --format progress
test: features unit-test test: features unit-test
endif
-include $(DEPEND_FILES)

View File

@ -38,7 +38,7 @@ lib/libgmock.a: $(GMOCK_DEPS)
@echo " [AR] $<" @echo " [AR] $<"
$(V)ar -rv lib/libgmock.a gtest-all.o gmock-all.o > /dev/null 2>&1 $(V)ar -rv lib/libgmock.a gtest-all.o gmock-all.o > /dev/null 2>&1
MOCK_SOURCE=\ TEST_SOURCE=\
unit-tests/gmock_main.cc \ unit-tests/gmock_main.cc \
\ \
unit-tests/array_block_t.cc \ unit-tests/array_block_t.cc \
@ -52,7 +52,7 @@ MOCK_SOURCE=\
unit-tests/space_map_t.cc \ unit-tests/space_map_t.cc \
unit-tests/transaction_manager_t.cc unit-tests/transaction_manager_t.cc
MOCK_OBJECTS=$(subst .cc,.gmo,$(MOCK_SOURCE)) TEST_OBJECTS=$(subst .cc,.gmo,$(TEST_SOURCE))
# .gmo files are plain .o files, only they've been built with gmock # .gmo files are plain .o files, only they've been built with gmock
# include paths. # include paths.
@ -62,9 +62,9 @@ MOCK_OBJECTS=$(subst .cc,.gmo,$(MOCK_SOURCE))
@echo " [CXX] $<" @echo " [CXX] $<"
$(V) $(CXX) -c $(INCLUDES) $(GMOCK_INCLUDES) $(CXXFLAGS) -o $@ $< $(V) $(CXX) -c $(INCLUDES) $(GMOCK_INCLUDES) $(CXXFLAGS) -o $@ $<
unit-tests/unit_tests: $(MOCK_OBJECTS) lib/libgmock.a lib/libpdata.a unit-tests/unit_tests: $(TEST_OBJECTS) lib/libgmock.a lib/libpdata.a
@echo " [LD] $<" @echo " [LD] $<"
$(V)g++ $(CXXFLAGS) -o $@ $(MOCK_OBJECTS) $(LIBS) $(GMOCK_LIBS) $(LIBEXPAT) $(V)g++ $(CXXFLAGS) -o $@ $(TEST_OBJECTS) $(LIBS) $(GMOCK_LIBS) $(LIBEXPAT)
.PHONEY: unit-test .PHONEY: unit-test