forked from fangxin1003/acl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.debug
103 lines (90 loc) · 2.83 KB
/
Makefile.debug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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
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)")