2014-01-27 17:52:09 +08:00
|
|
|
SRC_DIR=../../src
|
|
|
|
_SOURCES = factory.cpp formatters.cpp line_logger.cpp os.cpp
|
|
|
|
|
|
|
|
SOURCES = $(patsubst %,$(SRC_DIR)/%,$(_SOURCES))
|
|
|
|
OBJS_RELEASE = $(patsubst %.cpp,release/%.o,$(_SOURCES))
|
|
|
|
OBJS_DEBUG = $(patsubst %.cpp,debug/%.o,$(_SOURCES))
|
|
|
|
|
|
|
|
|
|
|
|
CXX = g++
|
|
|
|
CXXFLAGS = -Wall -std=c++11 -pthread -I../../include
|
|
|
|
CXX_RELEASE_FLAGS = -O3 -flto
|
2014-01-27 18:54:05 +08:00
|
|
|
CXX_DEBUG_FLAGS= -g
|
2014-01-27 17:52:09 +08:00
|
|
|
|
|
|
|
OUTLIB_RELEASE = libc11log.a
|
|
|
|
OUTLIB_DEBUG = libc11log-debug.a
|
|
|
|
|
2014-01-27 18:54:05 +08:00
|
|
|
TEST_RELEASE = testme
|
|
|
|
TEST_DEBUG = testme-debug
|
|
|
|
|
2014-01-27 17:52:09 +08:00
|
|
|
.PHONY: all mkdirs release debug build clean
|
|
|
|
|
|
|
|
all: release
|
2014-01-27 18:54:05 +08:00
|
|
|
|
2014-01-27 17:52:09 +08:00
|
|
|
release: CXXFLAGS += $(CXX_RELEASE_FLAGS)
|
|
|
|
release: mkdirs build-release
|
|
|
|
|
|
|
|
|
|
|
|
debug: CXXFLAGS += $(CXX_DEBUG_FLAGS)
|
|
|
|
debug: mkdirs build-debug
|
|
|
|
|
|
|
|
mkdirs:
|
|
|
|
@mkdir -p release debug
|
|
|
|
|
|
|
|
|
|
|
|
build-release: $(OBJS_RELEASE)
|
2014-01-27 18:54:05 +08:00
|
|
|
ar rs $(OUTLIB_RELEASE) $^
|
|
|
|
$(CXX) $(SRC_DIR)/test.cpp $(OUTLIB_RELEASE) -o $(TEST_RELEASE) $(CXXFLAGS)
|
2014-01-27 17:52:09 +08:00
|
|
|
|
|
|
|
build-debug: $(OBJS_DEBUG)
|
2014-01-27 18:54:05 +08:00
|
|
|
ar rs $(OUTLIB_DEBUG) $^
|
|
|
|
$(CXX) $(SRC_DIR)/test.cpp $(OUTLIB_DEBUG) -o $(TEST_DEBUG) $(CXXFLAGS)
|
2014-01-27 17:52:09 +08:00
|
|
|
|
|
|
|
release/%.o: $(SRC_DIR)/%.cpp
|
|
|
|
$(CXX) -c $< -o $@ $(CXXFLAGS)
|
|
|
|
|
|
|
|
debug/%.o: $(SRC_DIR)/%.cpp
|
|
|
|
$(CXX) -c $< -o $@ $(CXXFLAGS)
|
|
|
|
|
|
|
|
clean:
|
2014-01-27 19:20:00 +08:00
|
|
|
rm -rf release debug daily.* $(TEST_RELEASE) $(TEST_DEBUG) $(OUTLIB_RELEASE) $(OUTLIB_DEBUG)
|
2014-01-27 17:52:09 +08:00
|
|
|
|
|
|
|
|