acl/lib_acl/samples/dict/Makefile.tools
zsxxsz cf2528eb7c 完善了非阻塞IO的SSL功能;将 samples 移到 lib_acl 目录下
完善了非阻塞IO的SSL功能;将 acl/samples/ 下的示例分别移到 lib_acl 及 lib_protocol 目录下
2014-11-30 21:15:35 +08:00

135 lines
3.0 KiB
Makefile

SHELL = /bin/sh
CC = gcc
#CC = g++
AR = ar
ARFL = rv
RANLIB = ranlib
CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align \
-Waggregate-return -Wmissing-prototypes \
-Wpointer-arith -Werror -Wshadow -O2 \
-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO \
-Wno-long-long
#-Wno-long-long -DHAS_DB -D_FILE_OFFSET_BITS -D_LARGEFILE64_SOURCE
#-Wno-long-long -DHAS_DB -D__USE_FILE_OFFSET64 -D__USE_LARGEFILE64
#-Wno-long-long -DHAS_DB -D_FILE_OFFSET_BITS
###########################################################
#Check system:
# Linux, SunOS, Solaris, BSD variants, AIX, HP-UX
SYSLIB =
CHECKSYSRES = @echo "Unknow system type!";exit 1
UNIXNAME = $(shell uname -sm)
OSTYPE = $(shell uname -p)
RPATH =
# For FreeBSD
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
ifeq ($(findstring gcc, $(CC)), gcc)
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DFREEBSD -D_REENTRANT -pedantic
SYSLIB = -lpthread
endif
#Path for Linux
ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
ifeq ($CC, "gcc")
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DLINUX2
SYSLIB = -lcrypt -lpthread
ifeq ($(findstring i686, $(OSTYPE)), i686)
RPATH = linux32
endif
ifeq ($(findstring x86_64, $(OSTYPE)), x86_64)
RPATH = linux64
endif
endif
#Path for SunOS
ifeq ($(findstring SunOS, $(UNIXNAME)), SunOS)
ifeq ($(findstring 86, $(UNIXNAME)), 86)
SYSLIB = -lsocket -lnsl -lrt
endif
ifeq ($(findstring sun4u, $(UNIXNAME)), sun4u)
SYSLIB = -lsocket -lnsl -lrt
endif
ifeq ($CC, "gcc")
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DSUNOS5
endif
#Path for HP-UX
ifeq ($(findstring HP-UX, $(UNIXNAME)), HP-UX)
ifeq ($CC, "gcc")
CFLAGS += -Wstrict-prototypes
endif
SYSLIB = -lpthread
CFLAGS += -DHP_UX -DHPUX11
PLAT_NAME=hp-ux
endif
#Find system type.
ifneq ($(SYSPATH),)
CHECKSYSRES = @echo "System is $(shell uname -sm)"
endif
###########################################################
ACL_PATH = ../../lib_acl
ACL_LIB = $(ACL_PATH)/lib
ACL_INC = $(ACL_PATH)/include
DICT_PATH = ../../lib_dict
DICT_LIB = $(DICT_PATH)/lib
DICT_INC = $(DICT_PATH)/include
CDB_PATH = ../../lib_dict/cdb
CDB_LIB = $(CDB_PATH)/lib
CDB_INC = $(CDB_PATH)/include
TC_PATH = ../../lib_dict/tc
TC_LIB = $(TC_PATH)/lib
TC_INC = $(TC_PATH)/include
ALL_LIBS = -L$(DICT_LIB) -l_dict \
-L$(ACL_LIB) -l_acl \
-ldb \
-L$(TC_LIB) -ltokyocabinet \
$(CDB_LIB)/cdb.a $(CDB_LIB)/buffer.a $(CDB_LIB)/byte.a $(CDB_LIB)/unix.a $(CDB_LIB)/alloc.a \
$(SYSLIB) -lbz2 -lz -lrt -lm -lc
INCLUDE = -I$(DICT_INC) -I$(ACL_INC)
CFLAGS += $(INCLUDE)
OUTPATH = .
OBJ_PATH = $(OUTPATH)/tools
#Project's objs
SOURCES = $(wildcard tools/*.c)
OBJS = $(patsubst %.c, $(OBJ_PATH)/%.o, $(notdir $(SOURCES)))
###########################################################
PROG_NAME = dict_tools
.PHONY = all clean RM
COMPILE = $(CC) $(CFLAGS)
all: RM $(PROG_NAME)
$(PROG_NAME): $(OBJS)
$(CC) -o $(PROG_NAME) $(OBJS) $(ALL_LIBS)
$(OBJ_PATH)/%.o: tools/%.c
$(COMPILE) $< -o $@
RM:
@(rm -f $(PROG_NAME))
clean:
rm -f $(OBJS) $(PROG_NAME)
rebuild: clean all