aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2017-03-23 23:52:02 +0100
committerRobin Krahl <me@robin-krahl.de>2017-03-23 23:56:44 +0100
commit01661c4231d778d9e3779b432306aea53c3e61de (patch)
treeb7bd953dbc76fb7a8943da0446df4b54a8a52a37 /Makefile
parent2f070d3027cad9e52e8042f55319fce3ffaf43bb (diff)
downloadsqlitepp-01661c4231d778d9e3779b432306aea53c3e61de.tar.gz
sqlitepp-01661c4231d778d9e3779b432306aea53c3e61de.tar.bz2
Makefile: Add the library as a dependecy to the test
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 6 insertions, 4 deletions
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) $@)