From 01661c4231d778d9e3779b432306aea53c3e61de Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Thu, 23 Mar 2017 23:52:02 +0100 Subject: Makefile: Add the library as a dependecy to the test --- Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3cac760..3501abd 100644 --- a/Makefile +++ b/Makefile @@ -9,16 +9,18 @@ DOCUMENTATION_DIR := doc SOURCE_NAMES_LIB := sqlitepp.cpp SOURCE_NAMES_TEST := sqlitepp_test.cpp -TARGETS := $(LIBRARY_DIR)/libsqlitepp.so $(BINARY_DIR)/sqlitepp_test +TARGET_LIB := $(LIBRARY_DIR)/libsqlitepp.so SOURCES_LIB := $(foreach source,$(SOURCE_NAMES_LIB),$(SOURCE_DIR)/$(source)) OBJECTS_LIB := $(SOURCES_LIB:$(SOURCE_DIR)/%.cpp=$(OBJECT_DIR)/%.o) DEPENDS_LIB := $(OBJECTS_LIB:.o=.d) +TARGET_TEST := $(BINARY_DIR)/sqlitepp_test SOURCES_TEST := $(foreach source,$(SOURCE_NAMES_TEST),$(SOURCE_DIR)/$(source)) OBJECTS_TEST := $(SOURCES_TEST:$(SOURCE_DIR)/%.cpp=$(OBJECT_DIR)/%.o) DEPENDS_TEST := $(OBJECTS_TEST:.o=.d) +TARGETS := $(TARGET_LIB) $(TARGET_TEST) INCLUDES := $(INCLUDE_DIR)/sqlitepp/sqlitepp.h OBJECTS := $(OBJECTS_LIB) $(OBJECTS_TEST) DEPENDS := $(DEPENDS_LIB) $(DEPENDS_TEST) @@ -51,15 +53,15 @@ clean: doc: $(INCLUDES) doxygen -$(LIBRARY_DIR)/libsqlitepp.so: $(OBJECTS_LIB) +$(TARGET_LIB): $(OBJECTS_LIB) $(info (CXX) $@) $(QUIET)mkdir -p $(LIBRARY_DIR) $(QUIET)$(CXX) -shared $(LDFLAGS) $(LDFLAGS_LIB) -o $@ $^ -$(BINARY_DIR)/sqlitepp_test: $(OBJECTS_TEST) +$(TARGET_TEST): $(OBJECTS_TEST) $(TARGET_LIB) $(info (CXX) $@) $(QUIET)mkdir -p $(BINARY_DIR) - $(QUIET)$(CXX) $(LDFLAGS) $(LDFLAGS_TEST) $< -o $@ + $(QUIET)$(CXX) $(LDFLAGS) $(LDFLAGS_TEST) $(OBJECTS_TEST) -o $@ $(OBJECTS): $(OBJECT_DIR)/%.o: $(SOURCE_DIR)/%.cpp $(info (CXX) $@) -- cgit v1.2.3