summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authoryangwei <[email protected]>2019-07-02 18:33:53 +0800
committeryangwei <[email protected]>2019-07-02 18:33:53 +0800
commit940818f6435266bf6de71a37158b3a8a3398f9f9 (patch)
treef870e344cf6125d1ba2dee1e7f9328bbec48482e /Makefile
parent1d5ed9b703326b08a082f3038df65ae7a991328b (diff)
1、移除make,仅支持cmake
2、内置cjson,隐藏符号名编译 3、增加自动版本号脚本
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile115
1 files changed, 39 insertions, 76 deletions
diff --git a/Makefile b/Makefile
index 37b25d2..ac23531 100644
--- a/Makefile
+++ b/Makefile
@@ -1,78 +1,41 @@
-#define
-PLUG_TYPE_BIZ=biz
-PLUG_TYPE_PROTO=proto
-PLUG_TYPE_PLATFORM=platform
-
-
-path=/home/mesasoft/sapp_run
-
-PLUG_TYPE=biz
-plug_name=ntc_ssl_collect
-plug_conf_dir=$(path)/ntcconf/
-
-plug_dir_name=$(plug_name)
-plug_inf_name=$(plug_name).inf
-
-plug_so_path=./bin/$(plug_name).so
-#plug_conf_path=./conf/$(plug_name).conf
-plug_inf=./conf/$(plug_name).inf
-
-#-----auto filled----
-
-biz_plug_dir_name=./plug/business
-biz_plug_dir=$(path)/$(biz_plug_dir_name)
-
-protocol_plug_dir_name=./plug/protocol
-protocol_plug_dir=$(path)/$(protocol_plug_dir_name)
-
-
-platform_plug_dir_name=./plug/platform
-platform_plug_dir=$(path)/$(platform_plug_dir_name)
-
-business_conflist_path=$(biz_plug_dir)/conflist_business.inf
-protocol_conflist_path=$(protocol_plug_dir)/conflist_protocol.inf
-platform_conflist_path=$(platform_plug_dir)/conflist_platform.inf
-
-ifeq ($(PLUG_TYPE), $(PLUG_TYPE_BIZ))
-dest_plug_dir_name = $(biz_plug_dir_name)
-dest_plug_dir = $(biz_plug_dir)
-dest_conflist_path=$(business_conflist_path)
-endif
-
-ifeq ($(PLUG_TYPE), $(PLUG_TYPE_PROTO))
-dest_plug_dir_name = $(protocol_plug_dir_name)
-dest_plug_dir = $(protocol_plug_dir)
-dest_conflist_path=$(protocol_conflist_path)
-endif
-
-ifeq ($(PLUG_TYPE), $(PLUG_TYPE_PLATFORM))
-dest_plug_dir_name = $(platform_plug_dir_name)
-dest_plug_dir = $(platform_plug_dir)
-dest_conflist_path=$(platform_conflist_path)
+BUILD_DIR = $(CURDIR)/build
+LOCAL_DIR = $(CURDIR)
+DEBUG_FLAGS = -DCMAKE_BUILD_TYPE=Debug
+REL_FLAGS = -DCMAKE_BUILD_TYPE=RelWithDebInfo
+
+ifneq ($(INSTALL_PREFIX),)
+DEBUG_FLAGS += -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX)
+REL_FLAGS += -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX)
endif
-plug_inf_path=$(dest_plug_dir_name)/$(plug_dir_name)/$(plug_inf_name)
-plug_dir=$(dest_plug_dir)/$(plug_dir_name)
-
-
-.PHONY: all clean opt update
-
-all:
- cd src && $(MAKE)
- @echo -e "current path=\033[32;49;1m$(path)\033[32;49;0m , try \033[32;49;1m[make install path=PATH]\033[32;49;0m to install plugin"
-clean:
- cd src && $(MAKE) clean
-
-opt:
- $(MAKE) all
-
-update:
- @cp -f $(plug_so_path) $(plug_dir)
- @echo -e "copy \033[32;49;1m$(plug_so_path) \033[32;49;0m to \033[32;49;1m$(plug_dir)\033[32;49;0m \033[31;49;1m[success]\033[31;49;0m"
-
-install:
- mkdir -p $(plug_dir)
- mkdir -p $(plug_conf_dir)
- @cp -f $(plug_so_path) $(plug_inf) $(plug_dir)
- @echo -e "copy \033[32;49;1m$(plug_so_path) $(plug_inf)\033[32;49;0m to \033[32;49;1m$(plug_dir)\033[32;49;0m \033[31;49;1m[success]\033[31;49;0m"
- @ret=`cat $(dest_conflist_path)|grep $(plug_inf_path)|wc -l`;if [ $$ret -eq 0 ];then echo $(plug_inf_path) >>$(dest_conflist_path);fi
+all: _make_build_dir _compile_rel
+
+PHONY: all _make_build_dir _compile_debug _compile_rel _install \
+ build_release build_debug install
+
+_make_build_dir:
+ mkdir -p $(BUILD_DIR)
+
+_compile_debug:
+ cd $(BUILD_DIR) && cmake $(LOCAL_DIR) $(DEBUG_FLAGS) && make
+
+_compile_rel:
+ cd $(BUILD_DIR) && cmake $(LOCAL_DIR) $(REL_FLAGS) && make
+
+_install:
+ cd $(BUILD_DIR) && make install
+_package:
+ cd $(BUILD_DIR) && make package
+_clean:
+ rm -rf $(BUILD_DIR)
+
+# Release Version, No Debug Symbol and Optimized with -O2
+release: _make_build_dir _compile_rel
+# Debug Version, Optimized with -O0
+debug: _make_build_dir _compile_debug
+# Install
+install: _install
+# Package
+package: _package
+# Clean
+clean: _clean