acl/Makefile.debug

104 lines
2.8 KiB
Makefile
Raw Normal View History

SHELL = /bin/sh
CC = g++
AR = ar
ARFL = rv
RANLIB = ranlib
#OSNAME = $(shell uname -sm)
#OSTYPE = $(shell uname -p)
OSNAME = $(shell uname -a)
OSTYPE = $(shell uname -a)
LIB_PATH = ./dist/lib
ACL_LIB = $(LIB_PATH)
PROTO_LIB = $(LIB_PATH)
DICT_LIB = $(LIB_PATH)
TLS_LIB = $(LIB_PATH)
INC_PATH = ./dist/include
ACL_INC = $(INC_PATH)/acl
PROTO_INC = $(INC_PATH)/protocol
DICT_INC = $(INC_PATH)/dict
TLS_INC = $(INC_PATH)/tls
RPATH =
DATE_NOW = 20`date +%y`.`date +%m`.`date +%d`
MAKE_ARGS =
SYSLIB = -lpthread -lz
LDFLAGS = -shared
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)
SYSLIB += -lrt -ldl
endif
# For Darwin
ifeq ($(findstring Darwin, $(OSNAME)), Darwin)
RPATH = macos
SYSLIB += -rdynamic -L/usr/lib -liconv
LDFLAGS = -dynamiclib -shared
endif
ifeq ($(findstring FreeBSD, $(OSNAME)), FreeBSD)
RPATH = freebsd
SYSLIB += -L/usr/local/lib -liconv
endif
ifeq ($(findstring SunOS, $(OSNAME)), SunOS)
ifeq ($(findstring i386, $(OSTYPE)), i386)
RPATH = sunos_x86
endif
SYSLIB += -liconv
endif
##############################################################################
.PHONY = check help all_lib all samples all clean install uninstall uninstall_all build_bin build_src build_one
2016-04-12 21:04:47 +08:00
VERSION = 3.1.5
help:
@(echo "usage: make help|all|all_lib|all_samples|clean|install|uninstall|uninstall_all|build_bin|build_src|build_one")
all_lib:
@(cd lib_acl; make $(MAKE_ARGS) -f Makefile.debug)
@(cd lib_protocol; make $(MAKE_ARGS) -f Makefile.debug)
@(cd lib_acl_cpp; make $(MAKE_ARGS) -f Makefile.debug)
clean:
@(cd lib_acl; make clean -f Makefile.debug)
@(cd lib_protocol; make clean -f Makefile.debug)
@(cd lib_acl_cpp; make clean -f Makefile.debug)
@(rm -f lib_acl.a lib_acl.so)
RELEASE_PATH = release
build_one: all_lib
@(mkdir -p $(RELEASE_PATH); mkdir -p $(RELEASE_PATH)/acl; \
mkdir -p $(RELEASE_PATH)/protocol; \
mkdir -p $(RELEASE_PATH)/acl_cpp)
@(cp lib_acl/lib/lib_acl.a $(RELEASE_PATH)/acl/)
@(cp lib_protocol/lib/lib_protocol.a $(RELEASE_PATH)/protocol/)
@(cp lib_acl_cpp/lib/lib_acl_cpp.a $(RELEASE_PATH)/acl_cpp/)
@(cd $(RELEASE_PATH)/acl; ar -x lib_acl.a)
@(cd $(RELEASE_PATH)/protocol; ar -x lib_protocol.a)
@(cd $(RELEASE_PATH)/acl_cpp; ar -x lib_acl_cpp.a)
$(AR) $(ARFL) ./lib_acl.a $(RELEASE_PATH)/acl/*.o \
$(RELEASE_PATH)/protocol/*.o $(RELEASE_PATH)/acl_cpp/*.o
$(RANLIB) ./lib_acl.a
$(CC) $(LDFLAGS) -o ./lib_acl.so $(RELEASE_PATH)/acl_cpp/*.o \
$(RELEASE_PATH)/protocol/*.o $(RELEASE_PATH)/acl/*.o \
$(SYSLIB)
@(rm -rf $(RELEASE_PATH))
@echo ""
@echo "Over, lib_acl.a and lib_acl.so were built ok!"
@echo ""
check:
@(echo "TYPE: $(OSTYPE)")
@(echo "OSNAME: $(OSNAME)")
@(echo "RPATH: $(RPATH)")