From 14ccc34805e6adf9829370307921f8a3019052cc Mon Sep 17 00:00:00 2001 From: gabime Date: Mon, 27 Jan 2014 12:54:05 +0200 Subject: [PATCH] makefile with test program --- build/gcc/makefile | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/build/gcc/makefile b/build/gcc/makefile index 691b06e5..6917fcf7 100644 --- a/build/gcc/makefile +++ b/build/gcc/makefile @@ -6,21 +6,22 @@ OBJS_RELEASE = $(patsubst %.cpp,release/%.o,$(_SOURCES)) OBJS_DEBUG = $(patsubst %.cpp,debug/%.o,$(_SOURCES)) -#$(info OBJS: ${OBJS}) - CXX = g++ CXXFLAGS = -Wall -std=c++11 -pthread -I../../include CXX_RELEASE_FLAGS = -O3 -flto -CXX_DEBUG_FLAGS= -g +CXX_DEBUG_FLAGS= -g OUTLIB_RELEASE = libc11log.a OUTLIB_DEBUG = libc11log-debug.a +TEST_RELEASE = testme +TEST_DEBUG = testme-debug + .PHONY: all mkdirs release debug build clean all: release - + release: CXXFLAGS += $(CXX_RELEASE_FLAGS) release: mkdirs build-release @@ -33,10 +34,12 @@ mkdirs: 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) - ar rvs $(OUTLIB_DEBUG) $^ + ar rs $(OUTLIB_DEBUG) $^ + $(CXX) $(SRC_DIR)/test.cpp $(OUTLIB_DEBUG) -o $(TEST_DEBUG) $(CXXFLAGS) release/%.o: $(SRC_DIR)/%.cpp $(CXX) -c $< -o $@ $(CXXFLAGS) @@ -45,6 +48,6 @@ debug/%.o: $(SRC_DIR)/%.cpp $(CXX) -c $< -o $@ $(CXXFLAGS) clean: - rm -rf release debug $(OUTLIB_RELEASE) $(OUTLIB_DEBUG) + rm -rf release debug $(TEST_RELEASE) $(TEST_DEBUG) $(OUTLIB_RELEASE) $(OUTLIB_DEBUG)