代码拉取完成,页面将自动刷新
RELEASE ?= 0 # default debug
UNICODE ?= 0 # default ansi
ifdef PLATFORM
CROSS:=$(PLATFORM)-
else
CROSS:=
PLATFORM:=linux
endif
ifeq ($(RELEASE),1)
BUILD:=release
else
BUILD:=debug
endif
KERNEL := $(shell uname -s)
ifeq ($(KERNEL),Linux)
DEFINES += OS_LINUX
endif
ifeq ($(KERNEL),Darwin)
DEFINES += OS_MAC
endif
#--------------------------------Compile-----------------------------
#
#--------------------------------------------------------------------
AR := $(CROSS)ar
CC := $(CROSS)gcc
CXX := $(CROSS)g++
CFLAGS += -Wall -fPIC
CXXFLAGS += -Wall
DEPFLAGS = -MMD -MP -MF $(OUTPATH)/$(*F).d
ifeq ($(RELEASE),1)
CFLAGS += -Wall -O2
CXXFLAGS += $(CFLAGS)
DEFINES += NDEBUG
else
CFLAGS += -g -Wall
# CFLAGS += -fsanitize=address
CXXFLAGS += $(CFLAGS)
DEFINES += DEBUG _DEBUG
endif
# default don't export anything
CFLAGS += -fvisibility=hidden
COMPILE.CC = $(CC) $(addprefix -I,$(INCLUDES)) $(addprefix -D,$(DEFINES)) $(CFLAGS)
COMPILE.CXX = $(CXX) $(addprefix -I,$(INCLUDES)) $(addprefix -D,$(DEFINES)) $(CXXFLAGS)
#-------------------------Link---------------------------
#
#--------------------------------------------------------------------
ifeq ($(STATIC_LINK),1)
LDFLAGS += -static
endif
#-------------------------Compile Output---------------------------
#
#--------------------------------------------------------------------
ifeq ($(UNICODE),1)
OUTPATH += unicode.$(BUILD).$(PLATFORM)
else
OUTPATH += $(BUILD).$(PLATFORM)
endif
# make output dir
$(shell mkdir -p $(OUTPATH) > /dev/null)
OBJECT_FILES := $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCE_FILES)))
DEPENDENCE_FILES := $(OBJECT_FILES:%.o=%.d)
DEPENDENCE_FILES := $(foreach file,$(DEPENDENCE_FILES),$(OUTPATH)/$(notdir $(file)))
#--------------------------Makefile Rules----------------------------
#
#--------------------------------------------------------------------
$(OUTPATH)/$(OUTFILE): $(OBJECT_FILES) $(STATIC_LIBS)
ifeq ($(OUTTYPE),0)
$(CXX) -o $@ -Wl,-rpath . $(LDFLAGS) $^ $(addprefix -L,$(LIBPATHS)) $(addprefix -l,$(LIBS))
else
ifeq ($(OUTTYPE),1)
$(CXX) -o $@ -shared -fpic -rdynamic -Wl,-rpath . $(LDFLAGS) $^ $(addprefix -L,$(LIBPATHS)) $(addprefix -l,$(LIBS))
else
$(AR) -rc $@ $^
endif
endif
@echo make ok, output: $(OUTPATH)/$(OUTFILE)
%.o : %.c
$(COMPILE.CC) -c $(DEPFLAGS) -o $@ $<
%.o : %.cpp
$(COMPILE.CXX) -c $(DEPFLAGS) -o $@ $<
-include $(DEPENDENCE_FILES)
version.h : version.ver
$(ROOT)/svnver.sh version.ver version.h
.PHONY: clean
clean:
rm -f $(OBJECT_FILES) $(OUTPATH)/$(OUTFILE) $(DEPENDENCE_FILES)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。