acl/lib_fiber/samples/Makefile.in

194 lines
4.2 KiB
Makefile
Raw Normal View History

2016-05-30 14:09:38 +08:00
CC = $(ENV_CC)
2022-10-30 17:48:23 +08:00
CFLAGS = -c -g -W -O3 \
2016-05-30 14:09:38 +08:00
-Wall \
-Wcast-qual \
-Wcast-align \
-Waggregate-return \
-Wno-long-long \
-Wmissing-prototypes \
-Wpointer-arith \
-Wshadow \
-D_REENTRANT \
-D_POSIX_PTHREAD_SEMANTICS \
-D_USE_FAST_MACRO
#CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align \
#-Waggregate-return -Wmissing-prototypes \
#-Wpointer-arith -Werror -Wshadow -O2 \
#-D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO
###########################################################
#Check system:
# Linux, SunOS, Solaris, BSD variants, AIX, HP-UX
2017-09-22 12:27:21 +08:00
SYSLIB = -lpthread
2016-05-30 14:09:38 +08:00
CHECKSYSRES = @echo "Unknow system type!";exit 1
UNIXNAME = $(shell uname -sm)
ifeq ($(CC),)
CC = gcc
endif
2022-01-28 12:28:21 +08:00
OS_ENV=$(shell uname -a)
ifeq ($(findstring WSL, $(OS_ENV)), WSL)
SYSLIB += -liconv
endif
ifeq ($(findstring ubuntu, $(OS_ENV)), ubuntu)
SYSLIB += -liconv
endif
2022-01-28 03:37:10 +08:00
ifeq ($(findstring Alpine, $(shell uname -a)), Alpine)
SYSLIB += -lucontext
endif
2016-05-30 14:09:38 +08:00
ifeq ($(findstring gcc, $(CC)), gcc)
CFLAGS += -Wstrict-prototypes
endif
ifeq ($(findstring clang, $(CC)), clang)
CFLAGS += -Wstrict-prototypes \
-Wno-invalid-source-encoding \
-Wno-invalid-offsetof
2016-05-30 14:09:38 +08:00
endif
ifeq ($(findstring clang++, $(CC)), clang++)
CFLAGS += -Wno-invalid-source-encoding \
-Wno-invalid-offsetof
2016-05-30 14:09:38 +08:00
endif
2024-03-16 16:08:06 +08:00
ifeq ($(findstring cosmocc, $(CC)), cosmocc)
CFLAGS += -DCOSMOCC
CFLAGS += -Wno-implicit-fallthrough
CFLAGS += -DLINUX2
endif
2016-05-30 14:09:38 +08:00
# For FreeBSD
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
CFLAGS += -DFREEBSD
SYSLIB += -lcrypt -rdynamic
endif
# For Darwin
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
# CC += -arch x86_64 -arch arm64
2016-05-30 14:09:38 +08:00
CFLAGS += -DMACOSX -Wno-invalid-source-encoding \
-Wno-invalid-offsetof
2016-05-30 14:09:38 +08:00
SYSLIB += -rdynamic
UNIXTYPE = MACOSX
endif
#Path for Linux
ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
2017-02-12 21:39:38 +08:00
# CFLAGS += -DLINUX2
SYSLIB += -lcrypt -rdynamic -ldl -lrt
ifeq ($(HAS_IO_URING), yes)
2023-07-09 21:30:25 +08:00
SYSLIB += -luring-ffi
endif
2022-10-24 15:33:06 +08:00
ifeq ($(has_io_uring), yes)
2023-07-09 21:30:25 +08:00
SYSLIB += -luring-ffi
2022-10-24 15:33:06 +08:00
endif
2023-07-18 15:42:37 +08:00
ifeq ($(DEBUG_STACK), yes)
SYSLIB += -lunwind -lunwind-generic
endif
ifeq ($(debug_stack), yes)
SYSLIB += -lunwind -lunwind-generic
endif
2016-05-30 14:09:38 +08:00
endif
2022-08-06 20:03:51 +08:00
# For CYGWIN
ifeq ($(findstring CYGWIN, $(UNIXNAME)), CYGWIN)
SYSLIB = -lpthread -rdynamic
CFLAGS += -DLINUX2 -DMINGW
UNIXTYPE = LINUX
endif
2016-05-30 14:09:38 +08:00
# For MINGW
ifeq ($(findstring MINGW, $(UNIXNAME)), MINGW)
2022-08-06 20:03:51 +08:00
SYSLIB = -lpthread -rdynamic
CFLAGS += -DLINUX2 -DMINGW
UNIXTYPE = LINUX
endif
# For MSYS
ifeq ($(findstring MSYS, $(UNIXNAME)), MSYS)
SYSLIB = -lpthread -rdynamic
2016-05-30 14:09:38 +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
CFLAGS += -DSUNOS5
SYSLIB += -lcrypt -rdynamic
endif
#Path for HP-UX
ifeq ($(findstring HP-UX, $(UNIXNAME)), HP-UX)
PLAT_NAME=hp-ux
CFLAGS += -DHP_UX -DHPUX11
SYSLIB += -lcrypt -rdynamic
endif
#Find system type.
ifneq ($(SYSPATH),)
CHECKSYSRES = @echo "System is $(shell uname -sm)"
endif
###########################################################
ACL_PATH = ../../../lib_acl
ACL_INC = $(ACL_PATH)/include
ACL_LIB = $(ACL_PATH)/lib
PRO_PATH = ../../../lib_protocol
PRO_INC = $(PRO_PATH)/include
PRO_LIB = $(PRO_PATH)/lib
2016-05-30 14:09:38 +08:00
FIBER_PATH = ../../../lib_fiber
2016-06-24 10:39:05 +08:00
FIBER_INC = $(FIBER_PATH)/c/include
2016-05-30 14:09:38 +08:00
FIBER_LIB = $(FIBER_PATH)/lib
EXTLIBS =
CFLAGS += -I.. -I$(PRO_INC) -I$(ACL_INC) -I$(FIBER_INC)
2017-12-20 23:01:58 +08:00
LDFLAGS = -L$(PRO_LIB) -lprotocol -L$(ACL_LIB) -lacl -L$(FIBER_LIB) -lfiber $(EXTLIBS) $(SYSLIB)
2016-05-30 14:09:38 +08:00
###########################################################
OUT_PATH = .
OBJ_PATH = $(OUT_PATH)
#Project's objs
SRC = $(wildcard *.c) $(wildcard ../*.c)
2016-05-30 14:09:38 +08:00
OBJ = $(patsubst %.c, $(OBJ_PATH)/%.o, $(notdir $(SRC)))
###########################################################
.PHONY = all clean
PROG =
COMPILE = $(CC) $(CFLAGS)
#-Wl,-rpath,$(ACL_LIB) -Wl,-rpath,$(PROTO_LIB) -o $(OBJ_PATH)/$(PROG)
all: RM $(OBJ)
$(CC) $(OBJ) $(LDFLAGS) -o $(OBJ_PATH)/$(PROG)
@echo ""
@echo "All ok! Output:$(PROG)"
@echo ""
$(OBJ_PATH)/%.o: %.c
$(COMPILE) $< -o $@
$(OBJ_PATH)/%.o: ../%.c
$(COMPILE) $< -o $@
2016-05-30 14:09:38 +08:00
RM:
rm -f $(PROG)
clean cl:
2016-05-30 14:09:38 +08:00
rm -f $(PROG)
rm -f $(OBJ)
rebuild rb: clean all
2016-05-30 14:09:38 +08:00
###########################################################