INCS = log.h CCfgFileParser.h SRCS = CCfgFileParser.cpp log.cpp dataqueue.cpp CXX = g++ AR = ar EXEC_SO = libqueuelog.so EXEC_A = libqueuelog.a EXEC_O = libqueuelog.o # 输出目录 OUTPUT_LIB_DIR = ../../libs/ OUTPUT_INCLUDE_DIR=../../includes/ ifdef DEBUG_VERSION CFLAGS := -DMY_DEBUG -fvisibility=hidden -g -Wall -fPIC -shared -std=c++11 -Wl,--as-needed else CFLAGS := -fvisibility=hidden -g3 -O2 -Wall -fPIC -shared -std=c++11 -Wl,--as-needed endif LFLAGS1 = -lpthread OBJS = $(SRCS:.cpp=.o) all: $(EXEC_SO) $(EXEC_A) $(EXEC_SO): $(OBJS) $(CXX) -o $(EXEC_SO) $(OBJS) $(CFLAGS) $(LFLAGS1) $(EXEC_A): $(OBJS) $(AR) rcs $(EXEC_A) $(OBJS) mkdir -p $(OUTPUT_LIB_DIR) mkdir -p $(OUTPUT_INCLUDE_DIR) mv $(EXEC_A) $(OUTPUT_LIB_DIR) mv $(EXEC_SO) $(OUTPUT_LIB_DIR) cp -u *.h $(OUTPUT_INCLUDE_DIR) find . -name "*.d" -type f -print -exec rm -rf {} \; @echo "Compile successfully! result-->" $(OUTPUT_LIB_DIR) %.o: %.cpp $(CXX) -o $@ -c $< $(CFLAGS) .PHONY: clean clean: rm -f $(EXEC_SO) $(EXEC_A) $(EXEC_O) $(OBJS)