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_DATA = $(INSTALL) -p -m 644
.PHONY: test-programs
test-programs: $(TEST_PROGRAMS)
ifeq ("@TESTING@", "yes")
TEST_INCLUDES=\
-Igmock-1.6.0/include \
-Igmock-1.6.0/gtest/include
else
TEST_INCLUDES=
endif
.SUFFIXES: .d
%.d: %.cc
@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' < $@.$$$$ > $@; \
$(RM) $@.$$$$
@ -172,10 +176,15 @@ cache_check: $(CACHE_CHECK_OBJECTS) cache/check.o
@echo " [LD] $@"
$(V) $(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS)
DEPEND_FILES=\
$(subst .cc,.d,$(SOURCE)) \
$(subst .cc,.d,$(TEST_SOURCE)) \
$(subst .cc,.d,$(PROGRAM_SOURCE))
.PHONY: clean distclean
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
$(RM) config.cache config.log config.status configure.h version.h Makefile unit-tests/Makefile
@ -193,15 +202,14 @@ install: $(PROGRAMS)
ifeq ("@TESTING@", "yes")
include unit-tests/Makefile
endif
-include $(subst .cc,.d,$(SOURCE))
-include $(subst .cc,.d,$(TEST_SOURCE))
-include $(subst .cc,.d,$(PROGRAM_SOURCE))
.PHONEY: features
features: thin_check cache_check
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] $<"
$(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/array_block_t.cc \
@ -52,7 +52,7 @@ MOCK_SOURCE=\
unit-tests/space_map_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
# include paths.
@ -62,9 +62,9 @@ MOCK_OBJECTS=$(subst .cc,.gmo,$(MOCK_SOURCE))
@echo " [CXX] $<"
$(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] $<"
$(V)g++ $(CXXFLAGS) -o $@ $(MOCK_OBJECTS) $(LIBS) $(GMOCK_LIBS) $(LIBEXPAT)
$(V)g++ $(CXXFLAGS) -o $@ $(TEST_OBJECTS) $(LIBS) $(GMOCK_LIBS) $(LIBEXPAT)
.PHONEY: unit-test