acl/app/jaws/Makefile.elib
zsxxsz cc05b877a2 first commit acl to github
first commit acl to github
2013-08-18 17:42:25 +08:00

137 lines
3.1 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 \
-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO \
-Wno-long-long -DHAS_ELIG -DUSE_LIBCORE_LOG \
-Wpointer-arith -Werror -Wshadow -O2
#-Wpointer-arith -Werror -Wshadow -pedantic -O2
###########################################################
#Check system:
# Linux, SunOS, Solaris, BSD variants, AIX, HP-UX
SYSLIB =
RPATH =
CHECKSYSRES = @echo "Unknow system type!";exit 1
UNIXNAME = $(shell uname -sm)
OSTYPE = $(shell uname -p)
#Path for Linux
ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
# ifeq ($CC, "gcc")
ifeq ($(findstring i686, $(OSTYPE)), i686)
RPATH = linux32
endif
ifeq ($(findstring x86_64, $(OSTYPE)), x86_64)
RPATH = linux64
endif
ifeq ($(findstring gcc, $(CC)), gcc)
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DLINUX2
SYSLIB = -lcrypt -lpthread
endif
#Path for SunOS
ifeq ($(findstring SunOS, $(UNIXNAME)), SunOS)
ifeq ($(findstring i386, $(OSTYPE)), i386)
RPATH = sunos_x86
endif
ifeq ($(findstring 86, $(UNIXNAME)), 86)
SYSLIB = -lsocket -lnsl -lrt
endif
ifeq ($(findstring sun4u, $(UNIXNAME)), sun4u)
SYSLIB = -lsocket -lnsl -lrt
endif
# ifeq ($CC, "gcc")
ifeq ($(findstring gcc, $(CC)), gcc)
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DSUNOS5
endif
#Path for HP-UX
ifeq ($(findstring HP-UX, $(UNIXNAME)), HP-UX)
# ifeq ($CC, "gcc")
ifeq ($(findstring gcc, $(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
###########################################################
ELIG_PATH = /opt/import_lib/elib/$(RPATH)
GLIB_PATH = /opt/import_lib/glib/$(RPATH)
ACL_PATH = ../lib_all/lib_acl
ACL_LIB = $(ACL_PATH)/lib/$(RPATH)
ACL_INC = $(ACL_PATH)/include
PROTO_PATH = ../lib_all/lib_protocol
PROTO_LIB = $(PROTO_PATH)/lib/$(RPATH)
PROTO_INC = $(PROTO_PATH)/include
LD_RUN_PATH=-Wl,-rpath,$(ELIG_PATH)/lib,-rpath,$(GLIB_PATH)/lib
ALL_LIBS = -L$(PROTO_LIB) -l_http -L$(ACL_LIB) -l_acl \
-L$(ELIG_PATH)/lib -l_elib \
-L$(GLIB_PATH)/lib -lglib-2.0 \
$(SYSLIB)
INCLUDE = -I./http -I./global -I./util \
-I$(PROTO_INC) \
-I$(ACL_INC) \
-I$(ELIG_PATH)/include \
-I$(GLIB_PATH)/include/glib-2.0 -I$(GLIB_PATH)/lib/glib-2.0/include
CFLAGS += $(INCLUDE)
OBJ_OUTPATH = ./debug
#Project's objs
SOURCES = $(wildcard util/*.c) \
$(wildcard http/*.c) \
$(wildcard global/*.c) \
$(wildcard master_main/*.c)
OBJS = $(patsubst %.c, $(OBJ_OUTPATH)/%.o, $(notdir $(SOURCES)))
###########################################################
PROG_NAME = jaws
.PHONY = clean
COMPILE = $(CC) $(CFLAGS)
all: RM $(PROG_NAME)
RM:
rm -f $(PROG_NAME)
$(PROG_NAME): $(OBJS)
$(CC) -o $(PROG_NAME) $(OBJS) $(LD_RUN_PATH) $(ALL_LIBS)
$(OBJ_OUTPATH)/%.o: util/%.c
$(COMPILE) -o $@ $<
$(OBJ_OUTPATH)/%.o: global/%.c
$(COMPILE) -o $@ $<
$(OBJ_OUTPATH)/%.o: http/%.c
$(COMPILE) -o $@ $<
$(OBJ_OUTPATH)/%.o: master_main/%.c
$(COMPILE) -o $@ $<
clean:
rm -f $(OBJS) $(PROG_NAME)
rebuild: clean all