acl/app/master/tools/master_ctl/Makefile.in

167 lines
4.1 KiB
Makefile
Raw Normal View History

CC = g++
HAS_READLINE =
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
CHECKSYSRES = @echo "Unknow system type!";exit 1
2017-08-01 13:41:36 +08:00
OSNAME = $(shell uname -s)
OSTYPE = $(shell uname -m)
ifeq ($(CC),)
CC = gcc
endif
ifeq ($(findstring on, $(HAS_READLINE)), on)
CFLAGS += -DHAS_READLINE
SYSLIB += -lreadline -lcurses
else ifeq ($(findstring ON, $(HAS_READLINE)), ON)
CFLAGS += -DHAS_READLINE
SYSLIB += -lreadline -lcurses
else ifeq ($(findstring yes, $(HAS_READLINE)), yes)
CFLAGS += -DHAS_READLINE
SYSLIB += -lreadline -lcurses
else ifeq ($(findstring YES, $(HAS_READLINE)), YES)
CFLAGS += -DHAS_READLINE
SYSLIB += -lreadline -lcurses
else ifeq ($(findstring on, $(has_readline)), on)
CFLAGS += -DHAS_READLINE
SYSLIB += -lreadline -lcurses
else ifeq ($(findstring ON, $(has_readline)), ON)
CFLAGS += -DHAS_READLINE
SYSLIB += -lreadline -lcurses
else ifeq ($(findstring yes, $(has_readline)), yes)
CFLAGS += -DHAS_READLINE
SYSLIB += -lreadline -lcurses
else ifeq ($(findstring YES, $(has_readline)), YES)
CFLAGS += -DHAS_READLINE
SYSLIB += -lreadline -lcurses
endif
# For FreeBSD
2017-08-01 13:41:36 +08:00
ifeq ($(findstring FreeBSD, $(OSNAME)), FreeBSD)
ifeq ($(findstring gcc, $(CC)), gcc)
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DFREEBSD -D_REENTRANT
2015-12-13 10:15:00 +08:00
SYSLIB = -lcrypt -lpthread -L/usr/local/lib -liconv -lz
endif
# For Darwin
2017-08-01 13:41:36 +08:00
ifeq ($(findstring Darwin, $(OSNAME)), Darwin)
CFLAGS += -DMACOSX -Wno-invalid-source-encoding \
-Wno-extended-offsetof
UNIXTYPE = MACOSX
SYSLIB += -liconv -rdynamic
endif
#Path for Linux
2017-08-01 13:41:36 +08:00
ifeq ($(findstring Linux, $(OSNAME)), Linux)
ifeq ($(findstring i686, $(OSTYPE)), i686)
RPATH = linux32
endif
ifeq ($(findstring x86_64, $(OSTYPE)), x86_64)
RPATH = linux64
endif
ifeq ($CC, "gcc")
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DLINUX2 -D_REENTRANT
2015-12-13 10:15:00 +08:00
SYSLIB += -lcrypt -ldl -lz
endif
# For MINGW
2017-08-01 13:41:36 +08:00
ifeq ($(findstring MINGW, $(OSNAME)), MINGW)
SYSLIB = -lpthread-2 -liconv -lz
CFLAGS += -DLINUX2 -DMINGW
UNIXTYPE = LINUX
endif
# For MSYS
2017-08-01 13:41:36 +08:00
ifeq ($(findstring MSYS, $(OSNAME)), MSYS)
SYSLIB = -lpthread-2 -liconv -lz
CFLAGS += -DLINUX2 -DMINGW
UNIXTYPE = LINUX
endif
#Path for SunOS
2017-08-01 13:41:36 +08:00
ifeq ($(findstring SunOS, $(OSNAME)), SunOS)
ifeq ($(findstring 86, $(OSTYPE), 86)
SYSLIB += -lsocket -lnsl -lrt
endif
2017-08-01 13:41:36 +08:00
ifeq ($(findstring sun4u, $(OSTYPE), sun4u)
SYSLIB += -lsocket -lnsl -lrt
endif
ifeq ($CC, "gcc")
CFLAGS += -Wstrict-prototypes
endif
CFLAGS += -DSUNOS5 -D_REENTRANT
endif
#Path for HP-UX
2017-08-01 13:41:36 +08:00
ifeq ($(findstring HP-UX, $(OSNAME)), 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
###########################################################
ACL_PATH = ../../../..
JSON_PATH = ../../daemon/json
CFLAGS += -I. \
-I$(JSON_PATH) \
-I$(ACL_PATH)/lib_acl/include \
-I$(ACL_PATH)/lib_acl_cpp/include \
-I$(ACL_PATH)/lib_protocol/include
LDFLAGS = -L$(ACL_PATH)/lib_acl_cpp/lib -lacl_cpp \
-L$(ACL_PATH)/lib_protocol/lib -lprotocol \
-L$(ACL_PATH)/lib_acl/lib -lacl $(SYSLIB)
COMPILE = $(CC) $(CFLAGS)
LINK = $(CC) $(OBJ) $(LDFLAGS)
###########################################################
OBJ_PATH = ./debug
$(shell mkdir -p $(OBJ_PATH))
#Project's objs
SRC = $(wildcard *.cpp) $(wildcard $(JSON_PATH)/*.cpp)
OBJ = $(patsubst %.cpp, $(OBJ_PATH)/%.o, $(notdir $(SRC)))
$(OBJ_PATH)/%.o: %.cpp
$(COMPILE) $< -o $@
$(OBJ_PATH)/%.o: $(JSON_PATH)/%.cpp
$(COMPILE) $< -o $@
.PHONY = all clean
all: RM $(OBJ)
$(LINK) -o $(PROG)
@echo ""
@echo "All ok! Output:$(PROG)"
@echo ""
RM:
rm -f $(PROG)
clean cl:
rm -f $(PROG)
rm -f $(OBJ)
rebuild rb: clean all
2017-08-01 13:41:36 +08:00
install:
@mkdir -p ../../../../dist/master/bin/$(RPATH)
cp $(PROG) ../../../../dist/master/bin/$(RPATH)/
###########################################################