📄 makefile
字号:
#----------------------------------------------------------------------------# Makefile for building BUILD on Unix/Cygwin systems.## Written by Ryan C. Gordon (icculus@clutteredmind.org)# Do NOT contact Ken Silverman for support of BUILD on Unix or Linux.#----------------------------------------------------------------------------#-----------------------------------------------------------------------------## If this makefile fails to detect Cygwin correctly, or you want to force# the build process's behaviour, set it to "true" or "false" (w/o quotes).#-----------------------------------------------------------------------------##cygwin := true#cygwin := falsecygwin := autodetect#-----------------------------------------------------------------------------## You only need to set SDL_INC_DIR and SDL_LIB_DIR if you are using cygwin.# SDL_INC_DIR is where SDL.h and associated headers can be found, and# SDL_LIB_DIR is where SDL.lib and SDL.dll are located. These may be set as# environment variables, if you'd prefer to not hack the Makefile.## examples:# SDL_INC_DIR := C:/2/SDL-1.1.8/include# SDL_LIB_DIR := C:/2/SDL-1.1.8/lib#-----------------------------------------------------------------------------#ifeq ($(strip $(SDL_INC_DIR)),) SDL_INC_DIR := please_set_me_cygwin_usersendififeq ($(strip $(SDL_LIB_DIR)),) SDL_LIB_DIR := please_set_me_cygwin_usersendif#-----------------------------------------------------------------------------## To use a different platform's ASM or portable C, change this.# (note that this MUST be -DUSE_I386_ASM right now if you even want a# prayer of having a successful compilation.)#-----------------------------------------------------------------------------#USE_ASM := -DUSE_I386_ASM#-----------------------------------------------------------------------------## Don't touch this unless you know what you are doing.#-----------------------------------------------------------------------------##useperl := trueuseperl := false#useopengl := trueuseopengl := falseGL_INCLDIR := /usr/X11R6/include#usedlls := trueusedlls := false#usephysfs := trueusephysfs := false#-----------------------------------------------------------------------------## Everything below this line is probably okay.#-----------------------------------------------------------------------------#ifeq ($(strip $(cygwin)),autodetect) ifneq ($(strip $(shell gcc -v 2>&1 |grep "cygwin")),) cygwin := true else cygwin := false endifendififeq ($(strip $(cygwin)),true) # (no choice on Cygwin right now...) usedlls := false ifeq ($(strip $(SDL_INC_DIR)),please_set_me_cygwin_users) $(error Cygwin users need to set the SDL_INC_DIR envr var.) else SDL_CFLAGS := -I$(SDL_INC_DIR) endif ifeq ($(strip $(SDL_LIB_DIR)),please_set_me_cygwin_users) $(error Cygwin users need to set the SDL_LIB_DIR envr var.) else SDL_LDFLAGS := -L$(SDL_LIB_DIR) -lSDL endifelse SDL_CFLAGS := $(shell sdl-config --cflags) SDL_LDFLAGS := $(shell sdl-config --libs)endifCC = gccifeq ($(strip $(cygwin)),true) ASM = nasmw DLL_EXT = .dll EXE_EXT = .exe ASMOBJFMT = win32 ASMDEFS = -dC_IDENTIFIERS_UNDERSCORED CFLAGS += -DC_IDENTIFIERS_UNDERSCOREDelse ASM = nasm DLL_EXT = .so EXE_EXT = ASMOBJFMT = elfendififeq ($(strip $(useopengl)),true) CFLAGS += -DUSE_OPENGL -I$(GL_INCLDIR)endififeq ($(strip $(useperl)),true) CFLAGS += -DUSE_PERL LDPERL := $(shell perl -MExtUtils::Embed -e ldopts) CCPERL := $(shell perl -MExtUtils::Embed -e ccopts) # !!! can I lose the explicit path somehow? PERLOBJS += buildperl.o /usr/lib/perl5/i386-linux/CORE/libperl.aendififeq ($(strip $(usephysfs)),true) CFLAGS += -DUSE_PHYSICSFS LDFLAGS += -lphysfsendififeq ($(strip $(usedlls)),true)ENGINEBASE = buildengineENGINEDLL = $(strip $(ENGINEBASE))$(strip $(DLL_EXT))NETBASE = buildnetNETDLL = $(strip $(NETBASE))$(strip $(DLL_EXT))endifENGINESRCS = engine.c cache1d.c sdl_driver.c unix_compat.cENGINESRCS += a_nasm.asm pragmas.c a.cifeq ($(strip $(useopengl)),true)ENGINESRCS += buildgl.cendifNETSRCS = multi_tcpip.cGAMEEXE = gameGAMESRCS = game.c #GAMESRCS += multi.c k.asm kdmeng.cifneq ($(strip $(usedlls)),true)GAMESRCS += $(ENGINESRCS)GAMESRCS += $(NETSRCS)endifBUILDEXE = buildBUILDSRCS = build.c bstub.cifneq ($(strip $(usedlls)),true)BUILDSRCS += $(ENGINESRCS)endifENGINEDIR = .ASMFLAGS = -f $(ASMOBJFMT) $(ASMDEFS)LINKER = gccCFLAGS += $(USE_ASM) -Werror -ansi -pedantic -funsigned-char -DPLATFORM_UNIX -O2 -g -Wall $(SDL_CFLAGS) -fasm -fno-omit-frame-pointerLDFLAGS += -g $(SDL_LDFLAGS)# Rules for turning source files into .o files%.o: %.c $(CC) -c -o $@ $< $(CFLAGS)%.o: %.asm $(ASM) $(ASMFLAGS) -o $@ $<# Rule for getting list of objects from sourceENGINEOBJS1 := $(ENGINESRCS:.c=.o)ENGINEOBJS := $(ENGINEOBJS1:.asm=.o)NETOBJS1 := $(NETSRCS:.c=.o)NETOBJS := $(NETOBJS1:.asm=.o)GAMEOBJS1 := $(GAMESRCS:.c=.o)GAMEOBJS := $(GAMEOBJS1:.asm=.o)BUILDOBJS1 := $(BUILDSRCS:.c=.o)BUILDOBJS := $(BUILDOBJS1:.asm=.o)CLEANUP = $(GAMEOBJS) $(BUILDOBJS) $(PERLOBJS) $(NETOBJS) \ $(GAMEEXE) $(BUILDEXE) $(ENGINEOBJS) $(ENGINEDLL) \ $(wildcard *.exe) $(wildcard *.obj) \ $(wildcard *~) $(wildcard *.err) \ $(wildcard .\#*) coreall: $(BUILDEXE) $(GAMEEXE)ifeq ($(strip $(useperl)),true)buildperl.o : buildperl.c $(CC) -c -o $@ $< $(CFLAGS) $(CCPERL)endififeq ($(strip $(usedlls)),true)$(ENGINEDLL) : $(ENGINEOBJS) $(LINKER) -shared -o $(ENGINEDLL) $(LDFLAGS) $(ENGINEOBJS)$(NETDLL) : $(NETOBJS) $(LINKER) -shared -o $(NETDLL) $(LDFLAGS) $(NETOBJS)endif$(GAMEEXE) : $(ENGINEDLL) $(NETDLL) $(GAMEOBJS) $(PERLOBJS) $(LINKER) -o $(GAMEEXE) $(LDFLAGS) $(LDPERL) $(PERLOBJS) $(GAMEOBJS) $(ENGINEDLL) $(NETDLL)$(BUILDEXE) : $(ENGINEDLL) $(BUILDOBJS) $(LINKER) -o $(BUILDEXE) $(LDFLAGS) $(BUILDOBJS) $(ENGINEDLL)listclean: @echo "A 'make clean' would remove" $(CLEANUP)clean: rm -f $(CLEANUP)#-----------------------------------------------------------------------------## This section is pretty much just for Ryan's use to make distributions.# You Probably Should Not Touch.#-----------------------------------------------------------------------------## These are the files needed in a binary distribution, regardless of what# platform is being used.BINSCOMMON = build$(strip $(EXE_EXT)) game$(strip $(EXE_EXT))BINSCOMMON += ascboard.map boards.map evilal.map kensig.map nsnoal.mapBINSCOMMON += test.map nukeland.mapBINSCOMMON += stuff.datBINSCOMMON += BUILDLIC.TXTBINSCOMMON += names.hpackage: clean cd .. ; zip -9rz ./BUILD-engine-$(shell date +%m%d%Y).zip buildengine -x "*CVS*" < buildengine/FILEID.DIZifeq ($(strip $(cygwin)),true)msbins: win32bins dosbinswin32bins: wmake -f Makefile.w32 clean wmake -f Makefile.w32 cp $(SDL_LIB_DIR)/SDL.dll . echo -e "\r\n\r\n\r\nHEY YOU.\r\n\r\n\r\nTake a look at README-win32bins.txt FIRST.\r\n\r\n\r\n--ryan. (icculus@clutteredmind.org)\r\n\r\n" |zip -9rz ../BUILD-win32bins-$(shell date +%m%d%Y).zip $(BINSCOMMON) SDL.dll README-win32bins.txt README CHANGELOGdosbins: wmake -f Makefile.dos clean wmake -f Makefile.dos cp C:/WATCOM/BINW/DOS4GW.EXE . echo -e "\r\n\r\n\r\nHEY YOU.\r\n\r\n\r\nTake a look at README-dosbins.txt FIRST.\r\n\r\n\r\n--ryan. (icculus@clutteredmind.org)\r\n\r\n" |zip -9rz ../BUILD-dosbins-$(shell date +%m%d%Y).zip $(BINSCOMMON) README-dosbins.txt README CHANGELOG DOS4GW.EXEelsemsbins: nocygwinwin32bins: nocygwindosbins: nocygwinendifnocygwin: @echo This must be done on a Windows box in the Cygwin environment.#-----------------------------------------------------------------------------## End packaging section.#-----------------------------------------------------------------------------## end of Makefile ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -