#================================================================================ EXEC_NAME=dataExporter-srv INST_NAME=test DEBUG_LEV=-v3 INSTALL_DIR=/usr/local/bin #================================================================================ INC_DIR=/usr/local/omniORB-4.1.7/include \ /usr/local/zeromq-3.2.3/include/zmq \ /usr/local/tango-8.1.2/include/tango \ /usr/local/soci-3.2.1/include \ /usr/local/soci-3.2.1/include/soci \ /usr/include/mysql \ /usr/local/protobuf-2.5.0/include \ ./src LIB_DIR=/usr/local/omniORB-4.1.7/lib \ /usr/local/zeromq-3.2.3/lib \ /usr/local/tango-8.1.2/lib \ /usr/local/soci-3.2.1/lib64 \ /usr/local/protobuf-2.5.0/lib #================================================================================ CC=g++ CXX_DEBUG_FLAGS=-g -DVERBOSE_DEBUG CXX_RELEASE_FLAGS=-O3 CXX_DEFAULT_FLAGS=-c -Wall -Wextra -std=c++11 -std=gnu++11 LDFLAGS=-Wall -lomniORB4 -lomniDynamic4 -lCOS4 -lomnithread -ltango -llog4tango \ -lsoci_core -lsoci_mysql -lboost_system -lboost_thread -lboost_filesystem \ -lboost_date_time-mt -lprotobuf -lssl INC_PARM=$(foreach d, $(INC_DIR), -I$d) LIB_PARM=$(foreach d, $(LIB_DIR), -L$d) PROTOC :=/usr/local/protobuf-2.5.0/bin/protoc #================================================================================ SRC_DIR=./src OBJ_DIR=./obj BIN_DIR=./bin PROTO_DIR=./proto #================================================================================ EXECUTABLE := $(BIN_DIR)/$(EXEC_NAME) CPP_FILES := $(wildcard $(SRC_DIR)/*.cpp) OBJ_FILES := $(addprefix $(OBJ_DIR)/,$(notdir $(CPP_FILES:.cpp=.o))) #================================================================================ PROTO_FILES := $(wildcard $(PROTO_DIR)/*.proto) PROTO_HEADERS := $(addprefix $(SRC_DIR)/,$(notdir $(PROTO_FILES:.proto=.pb.h))) PROTO_CLASSES := $(addprefix $(SRC_DIR)/,$(notdir $(PROTO_FILES:.proto=.pb.cc))) CPP_FILES += $(PROTO_CLASSES) OBJ_FILES += $(addprefix $(OBJ_DIR)/,$(notdir $(PROTO_CLASSES:.pb.cc=.pb.o))) #================================================================================ .PHONY: all all: debug .PHONY: run run: debug $(EXECUTABLE) $(INST_NAME) $(DEBUG_LEV) .PHONY: release release: CXXFLAGS+=$(CXX_RELEASE_FLAGS) $(CXX_DEFAULT_FLAGS) release: $(EXECUTABLE) .PHONY: debug debug: CXXFLAGS+=$(CXX_DEBUG_FLAGS) $(CXX_DEFAULT_FLAGS) debug: $(EXECUTABLE) $(EXECUTABLE): makedir $(OBJ_FILES) $(CC) $(LDFLAGS) $(LIB_PARM) -o $@ $(OBJ_FILES) $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(CC) $(CXXFLAGS) $(INC_PARM) -o $@ $< $(OBJ_DIR)/%.pb.o: $(SRC_DIR)/%.pb.cc $(CC) $(CXXFLAGS) $(INC_PARM) -o $@ $< .PHONY: protoc protoc: $(PROTOC) --proto_path=$(PROTO_DIR) --cpp_out=$(SRC_DIR) $(PROTO_FILES) .PHONY: makedir makedir: -mkdir -p $(OBJ_DIR) $(BIN_DIR) .PHONY: clean clean: -rm -rf $(OBJ_DIR) $(BIN_DIR) .PHONY: deepclean deepclean: -rm -rf $(OBJ_DIR) $(BIN_DIR) $(PROTO_HEADERS) $(PROTO_CLASSES) .PHONY: install install: -cp $(EXECUTABLE) $(INSTALL_DIR) .PHONY: echo echo: @echo EXECUTABLE: @echo $(EXECUTABLE) @echo CPP FILES: @echo $(CPP_FILES) @echo OBJ_FILES: @echo $(OBJ_FILES) @echo INC_PARM @echo $(INC_PARM) @echo LIB_PARM @echo $(LIB_PARM) @echo PROTO_FILES @echo $(PROTO_FILES) @echo PROTO_CLASSES @echo $(PROTO_CLASSES) @echo PROTO_HEADERS @echo $(PROTO_HEADERS)