makefile Template(添加多个lib)
######################################################################
# makefile Template
#
######################################################################
# makefile Template
#
######################################################################
###################project path and name#################################
DIR=$(shell pwd)
BIN_DIR=$(DIR)/bin
LIB_DIR=$(DIR)/lib
SRC_DIR=$(DIR)/src
INCLUDE_DIR=$(DIR)/include
OBJ_DIR=$(DIR)/obj
DEPS_DIR=$(DIR)/deps
#PROGRAM=$(BIN_DIR)/test
PROGRAM=$(BIN_DIR)/TemplateProcessor
DIR=$(shell pwd)
BIN_DIR=$(DIR)/bin
LIB_DIR=$(DIR)/lib
SRC_DIR=$(DIR)/src
INCLUDE_DIR=$(DIR)/include
OBJ_DIR=$(DIR)/obj
DEPS_DIR=$(DIR)/deps
#PROGRAM=$(BIN_DIR)/test
PROGRAM=$(BIN_DIR)/TemplateProcessor
###################OBJ file and path############################################
EXTENSION=cpp
OBJS=$(patsubst $(SRC_DIR)/%.$(EXTENSION), $(OBJ_DIR)/%.o,$(wildcard $(SRC_DIR)/*.$(EXTENSION)))
DEPS=$(patsubst $(OBJ_DIR)/%.o, $(DEPS_DIR)/%.d, $(OBJS))
EXTENSION=cpp
OBJS=$(patsubst $(SRC_DIR)/%.$(EXTENSION), $(OBJ_DIR)/%.o,$(wildcard $(SRC_DIR)/*.$(EXTENSION)))
DEPS=$(patsubst $(OBJ_DIR)/%.o, $(DEPS_DIR)/%.d, $(OBJS))
###################include head file##################################
INCLUDE=\
-I$(INCLUDE_DIR) \
-I $(DIR)/http://www.cnblogs.com/../system/source/Platform_Lib/ \
-I $(DIR)/http://www.cnblogs.com/../system/source/Utility/
###################lib path and file######################################
LIBS=\
-L$(DIR)/../system/lib/host/ -lAppConfig -ltinyxml \
-Bdynamic -L/usr/lib -lstdc++ -Bstatic -L./lib -lctemplate_nothreads -Bdynamic -L/usr/lib -lm
INCLUDE=\
-I$(INCLUDE_DIR) \
-I $(DIR)/http://www.cnblogs.com/../system/source/Platform_Lib/ \
-I $(DIR)/http://www.cnblogs.com/../system/source/Utility/
###################lib path and file######################################
LIBS=\
-L$(DIR)/../system/lib/host/ -lAppConfig -ltinyxml \
-Bdynamic -L/usr/lib -lstdc++ -Bstatic -L./lib -lctemplate_nothreads -Bdynamic -L/usr/lib -lm
###################compiler and option###################################
CC=g++
CFLAGS=-Wall -W -g
LDFLAGS=
CC=g++
CFLAGS=-Wall -W -g
LDFLAGS=
###################compile target###########################################
.PHONY: all clean rebuild
.PHONY: all clean rebuild
$(DEPS_DIR)/%.d: $(SRC_DIR)/%.$(EXTENSION)
$(CC) -MM $(INCLUDE) $(CFLAGS) $< | sed -e 1's,^,$(OBJ_DIR)/,' > $@
sinclude $(DEPS)
$(OBJ_DIR)/%.o:$(SRC_DIR)/%.$(EXTENSION)
$(CC) $< -o $@ -c $(CFLAGS) $(INCLUDE)
$(CC) $< -o $@ -c $(CFLAGS) $(INCLUDE)
rebuild: clean all
clean:
rm -rf $(OBJS) $(BIN_DIR)/* $(DEPS_DIR)/*
rm -rf $(OBJS) $(BIN_DIR)/* $(DEPS_DIR)/*