📄 makefile.defs
字号:
OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ -e s/armv4l/arm/)#set some vars from the environment (and not make builtins)CC = $(shell echo "$${CC}")# find compiler name & versionifeq ($(CC),) CC = gccendifLD= $(CC)CC_LONGVER=$(shell if $(CC) -v 2>/dev/null; then \ $(CC) -v 2>&1 ;\ else \ $(CC) -V 2>&1 ; \ fi)#find-out the compiler's nameifneq (,$(findstring gcc, $(CC_LONGVER))) CC_NAME=gcc CC_VER=$(CC) $(shell $(CC) --version|head -1| \ sed -e 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/' \ -e 's/[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/') CC_SHORTVER=$(shell echo "$(CC_VER)" | cut -d" " -f 2| \ sed -e 's/[^0-9]*-\(.*\)/\1/'| \ sed -e 's/2\.9.*/2.9x/' -e 's/3\..\..*/3.0/' -e \ 's/3\../3.0/')endififneq (, $(findstring Sun, $(CC_LONGVER))) CC_NAME=suncc LDTYPE=solarisendif#not foundifeq (,$(CC_NAME)) CC_NAME=$(CC) $(warning Unknown compiler $(CC)\; supported compilers: gcc, sun cc)endif# compile-time options#DEFS+= -DARCH='"$(ARCH)"' -DOS='"$(OS)"' -D__CPU_$(ARCH) -D__OS_$(OS)ifeq ($(mode),) mode = releaseendif# platform dependent settings# find ld & as name (gnu or solaris)ifeq ($(CC_NAME), gcc) LDGCC=$(shell $(CC) -v 2>&1 | grep with-ld| \ sed -e 's/.*--with-ld=\([^ ][^ ]*\).*/\1/' ) ASGCC=$(shell $(CC) -v 2>&1 | grep with-as| \ sed -e 's/.*--with-as=\([^ ][^ ]*\).*/\1/' ) LDPATH=$(shell if [ -z "$(LDGCC)" ] ; then \ echo "ld" ;\ else \ if $(LDGCC) -V 2>/dev/null 1>/dev/null; then \ echo $(LDGCC); \ else echo "ld" ; \ fi\ fi) ASPATH=$(shell if [ -z "$(ASGCC)" ] ; then \ echo "as" ;\ else \ if $(ASGCC) -V 2>/dev/null 1>/dev/null; then \ echo $(ASGCC); \ else echo "as" ; \ fi\ fi) LDTYPE=$(shell if $(LDPATH) -V 1>/dev/null 2>/dev/null; then \ if $(LDPATH) -V 2>&1|grep GNU >/dev/null; \ then echo gnu; \ else \ if $(LDPATH) -V 2>&1|grep Solaris \ >/dev/null;\ then echo solaris; \ else \ echo unknown ; \ fi \ fi \ fi) ASTYPE=$(shell if $(ASPATH) -V 1>/dev/null 2>/dev/null </dev/null; \ then \ if $(ASPATH) -V 2>&1 </dev/null |grep GNU >/dev/null; \ then \ echo gnu; \ else \ if $(ASPATH) -V 2>&1 </dev/null |grep \ Sun >/dev/null;\ then echo solaris; \ else \ echo unknown ; \ fi \ fi \ fi)endif # gccCFLAGS=LDFLAGS=# setting CFLAGSifeq ($(mode), release)ifeq ($(ARCH), i386)ifeq ($(CC_NAME), gcc) #common stuff CFLAGS=-g -O9 -funroll-loops -Wcast-align -Wall \ #if gcc 3.0 ifeq ($(CC_SHORTVER), 3.0) CPU ?= athlon CFLAGS+=-minline-all-stringops -malign-double -falign-loops \ -mcpu=$(CPU) \ else ifeq ($(CC_SHORTVER), 2.9x) $(warning Old gcc detected ($(CC_SHORTVER)), use \ gcc >= 3.1 for better results) CFLAGS+=-m486 -malign-loops=4 else $(warning You are using an old and unsupported gcc \ version ($(CC_SHORTVER)), compile at your \ own risk!) endif # CC_SHORTVER, 2.9x endif # CC_SHORTVER, 3.0endif #CC_NAME, gccendif #ARCH, i386#if sparcifeq ($(ARCH), sparc64)ifeq ($(CC_NAME), gcc) CFLAGS=-g -O9 -funroll-loops -Wall ifeq ($(CC_SHORTVER), 3.0) CPU ?= ultrasparc #use 32bit for now CFLAGS+= -mcpu=ultrasparc -mtune=$(CPU) else ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5]) $(warning Old gcc detected ($(CC_SHORTVER)), use \ gcc >= 3.1 for better results) CFLAGS+= -mv8 ifeq ($(ASTYPE), solaris) CFLAGS+= -Wa,-xarch=v8plus endif else #CC_SHORTVER, 2.9x #really old version $(warning You are using an old and unsupported gcc \ version ($(CC_SHORTVER)), compile at your \ own risk!) CFLAGS+= -mv8 ifeq ($(ASTYPE), solaris) CFLAGS+= -Wa,-xarch=v8plus endif endif #CC_SHORTVER, 2.9x endif #CC_SHORTVER, 3.0else #CC_NAME, gccifeq ($(CC_NAME), suncc) CFLAGS+=-g -xO5 -fast -native -xarch=v8plusa -xCC -xc99 # C99 supportelse #other compilers $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)endif #CC_NAME, sunccendif #CC_NAME, gccendif #ARCH, sparc# setting LDFLAGSifeq ($(LDTYPE), solaris) MOD_LDFLAGS=-G $(LDFLAGS)else LDFLAGS+=-Wl,-O2 -Wl,-E MOD_LDFLAGS=-shared $(LDFLAGS)endififeq ($(CC_NAME), suncc) LDFLAGS+=-xO5 MOD_LDFLAGS=-G $(LDFLAGS)endifelse #mode,releaseifeq ($(CC_NAME), gcc) CFLAGS=-g -Wcast-alignifeq ($(ARCH), sparc64) CFLAGS+= -mcpu=ultrasparc endififeq ($(LDTYPE), solaris) #solaris ld LDFLAGS+=-g MOD_LDFLAGS=-G $(LDFLAGS)else #gnu or other ld type LDFLAGS+=-g -Wl,-E MOD_LDFLAGS=-shared $(LDFLAGS)endifendififeq ($(CC_NAME), suncc) CFLAGS= -g LDFLAGS+=-g MOD_LDFLAGS=-G $(LDFLAGS)endifendif #mode=releaseifeq ($(CC_NAME), gcc) MOD_CFLAGS=-fPIC -DPIC $(CFLAGS)endififeq ($(ARCH), sparc64)ifeq ($(CC_NAME), suncc) MOD_CFLAGS=-xcode=pic32 $(CFLAGS)endifendif#os specific stuffifeq ($(OS), linux) DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \ -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL LIBS+= -lc -lpthread -lrt -lsasl2endififeq ($(OS), solaris) DEFS+= -DHAVE_GETIPNODEBYNAME -DHAVE_SYS_SOCKIO_H -DHAVE_SCHED_YIELD LIBS+= -lc -lpthread -lmd5 -lnsl -lsocketendif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -