diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 117 |
1 files changed, 39 insertions, 78 deletions
@@ -1,80 +1,41 @@ -#define -PLUG_TYPE_BIZ=biz -PLUG_TYPE_PROTO=proto -PLUG_TYPE_PLATFORM=platform - - -path=/home/mesasoft/sapp - -PLUG_TYPE=biz -plug_name=ntc_http_collect -plug_conf_dir=$(path)/avconf/ - -plug_dir_name=$(plug_name) -plug_inf_name=$(plug_name).inf - -plug_so_path=./bin/$(plug_name).so -plug_conf_path=./conf/*.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_conf_path) $(plug_conf_dir) - @echo -e "copy \033[32;49;1m$(plug_conf_path)\033[32;49;0m to \033[32;49;1m$(plug_conf_dir)\033[32;49;0m \033[31;49;1m[success]\033[31;49;0m" - @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
\ No newline at end of file +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 |
