2 Star 2 Fork 2

jianxi sun/media-server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
gcc.mk 2.49 KB
一键复制 编辑 原始数据 按行查看 历史
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)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wirelesser/media-server.git
[email protected]:wirelesser/media-server.git
wirelesser
media-server
media-server
master

搜索帮助