2017-06-22 18:57:00 +08:00
|
|
|
SHELL = /bin/sh
|
|
|
|
#CC = g++
|
|
|
|
CC = ${ENV_CC}
|
|
|
|
#AR = ar
|
|
|
|
AR = ${ENV_AR}
|
|
|
|
ARFL = rv
|
|
|
|
#RANLIB = ranlib
|
|
|
|
RANLIB = ${ENV_RANLIB}
|
|
|
|
|
|
|
|
#OSNAME = $(shell uname -sm)
|
2017-10-16 10:30:59 +08:00
|
|
|
OSNAME = $(shell uname -s)
|
|
|
|
OSTYPE = $(shell uname -m)
|
2017-06-22 18:57:00 +08:00
|
|
|
|
2017-06-23 10:11:55 +08:00
|
|
|
DESTDIR =
|
2017-10-16 10:30:59 +08:00
|
|
|
PREFIX = usr
|
2017-06-23 10:11:55 +08:00
|
|
|
BIN_PATH = $(DESTDIR)/$(PREFIX)/bin/
|
|
|
|
LIB_ACL = $(DESTDIR)/$(PREFIX)/lib
|
|
|
|
INC_ACL = $(DESTDIR)/$(PREFIX)/include/acl-lib
|
2017-06-22 18:57:00 +08:00
|
|
|
|
|
|
|
LIB_DIST = ./dist/lib
|
|
|
|
INC_PATH = ./dist/include
|
2013-08-18 17:42:25 +08:00
|
|
|
|
|
|
|
RPATH =
|
|
|
|
DATE_NOW = 20`date +%y`.`date +%m`.`date +%d`
|
|
|
|
MAKE_ARGS =
|
|
|
|
|
2015-11-09 22:11:21 +08:00
|
|
|
SYSLIB = -lpthread -lz
|
|
|
|
LDFLAGS = -shared
|
2016-08-14 20:48:30 +08:00
|
|
|
polarssl =
|
2013-08-18 17:42:25 +08:00
|
|
|
|
2016-01-17 13:35:12 +08:00
|
|
|
ifeq ($(CC),)
|
|
|
|
CC = g++
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(AR),)
|
|
|
|
AR = ar
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(RANLIB),)
|
|
|
|
RANLIB = ranlib
|
|
|
|
endif
|
|
|
|
|
2016-08-14 20:48:30 +08:00
|
|
|
ifeq ($(findstring on, $(polarssl)), on)
|
|
|
|
CFLAGS += -DHAS_POLARSSL
|
|
|
|
endif
|
|
|
|
|
2013-08-18 17:42:25 +08:00
|
|
|
ifeq ($(findstring Linux, $(OSNAME)), Linux)
|
|
|
|
ifeq ($(findstring i686, $(OSTYPE)), i686)
|
|
|
|
RPATH = linux32
|
|
|
|
endif
|
|
|
|
ifeq ($(findstring x86_64, $(OSTYPE)), x86_64)
|
|
|
|
RPATH = linux64
|
|
|
|
endif
|
|
|
|
n = `cat /proc/cpuinfo | grep processor | wc -l`
|
|
|
|
MAKE_ARGS = -j $(n)
|
2015-11-09 22:11:21 +08:00
|
|
|
SYSLIB += -lrt -ldl
|
|
|
|
endif
|
|
|
|
|
|
|
|
# For Darwin
|
|
|
|
ifeq ($(findstring Darwin, $(OSNAME)), Darwin)
|
|
|
|
RPATH = macos
|
|
|
|
SYSLIB += -rdynamic -L/usr/lib -liconv
|
|
|
|
LDFLAGS = -dynamiclib -shared
|
2013-08-18 17:42:25 +08:00
|
|
|
endif
|
2015-11-09 22:11:21 +08:00
|
|
|
|
|
|
|
ifeq ($(findstring FreeBSD, $(OSNAME)), FreeBSD)
|
|
|
|
RPATH = freebsd
|
|
|
|
SYSLIB += -L/usr/local/lib -liconv
|
|
|
|
endif
|
|
|
|
|
2013-08-18 17:42:25 +08:00
|
|
|
ifeq ($(findstring SunOS, $(OSNAME)), SunOS)
|
|
|
|
ifeq ($(findstring i386, $(OSTYPE)), i386)
|
|
|
|
RPATH = sunos_x86
|
|
|
|
endif
|
2015-11-09 22:11:21 +08:00
|
|
|
SYSLIB += -liconv
|
2013-08-18 17:42:25 +08:00
|
|
|
endif
|
2017-06-06 19:16:58 +08:00
|
|
|
|
2013-08-18 17:42:25 +08:00
|
|
|
##############################################################################
|
|
|
|
|
2017-06-22 18:57:00 +08:00
|
|
|
.PHONY = check help all_lib all samples all clean install uninstall uninstall_all build_one
|
2019-03-09 20:23:08 +08:00
|
|
|
VERSION = 3.5.0
|
2013-08-18 17:42:25 +08:00
|
|
|
|
2019-05-18 22:03:53 +08:00
|
|
|
default: build_one acl_master
|
2017-10-10 10:19:59 +08:00
|
|
|
help h:
|
2017-06-22 18:57:00 +08:00
|
|
|
@(echo "usage: make help|all|all_lib|all_samples|clean|install|uninstall|uninstall_all|build_one")
|
2015-11-09 22:11:21 +08:00
|
|
|
all_lib:
|
2016-08-14 20:48:30 +08:00
|
|
|
@if test "$(polarssl)" = "on"; then \
|
2017-05-03 11:19:20 +08:00
|
|
|
ENV_FLAGS = $(ENV_FLAGS):HAS_POLARSSL \
|
|
|
|
export ENV_FLAGS; \
|
2016-08-14 20:48:30 +08:00
|
|
|
else \
|
2017-05-03 11:19:20 +08:00
|
|
|
export ENV_FLAGS; \
|
2016-08-14 20:48:30 +08:00
|
|
|
fi
|
2017-10-10 10:19:59 +08:00
|
|
|
# @(cd lib_acl; make pch)
|
2013-08-18 17:42:25 +08:00
|
|
|
@(cd lib_acl; make $(MAKE_ARGS))
|
|
|
|
@(cd lib_protocol; make $(MAKE_ARGS))
|
2016-08-14 20:48:30 +08:00
|
|
|
@(cd lib_acl_cpp; make check)
|
2017-10-10 10:19:59 +08:00
|
|
|
# @(cd lib_acl_cpp; make pch)
|
2013-08-18 17:42:25 +08:00
|
|
|
@(cd lib_acl_cpp; make $(MAKE_ARGS))
|
|
|
|
@(cd lib_rpc; make $(MAKE_ARGS))
|
2018-04-24 14:41:28 +08:00
|
|
|
@if test "$(OSNAME)" = "Linux" -o "$(OSNAME)" = "FreeBSD" -o "$(OSNAME)" = "Darwin"; then cd lib_fiber; make; fi
|
2015-11-09 22:11:21 +08:00
|
|
|
all_samples: all_lib
|
2013-08-18 17:42:25 +08:00
|
|
|
@(cd unit_test; make $(MAKE_ARGS))
|
2014-11-30 21:15:35 +08:00
|
|
|
@(cd lib_acl/samples; make)
|
|
|
|
@(cd lib_protocol/samples; make)
|
2015-02-07 23:44:41 +08:00
|
|
|
@(cd lib_acl_cpp/samples; make)
|
2013-08-18 17:42:25 +08:00
|
|
|
# @(cd lib_dict; make $(MAKE_ARGS))
|
|
|
|
# @(cd lib_tls; make $(MAKE_ARGS))
|
2017-06-13 16:20:45 +08:00
|
|
|
all: all_lib acl_master all_samples
|
2017-10-10 10:19:59 +08:00
|
|
|
clean cl:
|
2013-08-18 17:42:25 +08:00
|
|
|
@(cd lib_acl; make clean)
|
|
|
|
@(cd lib_protocol; make clean)
|
|
|
|
@(cd lib_acl_cpp; make clean)
|
2017-07-23 08:50:48 +08:00
|
|
|
@(cd lib_fiber; make clean)
|
2013-08-18 17:42:25 +08:00
|
|
|
@(cd lib_rpc; make clean)
|
|
|
|
@(cd unit_test; make clean)
|
2014-11-30 21:15:35 +08:00
|
|
|
@(cd lib_acl/samples; make clean)
|
|
|
|
@(cd lib_protocol/samples; make clean)
|
2017-07-23 08:46:50 +08:00
|
|
|
@(cd app; make clean)
|
2017-06-14 17:41:12 +08:00
|
|
|
@(rm -f libacl_all.a libacl.a)
|
|
|
|
@(rm -f libacl_all.so libacl.so)
|
2013-08-18 17:42:25 +08:00
|
|
|
# @(cd lib_dict; make clean)
|
|
|
|
# @(cd lib_tls; make clean)
|
|
|
|
|
2017-06-13 16:20:45 +08:00
|
|
|
acl_master: all_lib
|
2017-10-10 10:19:59 +08:00
|
|
|
@(cd app/master/daemon; make $(MAKE_ARGS); make install)
|
2018-01-24 15:15:18 +08:00
|
|
|
@(cd app/master/tools/lib_global; make $(MAKE_ARGS);)
|
2017-10-10 10:19:59 +08:00
|
|
|
@(cd app/master/tools/master_ctld; make $(MAKE_ARGS); make install)
|
2017-11-07 13:13:46 +08:00
|
|
|
@(cd app/master/tools/master_ctl; make $(MAKE_ARGS); make install)
|
2018-01-03 22:55:20 +08:00
|
|
|
@(cd app/master/tools/master_guard; make $(MAKE_ARGS); make install)
|
2018-01-24 16:49:14 +08:00
|
|
|
@(cd app/master/tools/master_monitor; make $(MAKE_ARGS); make install)
|
2017-06-13 15:24:12 +08:00
|
|
|
|
2017-06-06 19:16:58 +08:00
|
|
|
packinstall:
|
|
|
|
@(echo "")
|
|
|
|
@(echo "begin copy file...")
|
2017-06-22 18:57:00 +08:00
|
|
|
$(shell mkdir -p $(INC_ACL)/acl)
|
|
|
|
$(shell mkdir -p $(INC_ACL)/acl_cpp)
|
2017-08-09 13:22:28 +08:00
|
|
|
$(shell mkdir -p $(INC_ACL)/protocol)
|
2017-10-16 10:30:59 +08:00
|
|
|
$(shell mkdir -p $(BIN_PATH))
|
|
|
|
$(shell mkdir -p $(LIB_ACL))
|
|
|
|
$(shell mkdir -p $(DESTDIR)/opt/soft/acl-master)
|
2017-06-23 09:30:18 +08:00
|
|
|
$(shell mkdir -p ./dist/master/libexec/$(RPATH))
|
2017-08-01 13:55:01 +08:00
|
|
|
$(shell mkdir -p ./dist/master/bin/$(RPATH))
|
2017-07-31 13:51:34 +08:00
|
|
|
@(cd app/master/daemon; make install)
|
|
|
|
@(cd app/master/tools/master_ctld; make install)
|
2017-11-16 11:18:22 +08:00
|
|
|
@(cd app/master/tools/master_ctl; make install)
|
2018-01-03 22:55:20 +08:00
|
|
|
@(cd app/master/tools/master_guard; make install)
|
2018-01-24 16:49:14 +08:00
|
|
|
@(cd app/master/tools/master_monitor; make install)
|
2017-09-01 13:53:17 +08:00
|
|
|
@(cd lib_fiber; make)
|
2017-10-16 10:30:59 +08:00
|
|
|
@echo "copying app/master/daemon/acl_master $(BIN_PATH)"
|
|
|
|
@cp -f app/master/daemon/acl_master $(BIN_PATH)
|
2017-06-23 12:41:09 +08:00
|
|
|
(cd dist/master && ./setup.sh $(DESTDIR) /opt/soft/acl-master)
|
2017-10-16 10:30:59 +08:00
|
|
|
@echo "copying lib_acl/include/* $(INC_ACL)/acl/"
|
|
|
|
@cp -Rf lib_acl/include/* $(INC_ACL)/acl/
|
|
|
|
@echo "copying lib_acl_cpp/include/acl_cpp/* $(INC_ACL)/acl_cpp/"
|
|
|
|
@cp -Rf lib_acl_cpp/include/acl_cpp/* $(INC_ACL)/acl_cpp/
|
|
|
|
@echo "copying lib_protocol/include/* $(INC_ACL)/protocol/"
|
|
|
|
@cp -Rf lib_protocol/include/* $(INC_ACL)/protocol/
|
|
|
|
@echo "copying libacl_all.a $(LIB_ACL)/libacl_all.a";
|
|
|
|
@cp -f libacl_all.a $(LIB_ACL)/libacl_all.a;
|
|
|
|
@if test "$(OSNAME)" = "Linux"; then \
|
|
|
|
$(shell mkdir -p $(INC_ACL)/fiber) \
|
|
|
|
echo "copying lib_fiber/c/include/fiber/* $(INC_ACL)/fiber/"; \
|
|
|
|
cp -f lib_fiber/c/include/fiber/* $(INC_ACL)/fiber/; \
|
|
|
|
echo "copying lib_fiber/cpp/include/fiber/* $(INC_ACL)/fiber/"; \
|
|
|
|
cp -f lib_fiber/cpp/include/fiber/* $(INC_ACL)/fiber/; \
|
|
|
|
echo "copying lib_fiber/lib/libfiber.a $(LIB_ACL)/libfiber.a"; \
|
|
|
|
cp -f lib_fiber/lib/libfiber.a $(LIB_ACL)/libfiber.a; \
|
|
|
|
echo "copying lib_fiber/lib/libfiber_cpp.a $(LIB_ACL)/libfiber_cpp.a"; \
|
|
|
|
cp -f lib_fiber/lib/libfiber_cpp.a $(LIB_ACL)/libfiber_cpp.a; \
|
|
|
|
fi
|
2017-06-22 18:57:00 +08:00
|
|
|
|
2013-08-18 17:42:25 +08:00
|
|
|
install:
|
|
|
|
@(echo "")
|
|
|
|
@(echo "begin copy file...")
|
2017-06-22 18:57:00 +08:00
|
|
|
$(shell mkdir -p $(INC_PATH)/acl)
|
|
|
|
$(shell mkdir -p $(INC_PATH)/protocol)
|
2017-04-28 14:00:14 +08:00
|
|
|
$(shell mkdir -p $(INC_PATH)/acl_cpp)
|
2017-06-22 19:02:04 +08:00
|
|
|
$(shell mkdir -p $(LIB_DIST)/$(RPATH))
|
|
|
|
$(shell mkdir -p ./dist/master/libexec/$(RPATH))
|
2017-06-13 21:59:20 +08:00
|
|
|
cp -f app/master/daemon/acl_master ./dist/master/libexec/$(RPATH)/
|
2017-06-22 18:57:00 +08:00
|
|
|
cp -f libacl_all.a $(LIB_DIST)/$(RPATH)/
|
|
|
|
cp -f lib_acl/lib/libacl.a $(LIB_DIST)/$(RPATH)/
|
|
|
|
cp -f lib_acl_cpp/lib/libacl_cpp.a $(LIB_DIST)/$(RPATH)/
|
|
|
|
cp -f lib_protocol/lib/libprotocol.a $(LIB_DIST)/$(RPATH)/
|
|
|
|
cp -Rf lib_acl/include/* $(INC_PATH)/acl/
|
|
|
|
cp -Rf lib_protocol/include/* $(INC_PATH)/protocol/
|
2013-08-18 17:42:25 +08:00
|
|
|
cp -Rf lib_acl_cpp/include/acl_cpp/* $(INC_PATH)/acl_cpp/
|
2017-06-22 18:57:00 +08:00
|
|
|
|
2013-08-18 17:42:25 +08:00
|
|
|
uninstall:
|
|
|
|
@(echo "")
|
|
|
|
@(echo "begin remove file...")
|
|
|
|
rm -f ./dist/master/libexec/$(RPATH)/*
|
2017-06-22 18:57:00 +08:00
|
|
|
rm -f $(LIB_DIST)/$(RPATH)/libacl_all.a
|
|
|
|
rm -f $(LIB_DIST)/$(RPATH)/libacl.a
|
|
|
|
rm -f $(LIB_DIST)/$(RPATH)/libprotocol.a
|
|
|
|
rm -f $(LIB_DIST)/$(RPATH)/libacl_cpp.a
|
|
|
|
rm -f $(LIB_DIST)/$(RPATH)/lib_dict.a
|
|
|
|
rm -f $(LIB_DIST)/$(RPATH)/lib_tls.a
|
|
|
|
rm -Rf $(INC_PATH)/protocol/*
|
2013-08-18 17:42:25 +08:00
|
|
|
rm -Rf $(INC_PATH)/acl_cpp/*
|
2017-06-22 18:57:00 +08:00
|
|
|
rm -Rf $(INC_PATH)/acl/*
|
|
|
|
rm -Rf $(INC_PATH)/dict/*
|
|
|
|
rm -Rf $(INC_PATH)/tls/*
|
|
|
|
|
2013-08-18 17:42:25 +08:00
|
|
|
uninstall_all:
|
|
|
|
@(echo "")
|
|
|
|
@(echo "begin remove all dist files ...")
|
2017-06-22 18:57:00 +08:00
|
|
|
rm -Rf $(INC_PATH)/acl/*
|
|
|
|
rm -Rf $(INC_PATH)/protocol/*
|
|
|
|
rm -Rf $(INC_PATH)/acl_cpp/*
|
|
|
|
rm -Rf $(INC_PATH)/dist/*
|
|
|
|
rm -Rf $(INC_PATH)/tls/*
|
2013-08-18 17:42:25 +08:00
|
|
|
rm -f ./dist/master/libexec/linux32/*
|
|
|
|
rm -f ./dist/master/libexec/linux64/*
|
|
|
|
rm -f ./dist/master/libexec/sunos_x86/*
|
|
|
|
rm -f ./dist/master/libexec/freebsd/*
|
2017-06-22 18:57:00 +08:00
|
|
|
rm -f $(LIB_DIST)/linux32/*.a
|
|
|
|
rm -f $(LIB_DIST)/linux64/*.a
|
|
|
|
rm -f $(LIB_DIST)/sunos_x86/*.a
|
|
|
|
rm -f $(LIB_DIST)/freebsd/*.a
|
|
|
|
rm -f $(LIB_DIST)/win32/*.lib
|
|
|
|
rm -f $(LIB_DIST)/win32/*.dll
|
2013-08-18 17:42:25 +08:00
|
|
|
rm -f win32_build/vc/lib_acl/*.map
|
|
|
|
rm -f win32_build/vc/lib_acl/*.ilk
|
|
|
|
rm -f win32_build/vc/lib_protocol/*.map
|
|
|
|
rm -f win32_build/vc/lib_protocol/*.ilk
|
2017-06-22 18:57:00 +08:00
|
|
|
|
2015-11-09 22:11:21 +08:00
|
|
|
RELEASE_PATH = release
|
2019-05-18 22:03:53 +08:00
|
|
|
build_one: all_lib
|
2015-11-09 22:11:21 +08:00
|
|
|
@(mkdir -p $(RELEASE_PATH); mkdir -p $(RELEASE_PATH)/acl; \
|
|
|
|
mkdir -p $(RELEASE_PATH)/protocol; \
|
|
|
|
mkdir -p $(RELEASE_PATH)/acl_cpp)
|
2017-03-25 23:05:44 +08:00
|
|
|
@(cp lib_acl/lib/libacl.a $(RELEASE_PATH)/acl/)
|
2017-04-28 13:50:38 +08:00
|
|
|
@(cp lib_protocol/lib/libprotocol.a $(RELEASE_PATH)/protocol/)
|
2017-03-25 23:05:44 +08:00
|
|
|
@(cp lib_acl_cpp/lib/libacl_cpp.a $(RELEASE_PATH)/acl_cpp/)
|
|
|
|
@(cd $(RELEASE_PATH)/acl; ar -x libacl.a)
|
2017-04-28 13:50:38 +08:00
|
|
|
@(cd $(RELEASE_PATH)/protocol; ar -x libprotocol.a)
|
2017-03-25 23:05:44 +08:00
|
|
|
@(cd $(RELEASE_PATH)/acl_cpp; ar -x libacl_cpp.a)
|
2017-06-06 17:41:53 +08:00
|
|
|
$(AR) $(ARFL) ./libacl_all.a $(RELEASE_PATH)/acl/*.o \
|
2015-11-09 22:11:21 +08:00
|
|
|
$(RELEASE_PATH)/protocol/*.o $(RELEASE_PATH)/acl_cpp/*.o
|
2017-06-06 17:41:53 +08:00
|
|
|
$(RANLIB) ./libacl_all.a
|
2017-06-06 17:34:52 +08:00
|
|
|
rm -f libacl.a
|
2017-06-06 17:41:53 +08:00
|
|
|
ln -s libacl_all.a libacl.a
|
|
|
|
$(CC) $(LDFLAGS) -o ./libacl_all.so $(RELEASE_PATH)/acl_cpp/*.o \
|
2015-11-09 22:11:21 +08:00
|
|
|
$(RELEASE_PATH)/protocol/*.o $(RELEASE_PATH)/acl/*.o \
|
|
|
|
$(SYSLIB)
|
2017-06-06 17:34:52 +08:00
|
|
|
rm -f libacl.so
|
2017-06-06 17:41:53 +08:00
|
|
|
ln -s libacl_all.so libacl.so
|
2015-11-09 22:11:21 +08:00
|
|
|
@(rm -rf $(RELEASE_PATH))
|
|
|
|
@echo ""
|
2017-06-06 19:16:58 +08:00
|
|
|
@echo "Over, libacl_all.a and libacl_all.so were built ok!"
|
2015-11-09 22:11:21 +08:00
|
|
|
@echo ""
|
|
|
|
|
2013-08-18 17:42:25 +08:00
|
|
|
check:
|
2015-11-09 22:11:21 +08:00
|
|
|
@(echo "TYPE: $(OSTYPE)")
|
|
|
|
@(echo "OSNAME: $(OSNAME)")
|
|
|
|
@(echo "RPATH: $(RPATH)")
|