acl/app/wizard/tmpl/Makefile_fiber.in

187 lines
4.3 KiB
Plaintext
Raw Normal View History

CC = g++
CFLAGS = -c -g -W \
-Wall \
-Wcast-qual \
-Wcast-align \
-Wno-long-long \
-Wpointer-arith \
-Werror \
-Wshadow \
-O3 \
-D_REENTRANT \
-D_POSIX_PTHREAD_SEMANTICS \
-D_USE_FAST_MACRO
###########################################################
#Check system:
# Linux, SunOS, Solaris, BSD variants, AIX, HP-UX
SYSLIB = -lpthread -lz -ldl
CHECKSYSRES = @echo "Unknow system type!";exit 1
2017-02-21 22:35:31 +08:00
UNIXNAME = $(shell uname -s)
OSTYPE = $(shell uname -m)
RPATH = linux64
OS_ENV=$(shell uname -a)
ifeq ($(findstring WSL, $(OS_ENV)), WSL)
SYSLIB += -liconv
endif
ifeq ($(findstring ubuntu, $(OS_ENV)), ubuntu)
SYSLIB += -liconv
endif
ifeq ($(CC),)
CC = gcc
endif
2022-01-28 03:37:10 +08:00
ifeq ($(findstring Alpine, $(shell uname -a)), Alpine)
SYSLIB += -lucontext
endif
2020-06-30 15:55:52 +08:00
ifeq ($(findstring g++, $(CC)), g++)
GCC_VERSION=$(shell g++ --version | grep ^g++ | sed 's/^.* //g')
GCC_MAJOR:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f1)
GCC_MINOR:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f2)
GCC_SUB:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f3)
GCC_VER:=$(shell [ $(GCC_MAJOR) -gt 4 -o \( $(GCC_MAJOR) -eq 4 -a $(GCC_MINOR) -gt 7 \) ] && echo true)
ifeq ($(GCC_VER), true)
CFLAGS += --std=c++11
endif
endif
# For FreeBSD
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
ifeq ($(findstring gcc, $(CC)), gcc)
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DFREEBSD -D_REENTRANT
SYSLIB = -lcrypt -lpthread -lz
RPATH = freebsd
endif
# For Darwin
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
# CC += -arch x86_64 -arch arm64
CFLAGS += -DMACOSX -Wno-invalid-source-encoding \
-Wno-invalid-offsetof
UNIXTYPE = MACOSX
2022-08-06 23:32:00 +08:00
SYSLIB += -liconv -rdynamic -lz
RPATH = macos
endif
#Path for Linux
ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
ifeq ($CC, "gcc")
CFLAGS += -Wstrict-prototypes
endif
ifeq ($(findstring i686, $(OSTYPE)), i686)
RPATH = linux32
endif
ifeq ($(findstring x86_64, $(OSTYPE)), x86_64)
RPATH = linux64
endif
2022-10-25 18:54:43 +08:00
has_io_uring=$(HAS_IO_URING)
ifeq ($(has_io_uring), yes)
SYSLIB += -luring
endif
CFLAGS += -DLINUX2 -D_REENTRANT
2022-08-06 23:32:00 +08:00
SYSLIB += -lcrypt -lz
endif
# For CYGWIN
ifeq ($(findstring CYGWIN, $(UNIXNAME)), CYGWIN)
SYSLIB = -lpthread -liconv -lz
CFLAGS += -DLINUX2 -DMINGW
UNIXTYPE = LINUX
endif
2017-02-21 22:35:31 +08:00
# For MINGW
ifeq ($(findstring MINGW, $(UNIXNAME)), MINGW)
2022-08-06 23:32:00 +08:00
SYSLIB = -lpthread -liconv -lz
2017-02-21 22:35:31 +08:00
CFLAGS += -DLINUX2 -DMINGW
UNIXTYPE = LINUX
endif
# For MSYS
ifeq ($(findstring MSYS, $(UNIXNAME)), MSYS)
2022-08-06 23:32:00 +08:00
SYSLIB = -lpthread -liconv -lz
2017-02-21 22:35:31 +08:00
CFLAGS += -DLINUX2 -DMINGW
UNIXTYPE = LINUX
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 -D_REENTRANT
RPATH = sunos_x86
endif
#Path for HP-UX
ifeq ($(findstring HP-UX, $(UNIXNAME)), HP-UX)
ifeq ($CC, "gcc")
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DHP_UX -DHPUX11
PLAT_NAME=hp-ux
endif
#Find system type.
ifneq ($(SYSPATH),)
CHECKSYSRES = @echo "System is $(shell uname -sm)"
endif
###########################################################
2016-09-20 19:55:38 +08:00
ACL_PATH = ../../..
CFLAGS += -I$(ACL_PATH)/lib_acl/include \
-I$(ACL_PATH)/lib_protocol/include \
-I$(ACL_PATH)/lib_acl_cpp/include \
-I$(ACL_PATH)/lib_fiber/c/include \
-I$(ACL_PATH)/lib_fiber/cpp/include
EXTLIBS =
LDFLAGS = -L$(ACL_PATH)/lib_fiber/lib -lfiber_cpp \
-L$(ACL_PATH)/lib_acl_cpp/lib -lacl_cpp \
-L$(ACL_PATH)/lib_protocol/lib -lprotocol \
-L$(ACL_PATH)/lib_acl/lib -lacl -lfiber \
$(EXTLIBS) $(SYSLIB)
COMPILE = $(CC) $(CFLAGS)
LINK = $(CC) $(OBJ) $(LDFLAGS)
###########################################################
OBJ_PATH = .
#Project's objs
SRC = $(wildcard *.cpp)
OBJ = $(patsubst %.cpp, $(OBJ_PATH)/%.o, $(notdir $(SRC)))
$(shell mkdir -p ../../../dist/master/libexec/$(RPATH)/)
2022-10-25 18:54:43 +08:00
$(shell mkdir -p ../../../dist/master/conf/service/)
$(OBJ_PATH)/%.o: %.cpp
$(COMPILE) $< -o $@
.PHONY = all clean
all: RM $(OBJ)
$(LINK) -o $(PROG)
@echo ""
@echo "All ok! Output:$(PROG)"
@echo ""
RM:
rm -f $(PROG)
clean:
rm -f $(PROG)
rm -f $(OBJ)
install:
cp $(PROG) ../../../dist/master/libexec/$(RPATH)/
cp $(PROG).cf ../../../dist/master/conf/service/
###########################################################