Commit 14ccc348 authored by gabime's avatar gabime

makefile with test program

parent 12ba6741
...@@ -6,8 +6,6 @@ OBJS_RELEASE = $(patsubst %.cpp,release/%.o,$(_SOURCES)) ...@@ -6,8 +6,6 @@ OBJS_RELEASE = $(patsubst %.cpp,release/%.o,$(_SOURCES))
OBJS_DEBUG = $(patsubst %.cpp,debug/%.o,$(_SOURCES)) OBJS_DEBUG = $(patsubst %.cpp,debug/%.o,$(_SOURCES))
#$(info OBJS: ${OBJS})
CXX = g++ CXX = g++
CXXFLAGS = -Wall -std=c++11 -pthread -I../../include CXXFLAGS = -Wall -std=c++11 -pthread -I../../include
CXX_RELEASE_FLAGS = -O3 -flto CXX_RELEASE_FLAGS = -O3 -flto
...@@ -16,6 +14,9 @@ CXX_DEBUG_FLAGS= -g ...@@ -16,6 +14,9 @@ CXX_DEBUG_FLAGS= -g
OUTLIB_RELEASE = libc11log.a OUTLIB_RELEASE = libc11log.a
OUTLIB_DEBUG = libc11log-debug.a OUTLIB_DEBUG = libc11log-debug.a
TEST_RELEASE = testme
TEST_DEBUG = testme-debug
.PHONY: all mkdirs release debug build clean .PHONY: all mkdirs release debug build clean
...@@ -33,10 +34,12 @@ mkdirs: ...@@ -33,10 +34,12 @@ mkdirs:
build-release: $(OBJS_RELEASE) build-release: $(OBJS_RELEASE)
ar rvs $(OUTLIB_RELEASE) $^ ar rs $(OUTLIB_RELEASE) $^
$(CXX) $(SRC_DIR)/test.cpp $(OUTLIB_RELEASE) -o $(TEST_RELEASE) $(CXXFLAGS)
build-debug: $(OBJS_DEBUG) build-debug: $(OBJS_DEBUG)
ar rvs $(OUTLIB_DEBUG) $^ ar rs $(OUTLIB_DEBUG) $^
$(CXX) $(SRC_DIR)/test.cpp $(OUTLIB_DEBUG) -o $(TEST_DEBUG) $(CXXFLAGS)
release/%.o: $(SRC_DIR)/%.cpp release/%.o: $(SRC_DIR)/%.cpp
$(CXX) -c $< -o $@ $(CXXFLAGS) $(CXX) -c $< -o $@ $(CXXFLAGS)
...@@ -45,6 +48,6 @@ debug/%.o: $(SRC_DIR)/%.cpp ...@@ -45,6 +48,6 @@ debug/%.o: $(SRC_DIR)/%.cpp
$(CXX) -c $< -o $@ $(CXXFLAGS) $(CXX) -c $< -o $@ $(CXXFLAGS)
clean: clean:
rm -rf release debug $(OUTLIB_RELEASE) $(OUTLIB_DEBUG) rm -rf release debug $(TEST_RELEASE) $(TEST_DEBUG) $(OUTLIB_RELEASE) $(OUTLIB_DEBUG)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment