spdlog/build/gcc/makefile

57 lines
1.2 KiB
Makefile
Raw Normal View History

2014-01-27 17:52:09 +08:00
SRC_DIR=../../src
2014-01-29 10:00:05 +08:00
2014-01-27 17:52:09 +08:00
_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++
2014-01-27 19:57:52 +08:00
CXXFLAGS = -march=native -Wall -std=c++11 -pthread -I../../include
2014-01-29 10:00:05 +08:00
CXX_RELEASE_FLAGS = -O2 -flto
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-28 01:35:18 +08:00
.PHONY: all mkdirs release debug build clean rebuild
2014-01-27 17:52:09 +08:00
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
2014-01-29 10:00:05 +08:00
2014-01-27 17:52:09 +08:00
release/%.o: $(SRC_DIR)/%.cpp
$(CXX) -c $< -o $@ $(CXXFLAGS)
2014-01-29 10:00:05 +08:00
2014-01-27 17:52:09 +08:00
2014-01-29 10:00:05 +08:00
debug/%.o: $(SRC_DIR)/%.cpp
2014-01-27 17:52:09 +08:00
$(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
2014-01-28 01:35:18 +08:00
rebuild: clean all
2014-01-27 17:52:09 +08:00