diff options
author | IronClawTrem <louie.nutman@gmail.com> | 2020-04-07 01:09:18 +0100 |
---|---|---|
committer | IronClawTrem <louie.nutman@gmail.com> | 2020-04-07 01:09:18 +0100 |
commit | c378d3fb9f7f443ee6a6f78f490f2bc203aba5ea (patch) | |
tree | 2156063399514e6878d260fbbadd658036a69013 | |
parent | 6c79e8bb722b20241fa9eab063dfefa73870a740 (diff) |
some makefile shit etc still broken tho
-rw-r--r-- | GNUmakefile | 1269 | ||||
-rw-r--r-- | Makefile | 1955 | ||||
-rw-r--r-- | Makefile.local | 3 | ||||
-rw-r--r-- | src/cgame/cg_syscalls_11.asm | 115 | ||||
-rw-r--r-- | src/game/g_main.c | 2 | ||||
-rw-r--r-- | src/tools/lcc/lburg/gram.c | 1686 | ||||
-rw-r--r-- | src/ui/ui_syscalls_11.asm | 98 |
7 files changed, 3169 insertions, 1959 deletions
diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..06c8c04 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,1269 @@ +# +# Tremulous Makefile +# +# GNU Make required +# + +COMPILE_PLATFORM=$(shell uname | sed -e 's/_.*//' | tr '[:upper:]' '[:lower:]' | sed -e 's/\//_/g') +COMPILE_ARCH=$(shell uname -m | sed -e 's/i.86/x86/' | sed -e 's/^arm.*/arm/') + +ifeq ($(COMPILE_PLATFORM),sunos) + # Solaris uname and GNU uname differ + COMPILE_ARCH=$(shell uname -p | sed -e 's/i.86/x86/') +endif + +ifndef BUILD_GAME_SO + BUILD_GAME_SO = 1 +endif +ifndef BUILD_GAME_QVM + BUILD_GAME_QVM = 1 +endif +ifndef BUILD_GAME_QVM_11 + BUILD_GAME_QVM_11= 1 +endif +ifndef BUILD_ONLY_GAME + BUILD_ONLY_GAME = 0 +endif +ifndef BUILD_ONLY_CGUI + BUILD_ONLY_CGUI = 0 +endif + +############################################################################# +# +# If you require a different configuration from the defaults below, create a +# new file named "Makefile.local" in the same directory as this file and define +# your parameters there. This allows you to change configuration without +# causing problems with keeping up to date with the repository. +# +############################################################################# +-include GNUmakefile.local + +include $(SETTINGS_MAKEFILES) + +ifeq ($(COMPILE_PLATFORM),cygwin) + PLATFORM=mingw32 +endif + +ifndef PLATFORM +PLATFORM=$(COMPILE_PLATFORM) +endif +export PLATFORM + +ifeq ($(COMPILE_ARCH),i86pc) + COMPILE_ARCH=x86 +endif + +ifeq ($(COMPILE_ARCH),amd64) + COMPILE_ARCH=x86_64 +endif +ifeq ($(COMPILE_ARCH),x64) + COMPILE_ARCH=x86_64 +endif + +ifeq ($(COMPILE_ARCH),powerpc) + COMPILE_ARCH=ppc +endif +ifeq ($(COMPILE_ARCH),powerpc64) + COMPILE_ARCH=ppc64 +endif + +ifeq ($(COMPILE_ARCH),axp) + COMPILE_ARCH=alpha +endif + +ifndef ARCH +ARCH=$(COMPILE_ARCH) +endif +export ARCH + +ifneq ($(PLATFORM),$(COMPILE_PLATFORM)) + CROSS_COMPILING=1 +else + CROSS_COMPILING=0 + + ifneq ($(ARCH),$(COMPILE_ARCH)) + CROSS_COMPILING=1 + endif +endif +export CROSS_COMPILING + +ifndef VERSION +VERSION=aa +endif + +ifndef CLIENTBIN +CLIENTBIN=tremulous +endif + +ifndef BASEGAME +BASEGAME=slacker +endif + +ifndef BASEGAME_CFLAGS +BASEGAME_CFLAGS= +endif + +ifndef COPYDIR +COPYDIR="/usr/local/games/tremulous" +endif + +ifndef COPYBINDIR +COPYBINDIR=$(COPYDIR) +endif + +ifndef MOUNT_DIR +MOUNT_DIR=src +endif + +ifndef ASSETS_DIR +ASSETS_DIR=assets +endif + +ifndef BUILD_DIR +BUILD_DIR=bld +endif + +ifndef TEMPDIR +TEMPDIR=/tmp +endif + +ifndef DEBUG_CFLAGS +DEBUG_CFLAGS=-g -O0 +endif + +############################################################################# + +BD=$(BUILD_DIR) # /debug-$(PLATFORM)-$(ARCH) +BR=$(BUILD_DIR) # /release-$(PLATFORM)-$(ARCH) +CDIR=$(MOUNT_DIR)/client +SDIR=$(MOUNT_DIR)/server +CMDIR=$(MOUNT_DIR)/qcommon +GDIR=$(MOUNT_DIR)/game +CGDIR=$(MOUNT_DIR)/cgame +NDIR=$(MOUNT_DIR)/null +UIDIR=$(MOUNT_DIR)/ui +Q3ASMDIR=$(MOUNT_DIR)/tools/asm +LBURGDIR=$(MOUNT_DIR)/tools/lcc/lburg +Q3CPPDIR=$(MOUNT_DIR)/tools/lcc/cpp +Q3LCCETCDIR=$(MOUNT_DIR)/tools/lcc/etc +Q3LCCSRCDIR=$(MOUNT_DIR)/tools/lcc/src +TEMPDIR=/tmp + +# Add git version info +USE_GIT= +ifeq ($(wildcard .git),.git) + GIT_REV=$(shell git describe --tag) + ifneq ($(GIT_REV),) + VERSION:=$(GIT_REV) + USE_GIT=1 + endif +endif + +############################################################################# +# SETUP AND BUILD -- LINUX +############################################################################# + +## Defaults +LIB=lib + +INSTALL=install +MKDIR=mkdir + +ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu")) + + ifeq ($(ARCH),x86_64) + LIB=lib64 + else + ifeq ($(ARCH),ppc64) + LIB=lib64 + else + ifeq ($(ARCH),s390x) + LIB=lib64 + endif + endif + endif + + BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ + -pipe -DUSE_ICON + + OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer + OPTIMIZE = $(OPTIMIZEVM) -ffast-math + + ifeq ($(ARCH),x86_64) + OPTIMIZEVM = -O3 -fomit-frame-pointer -funroll-loops \ + -falign-functions=2 -fstrength-reduce + OPTIMIZE = $(OPTIMIZEVM) -ffast-math + HAVE_VM_COMPILED = true + else + ifeq ($(ARCH),x86) + OPTIMIZEVM = -O3 -march=i586 -fomit-frame-pointer \ + -funroll-loops -falign-functions=2 -fstrength-reduce + OPTIMIZE = $(OPTIMIZEVM) -ffast-math + HAVE_VM_COMPILED=true + else + ifeq ($(ARCH),ppc) + BASE_CFLAGS += -maltivec + HAVE_VM_COMPILED=true + endif + ifeq ($(ARCH),ppc64) + BASE_CFLAGS += -maltivec + HAVE_VM_COMPILED=true + endif + ifeq ($(ARCH),sparc) + OPTIMIZE += -mtune=ultrasparc3 -mv8plus + OPTIMIZEVM += -mtune=ultrasparc3 -mv8plus + HAVE_VM_COMPILED=true + endif + ifeq ($(ARCH),alpha) + # According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=410555 + # -ffast-math will cause the client to die with SIGFPE on Alpha + OPTIMIZE = $(OPTIMIZEVM) + endif + endif + endif + + SHLIBEXT=so + SHLIBCFLAGS=-fPIC -fvisibility=hidden + SHLIBLDFLAGS=-shared $(LDFLAGS) + + THREAD_LIBS=-lpthread + LIBS=-ldl -lm + + ifeq ($(ARCH),x86) + # linux32 make ... + BASE_CFLAGS += -m32 + else + ifeq ($(ARCH),ppc64) + BASE_CFLAGS += -m64 + endif + endif +else # ifeq Linux + +############################################################################# +# SETUP AND BUILD -- MAC OS X +############################################################################# + +ifeq ($(PLATFORM),darwin) + HAVE_VM_COMPILED=true + LIBS = -framework Cocoa + OPTIMIZEVM= + + BASE_CFLAGS = -Wall -Wimplicit -Wstrict-prototypes -mmacosx-version-min=10.5 \ + -DMAC_OS_X_VERSION_MIN_REQUIRED=1050 + + ifeq ($(ARCH),ppc) + BASE_CFLAGS += -arch ppc -faltivec + OPTIMIZEVM += -O3 + endif + ifeq ($(ARCH),ppc64) + BASE_CFLAGS += -arch ppc64 -faltivec + endif + ifeq ($(ARCH),x86) + OPTIMIZEVM += -mfpmath=387+sse + # x86 vm will crash without -mstackrealign since MMX instructions will be + # used no matter what and they corrupt the frame pointer in VM calls + BASE_CFLAGS += -arch i386 -m32 -mstackrealign + endif + ifeq ($(ARCH),x86_64) + OPTIMIZEVM += -arch x86_64 -mfpmath=sse -msse2 + endif + + # When compiling on OSX for OSX, we're not cross compiling as far as the + # Makefile is concerned, as target architecture is specified as a compiler + # argument + ifeq ($(COMPILE_PLATFORM),darwin) + CROSS_COMPILING=0 + endif + + + ifeq ($(CROSS_COMPILING),1) + ifeq ($(ARCH),x86_64) + CC=x86_64-apple-darwin13-cc + RANLIB=x86_64-apple-darwin13-ranlib + else + ifeq ($(ARCH),x86) + CC=i386-apple-darwin13-cc + RANLIB=i386-apple-darwin13-ranlib + else + $(error Architecture $(ARCH) is not supported when cross compiling) + endif + endif + else + TOOLS_CFLAGS += -DMACOS_X + endif + + BASE_CFLAGS += -fno-strict-aliasing -DMACOS_X -fno-common -pipe + + BASE_CFLAGS += -D_THREAD_SAFE=1 + + OPTIMIZE = $(OPTIMIZEVM) -ffast-math + + SHLIBEXT=dylib + SHLIBCFLAGS=-fPIC -fno-common + SHLIBLDFLAGS=-dynamiclib $(LDFLAGS) -Wl,-U,_com_altivec + + NOTSHLIBCFLAGS=-mdynamic-no-pic + +else # ifeq darwin + + +############################################################################# +# SETUP AND BUILD -- MINGW32 +############################################################################# + +ifeq ($(PLATFORM),mingw32) + + ifeq ($(CROSS_COMPILING),1) + # If CC is already set to something generic, we probably want to use + # something more specific + ifneq ($(findstring $(strip $(CC)),cc gcc),) + CC= + endif + + # We need to figure out the correct gcc and windres + ifeq ($(ARCH),x86_64) + MINGW_PREFIXES=amd64-mingw32msvc x86_64-w64-mingw32 + endif + ifeq ($(ARCH),x86) + MINGW_PREFIXES=i586-mingw32msvc i686-w64-mingw32 + endif + + ifndef CC + CC=$(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \ + $(call bin_path, $(MINGW_PREFIX)-gcc))) + endif + else + # Some MinGW installations define CC to cc, but don't actually provide cc, + # so check that CC points to a real binary and use gcc if it doesn't + ifeq ($(call bin_path, $(CC)),) + CC=gcc + endif + endif + + ifeq ($(CC),) + $(error Cannot find a suitable cross compiler for $(PLATFORM)) + endif + + BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ + -DUSE_ICON + + # In the absence of wspiapi.h, require Windows XP or later + ifeq ($(shell test -e $(CMDIR)/wspiapi.h; echo $$?),1) + BASE_CFLAGS += -DWINVER=0x501 + endif + + ifeq ($(ARCH),x86_64) + OPTIMIZEVM = -O3 -fno-omit-frame-pointer \ + -funroll-loops -falign-functions=2 -fstrength-reduce + OPTIMIZE = $(OPTIMIZEVM) -ffast-math + HAVE_VM_COMPILED = true + endif + ifeq ($(ARCH),x86) + OPTIMIZEVM = -O3 -march=i586 -fno-omit-frame-pointer \ + -funroll-loops -falign-functions=2 -fstrength-reduce + OPTIMIZE = $(OPTIMIZEVM) -ffast-math + HAVE_VM_COMPILED = true + endif + + SHLIBEXT=dll + SHLIBCFLAGS= + SHLIBLDFLAGS=-shared $(LDFLAGS) + + ifeq ($(CROSS_COMPILING),0) + TOOLS_BINEXT=.exe + endif + + ifeq ($(COMPILE_PLATFORM),cygwin) + TOOLS_BINEXT=.exe + TOOLS_CC=$(CC) + endif + + LIBS= -lws2_32 -lwinmm -lpsapi + + ifeq ($(ARCH),x86) + # build 32bit + BASE_CFLAGS += -m32 + else + BASE_CFLAGS += -m64 + endif + +else # ifeq mingw32 + +############################################################################# +# SETUP AND BUILD -- FREEBSD +############################################################################# + +ifeq ($(PLATFORM),freebsd) + + # flags + BASE_CFLAGS = -Wall -fno-strict-aliasing -DUSE_ICON + HAVE_VM_COMPILED = true + + OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer + OPTIMIZE = $(OPTIMIZEVM) -ffast-math + + SHLIBEXT=so + SHLIBCFLAGS=-fPIC + SHLIBLDFLAGS=-shared $(LDFLAGS) + + # don't need -ldl (FreeBSD) + LIBS=-lm + + # cross-compiling tweaks + ifeq ($(ARCH),x86) + ifeq ($(CROSS_COMPILING),1) + BASE_CFLAGS += -m32 + endif + endif + ifeq ($(ARCH),x86_64) + ifeq ($(CROSS_COMPILING),1) + BASE_CFLAGS += -m64 + endif + endif +else # ifeq freebsd + +############################################################################# +# SETUP AND BUILD -- OPENBSD +############################################################################# + +ifeq ($(PLATFORM),openbsd) + + BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ + -pipe -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON + + OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer + OPTIMIZE = $(OPTIMIZEVM) -ffast-math + + ifeq ($(ARCH),x86_64) + OPTIMIZEVM = -O3 -fomit-frame-pointer -funroll-loops \ + -falign-functions=2 -fstrength-reduce + OPTIMIZE = $(OPTIMIZEVM) -ffast-math + HAVE_VM_COMPILED = true + else + ifeq ($(ARCH),x86) + OPTIMIZEVM = -O3 -march=i586 -fomit-frame-pointer \ + -funroll-loops -falign-functions=2 -fstrength-reduce + OPTIMIZE = $(OPTIMIZEVM) -ffast-math + HAVE_VM_COMPILED=true + else + ifeq ($(ARCH),ppc) + BASE_CFLAGS += -maltivec + HAVE_VM_COMPILED=true + endif + ifeq ($(ARCH),ppc64) + BASE_CFLAGS += -maltivec + HAVE_VM_COMPILED=true + endif + ifeq ($(ARCH),sparc64) + OPTIMIZE += -mtune=ultrasparc3 -mv8plus + OPTIMIZEVM += -mtune=ultrasparc3 -mv8plus + HAVE_VM_COMPILED=true + endif + ifeq ($(ARCH),alpha) + # According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=410555 + # -ffast-math will cause the client to die with SIGFPE on Alpha + OPTIMIZE = $(OPTIMIZEVM) + endif + endif + endif + + SHLIBEXT=so + SHLIBCFLAGS=-fPIC + SHLIBLDFLAGS=-shared $(LDFLAGS) + + THREAD_LIBS=-lpthread + LIBS=-lm +else # ifeq openbsd + +############################################################################# +# SETUP AND BUILD -- NETBSD +############################################################################# + +ifeq ($(PLATFORM),netbsd) + + LIBS=-lm + SHLIBEXT=so + SHLIBCFLAGS=-fPIC + SHLIBLDFLAGS=-shared $(LDFLAGS) + THREAD_LIBS=-lpthread + + BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes + + ifeq ($(ARCH),x86) + HAVE_VM_COMPILED=true + endif +else # ifeq netbsd + +############################################################################# +# SETUP AND BUILD -- IRIX +############################################################################# + +ifeq ($(PLATFORM),irix64) + + ARCH=mips + + CC = c99 + MKDIR = mkdir -p + + BASE_CFLAGS=-Dstricmp=strcasecmp -Xcpluscomm -woff 1185 \ + -I. -I$(ROOT)/usr/include + OPTIMIZE = -O3 + + SHLIBEXT=so + SHLIBCFLAGS= + SHLIBLDFLAGS=-shared + + LIBS=-ldl -lm -lgen +else # ifeq IRIX + +############################################################################# +# SETUP AND BUILD -- SunOS +############################################################################# + +ifeq ($(PLATFORM),sunos) + + CC=gcc + INSTALL=ginstall + MKDIR=gmkdir + COPYDIR="/usr/local/share/games/tremulous" + + ifneq ($(ARCH),x86) + ifneq ($(ARCH),sparc) + $(error arch $(ARCH) is currently not supported) + endif + endif + + BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ + -pipe -DUSE_ICON + + OPTIMIZEVM = -O3 -funroll-loops + + ifeq ($(ARCH),sparc) + OPTIMIZEVM += -O3 \ + -fstrength-reduce -falign-functions=2 \ + -mtune=ultrasparc3 -mv8plus -mno-faster-structs + HAVE_VM_COMPILED=true + else + ifeq ($(ARCH),x86) + OPTIMIZEVM += -march=i586 -fomit-frame-pointer \ + -falign-functions=2 -fstrength-reduce + HAVE_VM_COMPILED=true + BASE_CFLAGS += -m32 + endif + endif + + OPTIMIZE = $(OPTIMIZEVM) -ffast-math + + SHLIBEXT=so + SHLIBCFLAGS=-fPIC + SHLIBLDFLAGS=-shared $(LDFLAGS) + + THREAD_LIBS=-lpthread + LIBS=-lsocket -lnsl -ldl -lm +else # ifeq sunos + +############################################################################# +# SETUP AND BUILD -- GENERIC +############################################################################# + BASE_CFLAGS= + OPTIMIZE = -O3 + + SHLIBEXT=so + SHLIBCFLAGS=-fPIC + SHLIBLDFLAGS=-shared + +endif #Linux +endif #darwin +endif #mingw32 +endif #FreeBSD +endif #OpenBSD +endif #NetBSD +endif #IRIX +endif #SunOS + +ifndef CC + CC=gcc +endif + +ifndef RANLIB + RANLIB=ranlib +endif + +ifneq ($(HAVE_VM_COMPILED),true) + BASE_CFLAGS += -DNO_VM_COMPILED + BUILD_GAME_QVM=0 +endif + +TARGETS = + +ifndef FULLBINEXT + FULLBINEXT=$(BINEXT) +endif + +ifndef SHLIBNAME + SHLIBNAME=.$(SHLIBEXT) +endif + +ifneq ($(BUILD_GAME_SO),0) + ifeq ($(BUILD_ONLY_GAME),1) + TARGETS += \ + $(B)/out/$(BASEGAME)/game$(SHLIBNAME) + else + ifeq ($(BUILD_ONLY_CGUI),1) + TARGETS += \ + $(B)/out/$(BASEGAME)/cgame$(SHLIBNAME) \ + $(B)/out/$(BASEGAME)/ui$(SHLIBNAME) + else + TARGETS += \ + $(B)/out/$(BASEGAME)/cgame$(SHLIBNAME) \ + $(B)/out/$(BASEGAME)/game$(SHLIBNAME) \ + $(B)/out/$(BASEGAME)/ui$(SHLIBNAME) + endif + endif +endif + +ifneq ($(BUILD_GAME_QVM),0) + ifeq ($(BUILD_ONLY_GAME),1) + TARGETS += \ + $(B)/out/$(BASEGAME)/vm/game.qvm + else + ifeq ($(BUILD_ONLY_CGUI),1) + TARGETS += \ + $(B)/out/$(BASEGAME)/vm/cgame.qvm \ + $(B)/out/$(BASEGAME)/vm/ui.qvm + else + TARGETS += \ + $(B)/out/$(BASEGAME)/vm/cgame.qvm \ + $(B)/out/$(BASEGAME)/vm/game.qvm \ + $(B)/out/$(BASEGAME)/vm/ui.qvm + endif + endif +endif + +ifneq ($(BUILD_GAME_QVM_11),0) + ifneq ($(BUILD_ONLY_GAME),1) + TARGETS += \ + $(B)/out/$(BASEGAME)_11/vm/cgame.qvm \ + $(B)/out/$(BASEGAME)_11/vm/ui.qvm + endif +endif + +ifeq ("$(CC)", $(findstring "$(CC)", "clang" "clang++")) + BASE_CFLAGS += -Qunused-arguments +endif + +ifdef DEFAULT_BASEDIR + BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\" +endif + +ifeq ($(GENERATE_DEPENDENCIES),1) + DEPEND_CFLAGS = -MMD +else + DEPEND_CFLAGS = +endif + +ifeq ($(NO_STRIP),1) + STRIP_FLAG = +else + STRIP_FLAG = -s +endif + +BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\" + +ifeq ($(V),1) +echo_cmd=@: +Q= +else +echo_cmd=@echo +Q=@ +endif + +ifeq ($(GENERATE_DEPENDENCIES),1) + DO_QVM_DEP=cat $(@:%.o=%.d) | sed -e 's/\.o/\.asm/g' >> $(@:%.o=%.d) +endif + +define DO_SHLIB_CC +$(echo_cmd) "SHLIB_CC $<" +$(Q)$(CC) $(BASEGAME_CFLAGS) $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< +$(Q)$(DO_QVM_DEP) +endef + +define DO_GAME_CC +$(echo_cmd) "GAME_CC $<" +$(Q)$(CC) $(BASEGAME_CFLAGS) -DGAME $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< +$(Q)$(DO_QVM_DEP) +endef + +define DO_CGAME_CC +$(echo_cmd) "CGAME_CC $<" +$(Q)$(CC) $(BASEGAME_CFLAGS) -DCGAME $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< +$(Q)$(DO_QVM_DEP) +endef + +define DO_UI_CC +$(echo_cmd) "UI_CC $<" +$(Q)$(CC) $(BASEGAME_CFLAGS) -DUI $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< +$(Q)$(DO_QVM_DEP) +endef + +define DO_AS +$(echo_cmd) "AS $<" +$(Q)$(CC) $(CFLAGS) $(OPTIMIZE) -x assembler-with-cpp -o $@ -c $< +endef + + +############################################################################# +# MAIN TARGETS +############################################################################# + +default: release +all: debug release + +debug: + @$(MAKE) targets B=$(BD) CFLAGS="$(CFLAGS) $(BASE_CFLAGS) $(DEPEND_CFLAGS)" \ + OPTIMIZE="$(DEBUG_CFLAGS)" OPTIMIZEVM="$(DEBUG_CFLAGS)" V=$(V) + +release: + @$(MAKE) targets B=$(BR) CFLAGS="$(CFLAGS) $(BASE_CFLAGS) $(DEPEND_CFLAGS)" \ + OPTIMIZE="-DNDEBUG $(OPTIMIZE)" OPTIMIZEVM="-DNDEBUG $(OPTIMIZEVM)" V=$(V) + +ifneq ($(call bin_path, tput),) + TERM_COLUMNS=$(shell echo $$((`tput cols`-4))) +else + TERM_COLUMNS=76 +endif + +NAKED_TARGETS=$(shell echo $(TARGETS) | sed -e "s!$(B)/!!g") + +print_list=@for i in $(1); \ + do \ + echo " $$i"; \ + done + +ifneq ($(call bin_path, fmt),) + print_wrapped=@echo $(1) | fmt -w $(TERM_COLUMNS) | sed -e "s/^\(.*\)$$/ \1/" +else + print_wrapped=$(print_list) +endif + +# Create the build directories, check libraries and print out +# an informational message, then start building +targets: makedirs + @echo "" + @echo "Building in $(B):" + @echo " PLATFORM: $(PLATFORM)" + @echo " ARCH: $(ARCH)" + @echo " VERSION: $(VERSION)" + @echo " COMPILE_PLATFORM: $(COMPILE_PLATFORM)" + @echo " COMPILE_ARCH: $(COMPILE_ARCH)" + @echo " CC: $(CC)" + @echo "" + @echo " CFLAGS:" + $(call print_wrapped, $(CFLAGS) $(OPTIMIZE)) + @echo "" + @echo " LDFLAGS:" + $(call print_wrapped, $(LDFLAGS)) + @echo "" + @echo " LIBS:" + $(call print_wrapped, $(LIBS)) + @echo "" + @echo " Output:" + $(call print_list, $(NAKED_TARGETS)) + @echo "" +ifneq ($(TARGETS),) + ifndef DEBUG_MAKEFILE + @$(MAKE) $(TARGETS) V=$(V) + endif +endif + +makedirs: + @if [ ! -d $(BUILD_DIR) ];then $(MKDIR) $(BUILD_DIR);fi + @if [ ! -d $(B) ];then $(MKDIR) $(B);fi + @if [ ! -d $(B)/cgame ];then $(MKDIR) $(B)/cgame;fi + @if [ ! -d $(B)/game ];then $(MKDIR) $(B)/game;fi + @if [ ! -d $(B)/ui ];then $(MKDIR) $(B)/ui;fi + @if [ ! -d $(B)/qcommon ];then $(MKDIR) $(B)/qcommon;fi + @if [ ! -d $(B)/11 ];then $(MKDIR) $(B)/11;fi + @if [ ! -d $(B)/11/cgame ];then $(MKDIR) $(B)/11/cgame;fi + @if [ ! -d $(B)/11/ui ];then $(MKDIR) $(B)/11/ui;fi + @if [ ! -d $(B)/out ];then $(MKDIR) $(B)/out;fi + @if [ ! -d $(B)/out/$(BASEGAME) ];then $(MKDIR) $(B)/out/$(BASEGAME);fi + @if [ ! -d $(B)/out/$(BASEGAME)/vm ];then $(MKDIR) $(B)/out/$(BASEGAME)/vm;fi + @if [ ! -d $(B)/out/$(BASEGAME)_11 ];then $(MKDIR) $(B)/out/$(BASEGAME)_11;fi + @if [ ! -d $(B)/out/$(BASEGAME)_11/vm ];then $(MKDIR) $(B)/out/$(BASEGAME)_11/vm;fi + @if [ ! -d $(B)/tools ];then $(MKDIR) $(B)/tools;fi + @if [ ! -d $(B)/tools/asm ];then $(MKDIR) $(B)/tools/asm;fi + @if [ ! -d $(B)/tools/etc ];then $(MKDIR) $(B)/tools/etc;fi + @if [ ! -d $(B)/tools/rcc ];then $(MKDIR) $(B)/tools/rcc;fi + @if [ ! -d $(B)/tools/cpp ];then $(MKDIR) $(B)/tools/cpp;fi + @if [ ! -d $(B)/tools/lburg ];then $(MKDIR) $(B)/tools/lburg;fi + +############################################################################# +# QVM BUILD TOOLS +############################################################################# + +ifndef TOOLS_CC + # A compiler which probably produces native binaries + TOOLS_CC=$(CC) +endif + +TOOLS_OPTIMIZE = -g -Wall -fno-strict-aliasing +TOOLS_CFLAGS += $(TOOLS_OPTIMIZE) \ + -DTEMPDIR=\"$(TEMPDIR)\" -DSYSTEM=\"\" \ + -I$(Q3LCCSRCDIR) \ + -I$(LBURGDIR) +TOOLS_LIBS = +TOOLS_LDFLAGS = + +ifeq ($(GENERATE_DEPENDENCIES),1) + TOOLS_CFLAGS += -MMD +endif + +define DO_TOOLS_CC +$(echo_cmd) "TOOLS_CC $<" +$(Q)$(TOOLS_CC) $(TOOLS_CFLAGS) -o $@ -c $< +endef + +define DO_TOOLS_CC_DAGCHECK +$(echo_cmd) "TOOLS_CC_DAGCHECK $<" +$(Q)$(TOOLS_CC) $(TOOLS_CFLAGS) -Wno-unused -o $@ -c $< +endef + +LBURG = $(B)/tools/lburg/lburg$(TOOLS_BINEXT) +DAGCHECK_C = $(B)/tools/rcc/dagcheck.c +Q3RCC = $(B)/tools/q3rcc$(TOOLS_BINEXT) +Q3CPP = $(B)/tools/q3cpp$(TOOLS_BINEXT) +Q3LCC = $(B)/tools/q3lcc$(TOOLS_BINEXT) +Q3ASM = $(B)/tools/q3asm$(TOOLS_BINEXT) + +LBURGOBJ= \ + $(B)/tools/lburg/lburg.o \ + $(B)/tools/lburg/gram.o + +$(B)/tools/lburg/%.o: $(LBURGDIR)/%.c + $(DO_TOOLS_CC) + +$(LBURG): $(LBURGOBJ) + $(echo_cmd) "LD $@" + $(Q)$(TOOLS_CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $^ $(TOOLS_LIBS) + +Q3RCCOBJ = \ + $(B)/tools/rcc/alloc.o \ + $(B)/tools/rcc/bind.o \ + $(B)/tools/rcc/bytecode.o \ + $(B)/tools/rcc/dag.o \ + $(B)/tools/rcc/dagcheck.o \ + $(B)/tools/rcc/decl.o \ + $(B)/tools/rcc/enode.o \ + $(B)/tools/rcc/error.o \ + $(B)/tools/rcc/event.o \ + $(B)/tools/rcc/expr.o \ + $(B)/tools/rcc/gen.o \ + $(B)/tools/rcc/init.o \ + $(B)/tools/rcc/inits.o \ + $(B)/tools/rcc/input.o \ + $(B)/tools/rcc/lex.o \ + $(B)/tools/rcc/list.o \ + $(B)/tools/rcc/main.o \ + $(B)/tools/rcc/null.o \ + $(B)/tools/rcc/output.o \ + $(B)/tools/rcc/prof.o \ + $(B)/tools/rcc/profio.o \ + $(B)/tools/rcc/simp.o \ + $(B)/tools/rcc/stmt.o \ + $(B)/tools/rcc/string.o \ + $(B)/tools/rcc/sym.o \ + $(B)/tools/rcc/symbolic.o \ + $(B)/tools/rcc/trace.o \ + $(B)/tools/rcc/tree.o \ + $(B)/tools/rcc/types.o + +$(DAGCHECK_C): $(LBURG) $(Q3LCCSRCDIR)/dagcheck.md + $(echo_cmd) "LBURG $(Q3LCCSRCDIR)/dagcheck.md" + $(Q)$(LBURG) $(Q3LCCSRCDIR)/dagcheck.md $@ + +$(B)/tools/rcc/dagcheck.o: $(DAGCHECK_C) + $(DO_TOOLS_CC_DAGCHECK) + +$(B)/tools/rcc/%.o: $(Q3LCCSRCDIR)/%.c + $(DO_TOOLS_CC) + +$(Q3RCC): $(Q3RCCOBJ) + $(echo_cmd) "LD $@" + $(Q)$(TOOLS_CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $^ $(TOOLS_LIBS) + +Q3CPPOBJ = \ + $(B)/tools/cpp/cpp.o \ + $(B)/tools/cpp/lex.o \ + $(B)/tools/cpp/nlist.o \ + $(B)/tools/cpp/tokens.o \ + $(B)/tools/cpp/macro.o \ + $(B)/tools/cpp/eval.o \ + $(B)/tools/cpp/include.o \ + $(B)/tools/cpp/hideset.o \ + $(B)/tools/cpp/getopt.o \ + $(B)/tools/cpp/unix.o + +$(B)/tools/cpp/%.o: $(Q3CPPDIR)/%.c + $(DO_TOOLS_CC) + +$(Q3CPP): $(Q3CPPOBJ) + $(echo_cmd) "LD $@" + $(Q)$(TOOLS_CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $^ $(TOOLS_LIBS) + +Q3LCCOBJ = \ + $(B)/tools/etc/lcc.o \ + $(B)/tools/etc/bytecode.o + +$(B)/tools/etc/%.o: $(Q3LCCETCDIR)/%.c + $(DO_TOOLS_CC) + +$(Q3LCC): $(Q3LCCOBJ) $(Q3RCC) $(Q3CPP) + $(echo_cmd) "LD $@" + $(Q)$(TOOLS_CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $(Q3LCCOBJ) $(TOOLS_LIBS) + +define DO_Q3LCC +$(echo_cmd) "Q3LCC $<" +$(Q)$(Q3LCC) $(BASEGAME_CFLAGS) -o $@ $< +endef + +define DO_CGAME_Q3LCC +$(echo_cmd) "CGAME_Q3LCC $<" +$(Q)$(Q3LCC) $(BASEGAME_CFLAGS) -DCGAME -o $@ $< +endef + +define DO_CGAME_Q3LCC_11 +$(echo_cmd) "CGAME_Q3LCC_11 $<" +$(Q)$(Q3LCC) $(BASEGAME_CFLAGS) -DCGAME -DMODULE_INTERFACE_11 -o $@ $< +endef + +define DO_GAME_Q3LCC +$(echo_cmd) "GAME_Q3LCC $<" +$(Q)$(Q3LCC) $(BASEGAME_CFLAGS) -DGAME -o $@ $< +endef + +define DO_UI_Q3LCC +$(echo_cmd) "UI_Q3LCC $<" +$(Q)$(Q3LCC) $(BASEGAME_CFLAGS) -DUI -o $@ $< +endef + +define DO_UI_Q3LCC_11 +$(echo_cmd) "UI_Q3LCC_11 $<" +$(Q)$(Q3LCC) $(BASEGAME_CFLAGS) -DUI -DMODULE_INTERFACE_11 -o $@ $< +endef + + +Q3ASMOBJ = \ + $(B)/tools/asm/q3asm.o \ + $(B)/tools/asm/cmdlib.o + +$(B)/tools/asm/%.o: $(Q3ASMDIR)/%.c + $(DO_TOOLS_CC) + +$(Q3ASM): $(Q3ASMOBJ) + $(echo_cmd) "LD $@" + $(Q)$(TOOLS_CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $^ $(TOOLS_LIBS) + + +############################################################################# +## TREMULOUS CGAME +############################################################################# + +CGOBJ_ = \ + $(B)/cgame/cg_main.o \ + $(B)/cgame/bg_misc.o \ + $(B)/cgame/bg_pmove.o \ + $(B)/cgame/bg_slidemove.o \ + $(B)/cgame/bg_lib.o \ + $(B)/cgame/bg_alloc.o \ + $(B)/cgame/bg_voice.o \ + $(B)/cgame/cg_consolecmds.o \ + $(B)/cgame/cg_buildable.o \ + $(B)/cgame/cg_animation.o \ + $(B)/cgame/cg_animmapobj.o \ + $(B)/cgame/cg_draw.o \ + $(B)/cgame/cg_drawtools.o \ + $(B)/cgame/cg_ents.o \ + $(B)/cgame/cg_event.o \ + $(B)/cgame/cg_marks.o \ + $(B)/cgame/cg_players.o \ + $(B)/cgame/cg_playerstate.o \ + $(B)/cgame/cg_predict.o \ + $(B)/cgame/cg_servercmds.o \ + $(B)/cgame/cg_snapshot.o \ + $(B)/cgame/cg_view.o \ + $(B)/cgame/cg_weapons.o \ + $(B)/cgame/cg_scanner.o \ + $(B)/cgame/cg_attachment.o \ + $(B)/cgame/cg_trails.o \ + $(B)/cgame/cg_particles.o \ + $(B)/cgame/cg_tutorial.o \ + $(B)/ui/ui_shared.o \ + \ + $(B)/qcommon/q_math.o \ + $(B)/qcommon/q_shared.o + +CGOBJ11_ = \ + $(B)/11/cgame/cg_main.o \ + $(B)/cgame/bg_misc.o \ + $(B)/cgame/bg_pmove.o \ + $(B)/cgame/bg_slidemove.o \ + $(B)/cgame/bg_lib.o \ + $(B)/cgame/bg_alloc.o \ + $(B)/cgame/bg_voice.o \ + $(B)/cgame/cg_consolecmds.o \ + $(B)/cgame/cg_buildable.o \ + $(B)/cgame/cg_animation.o \ + $(B)/cgame/cg_animmapobj.o \ + $(B)/cgame/cg_draw.o \ + $(B)/cgame/cg_drawtools.o \ + $(B)/cgame/cg_ents.o \ + $(B)/cgame/cg_event.o \ + $(B)/cgame/cg_marks.o \ + $(B)/cgame/cg_players.o \ + $(B)/cgame/cg_playerstate.o \ + $(B)/cgame/cg_predict.o \ + $(B)/11/cgame/cg_servercmds.o \ + $(B)/11/cgame/cg_snapshot.o \ + $(B)/cgame/cg_view.o \ + $(B)/cgame/cg_weapons.o \ + $(B)/cgame/cg_scanner.o \ + $(B)/cgame/cg_attachment.o \ + $(B)/cgame/cg_trails.o \ + $(B)/cgame/cg_particles.o \ + $(B)/cgame/cg_tutorial.o \ + $(B)/ui/ui_shared.o \ + \ + $(B)/qcommon/q_math.o \ + $(B)/qcommon/q_shared.o + +CGOBJ = $(CGOBJ_) $(B)/cgame/cg_syscalls.o +CGVMOBJ = $(CGOBJ_:%.o=%.asm) $(B)/cgame/bg_lib.asm +CGVMOBJ11 = $(CGOBJ11_:%.o=%.asm) $(B)/cgame/bg_lib.asm + +$(B)/out/$(BASEGAME)/cgame$(SHLIBNAME): $(CGOBJ) + $(echo_cmd) "LD $@" + $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(CGOBJ) + +$(B)/out/$(BASEGAME)/vm/cgame.qvm: $(CGVMOBJ) $(CGDIR)/cg_syscalls.asm $(Q3ASM) + $(echo_cmd) "Q3ASM $@" + $(Q)$(Q3ASM) -o $@ $(CGVMOBJ) $(CGDIR)/cg_syscalls.asm + +$(B)/out/$(BASEGAME)_11/vm/cgame.qvm: $(CGVMOBJ11) $(CGDIR)/cg_syscalls_11.asm $(Q3ASM) + $(echo_cmd) "Q3ASM $@" + $(Q)$(Q3ASM) -o $@ $(CGVMOBJ11) $(CGDIR)/cg_syscalls_11.asm + + + +############################################################################# +## TREMULOUS GAME +############################################################################# + +GOBJ_ = \ + $(B)/game/g_main.o \ + $(B)/game/bg_misc.o \ + $(B)/game/bg_pmove.o \ + $(B)/game/bg_slidemove.o \ + $(B)/game/bg_lib.o \ + $(B)/game/bg_alloc.o \ + $(B)/game/bg_voice.o \ + $(B)/game/g_active.o \ + $(B)/game/g_client.o \ + $(B)/game/g_cmds.o \ + $(B)/game/g_combat.o \ + $(B)/game/g_physics.o \ + $(B)/game/g_buildable.o \ + $(B)/game/g_misc.o \ + $(B)/game/g_missile.o \ + $(B)/game/g_mover.o \ + $(B)/game/g_session.o \ + $(B)/game/g_spawn.o \ + $(B)/game/g_svcmds.o \ + $(B)/game/g_target.o \ + $(B)/game/g_team.o \ + $(B)/game/g_trigger.o \ + $(B)/game/g_utils.o \ + $(B)/game/g_maprotation.o \ + $(B)/game/g_weapon.o \ + $(B)/game/g_admin.o \ + $(B)/game/g_namelog.o \ + \ + $(B)/qcommon/q_math.o \ + $(B)/qcommon/q_shared.o + +GOBJ = $(GOBJ_) $(B)/game/g_syscalls.o +GVMOBJ = $(GOBJ_:%.o=%.asm) $(B)/game/bg_lib.asm + +$(B)/out/$(BASEGAME)/game$(SHLIBNAME): $(GOBJ) + $(echo_cmd) "LD $@" + $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GOBJ) + +$(B)/out/$(BASEGAME)/vm/game.qvm: $(GVMOBJ) $(GDIR)/g_syscalls.asm $(Q3ASM) + $(echo_cmd) "Q3ASM $@" + $(Q)$(Q3ASM) -o $@ $(GVMOBJ) $(GDIR)/g_syscalls.asm + + + +############################################################################# +## TREMULOUS UI +############################################################################# + +UIOBJ_ = \ + $(B)/ui/ui_main.o \ + $(B)/ui/ui_atoms.o \ + $(B)/ui/ui_shared.o \ + $(B)/ui/ui_gameinfo.o \ + \ + $(B)/ui/bg_misc.o \ + $(B)/ui/bg_lib.o \ + $(B)/qcommon/q_math.o \ + $(B)/qcommon/q_shared.o + +UIOBJ11_ = \ + $(B)/11/ui/ui_main.o \ + $(B)/ui/ui_atoms.o \ + $(B)/ui/ui_shared.o \ + $(B)/ui/ui_gameinfo.o \ + \ + $(B)/ui/bg_misc.o \ + $(B)/ui/bg_lib.o \ + $(B)/qcommon/q_math.o \ + $(B)/qcommon/q_shared.o + +UIOBJ = $(UIOBJ_) $(B)/ui/ui_syscalls.o +UIVMOBJ = $(UIOBJ_:%.o=%.asm) $(B)/ui/bg_lib.asm +UIVMOBJ11 = $(UIOBJ11_:%.o=%.asm) $(B)/ui/bg_lib.asm + +$(B)/out/$(BASEGAME)/ui$(SHLIBNAME): $(UIOBJ) + $(echo_cmd) "LD $@" + $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(UIOBJ) + +$(B)/out/$(BASEGAME)/vm/ui.qvm: $(UIVMOBJ) $(UIDIR)/ui_syscalls.asm $(Q3ASM) + $(echo_cmd) "Q3ASM $@" + $(Q)$(Q3ASM) -o $@ $(UIVMOBJ) $(UIDIR)/ui_syscalls.asm + +$(B)/out/$(BASEGAME)_11/vm/ui.qvm: $(UIVMOBJ11) $(UIDIR)/ui_syscalls_11.asm $(Q3ASM) + $(echo_cmd) "Q3ASM $@" + $(Q)$(Q3ASM) -o $@ $(UIVMOBJ11) $(UIDIR)/ui_syscalls_11.asm + +############################################################################# +## GAME MODULE RULES +############################################################################# + +$(B)/cgame/bg_%.o: $(GDIR)/bg_%.c + $(DO_CGAME_CC) + +$(B)/cgame/ui_%.o: $(UIDIR)/ui_%.c + $(DO_CGAME_CC) + +$(B)/cgame/%.o: $(CGDIR)/%.c + $(DO_CGAME_CC) + +$(B)/cgame/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC) + $(DO_CGAME_Q3LCC) + +$(B)/cgame/ui_%.asm: $(UIDIR)/ui_%.c $(Q3LCC) + $(DO_CGAME_Q3LCC) + +$(B)/cgame/%.asm: $(CGDIR)/%.c $(Q3LCC) + $(DO_CGAME_Q3LCC) + +$(B)/11/cgame/%.asm: $(CGDIR)/%.c $(Q3LCC) + $(DO_CGAME_Q3LCC_11) + + +$(B)/game/%.o: $(GDIR)/%.c + $(DO_GAME_CC) + +$(B)/game/%.asm: $(GDIR)/%.c $(Q3LCC) + $(DO_GAME_Q3LCC) + + +$(B)/ui/bg_%.o: $(GDIR)/bg_%.c + $(DO_UI_CC) + +$(B)/ui/%.o: $(UIDIR)/%.c + $(DO_UI_CC) + +$(B)/ui/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC) + $(DO_UI_Q3LCC) + +$(B)/ui/%.asm: $(UIDIR)/%.c $(Q3LCC) + $(DO_UI_Q3LCC) + +$(B)/11/ui/%.asm: $(UIDIR)/%.c $(Q3LCC) + $(DO_UI_Q3LCC_11) + + +$(B)/qcommon/%.o: $(CMDIR)/%.c + $(DO_SHLIB_CC) + +$(B)/qcommon/%.asm: $(CMDIR)/%.c $(Q3LCC) + $(DO_Q3LCC) + + +############################################################################# +# MISC +############################################################################# + +OBJ = $(GOBJ) $(CGOBJ) $(UIOBJ) $(CGOBJ11) $(UIOBJ11) \ + $(GVMOBJ) $(CGVMOBJ) $(UIVMOBJ) $(CGVMOBJ11) $(UIVMOBJ11) +TOOLSOBJ = $(LBURGOBJ) $(Q3CPPOBJ) $(Q3RCCOBJ) $(Q3LCCOBJ) $(Q3ASMOBJ) +STRINGOBJ = $(Q3R2STRINGOBJ) + +clean: clean-debug clean-release + @$(MAKE) -C $(MASTERDIR) clean + +clean-debug: + @$(MAKE) clean2 B=$(BD) + +clean-release: + @$(MAKE) clean2 B=$(BR) + +clean2: + @echo "CLEAN $(B)" + @rm -f $(OBJ) + @rm -f $(OBJ_D_FILES) + @rm -f $(STRINGOBJ) + @rm -f $(TARGETS) + +toolsclean: toolsclean-debug toolsclean-release + +toolsclean-debug: + @$(MAKE) toolsclean2 B=$(BD) + +toolsclean-release: + @$(MAKE) toolsclean2 B=$(BR) + +toolsclean2: + @echo "TOOLS_CLEAN $(B)" + @rm -f $(TOOLSOBJ) + @rm -f $(TOOLSOBJ_D_FILES) + @rm -f $(LBURG) $(DAGCHECK_C) $(Q3RCC) $(Q3CPP) $(Q3LCC) $(Q3ASM) + +distclean: clean toolsclean + @rm -rf $(BUILD_DIR) + +dist: + git archive --format zip --output $(CLIENTBIN)-$(VERSION).zip HEAD + +############################################################################# +# DEPENDENCIES +############################################################################# + +ifneq ($(B),) + OBJ_D_FILES=$(filter %.d,$(OBJ:%.o=%.d)) + TOOLSOBJ_D_FILES=$(filter %.d,$(TOOLSOBJ:%.o=%.d)) + -include $(OBJ_D_FILES) $(TOOLSOBJ_D_FILES) +endif + +.PHONY: all clean clean2 clean-debug clean-release copyfiles \ + debug default dist distclean makedirs \ + release targets \ + toolsclean toolsclean2 toolsclean-debug toolsclean-release \ + $(OBJ_D_FILES) $(TOOLSOBJ_D_FILES) + +# If the target name contains "clean", don't do a parallel build +ifneq ($(findstring clean, $(MAKECMDGOALS)),) +.NOTPARALLEL: +endif diff --git a/Makefile b/Makefile deleted file mode 100644 index 02a0643..0000000 --- a/Makefile +++ /dev/null @@ -1,1955 +0,0 @@ -# -# Tremulous Makefile -# -# GNU Make required -# - -COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]'|sed -e 's/\//_/g') - -COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/x86/) - -ifeq ($(COMPILE_PLATFORM),sunos) - # Solaris uname and GNU uname differ - COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/x86/) -endif -ifeq ($(COMPILE_PLATFORM),darwin) - # Apple does some things a little differently... - COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/x86/) -endif - -ifndef BUILD_STANDALONE - BUILD_STANDALONE = 0 -endif -ifndef BUILD_CLIENT - BUILD_CLIENT = 0 -endif -ifndef BUILD_CLIENT_SMP - BUILD_CLIENT_SMP = 0 -endif -ifndef BUILD_SERVER - BUILD_SERVER = 0 -endif -ifndef BUILD_GAME_SO - BUILD_GAME_SO = 0 -endif -ifndef BUILD_GAME_QVM - BUILD_GAME_QVM = 1 -endif -ifndef BUILD_MISSIONPACK - BUILD_MISSIONPACK= 0 -endif - -ifneq ($(PLATFORM),darwin) - BUILD_CLIENT_SMP = 0 -endif - -############################################################################# -# -# If you require a different configuration from the defaults below, create a -# new file named "Makefile.local" in the same directory as this file and define -# your parameters there. This allows you to change configuration without -# causing problems with keeping up to date with the repository. -# -############################################################################# --include Makefile.local - -ifndef PLATFORM -PLATFORM=$(COMPILE_PLATFORM) -endif -export PLATFORM - -ifeq ($(COMPILE_ARCH),powerpc) - COMPILE_ARCH=ppc -endif -ifeq ($(COMPILE_ARCH),powerpc64) - COMPILE_ARCH=ppc64 -endif - -ifndef ARCH -ARCH=$(COMPILE_ARCH) -endif -export ARCH - -ifneq ($(PLATFORM),$(COMPILE_PLATFORM)) - CROSS_COMPILING=1 -else - CROSS_COMPILING=0 - - ifneq ($(ARCH),$(COMPILE_ARCH)) - CROSS_COMPILING=1 - endif -endif -export CROSS_COMPILING - -ifndef COPYDIR -COPYDIR="/usr/local/games/tremulous" -endif - -ifndef COPYBINDIR -COPYBINDIR=$(COPYDIR) -endif - -ifndef MOUNT_DIR -MOUNT_DIR=src -endif - -ifndef BUILD_DIR -BUILD_DIR=build -endif - -ifndef TEMPDIR -TEMPDIR=/tmp -endif - -ifndef GENERATE_DEPENDENCIES -GENERATE_DEPENDENCIES=1 -endif - -ifndef USE_OPENAL -USE_OPENAL=1 -endif - -ifndef USE_OPENAL_DLOPEN -USE_OPENAL_DLOPEN=1 -endif - -ifndef USE_CURL -USE_CURL=1 -endif - -ifndef USE_CURL_DLOPEN - ifeq ($(PLATFORM),mingw32) - USE_CURL_DLOPEN=0 - else - USE_CURL_DLOPEN=1 - endif -endif - -ifndef USE_CODEC_VORBIS -USE_CODEC_VORBIS=0 -endif - -ifndef USE_MUMBLE -USE_MUMBLE=1 -endif - -ifndef USE_VOIP -USE_VOIP=0 -endif - -ifndef USE_INTERNAL_SPEEX -USE_INTERNAL_SPEEX=1 -endif - -ifndef USE_INTERNAL_ZLIB -USE_INTERNAL_ZLIB=1 -endif - -ifndef USE_INTERNAL_JPEG -USE_INTERNAL_JPEG=1 -endif - -ifndef USE_LOCAL_HEADERS -USE_LOCAL_HEADERS=1 -endif - -ifndef BUILD_MASTER_SERVER -BUILD_MASTER_SERVER=0 -endif - -ifndef DEBUG_CFLAGS -DEBUG_CFLAGS=-g -O0 -endif - -############################################################################# - -BD=$(BUILD_DIR)/debug-$(PLATFORM)-$(ARCH) -BR=$(BUILD_DIR)/release-$(PLATFORM)-$(ARCH) -CDIR=$(MOUNT_DIR)/client -SDIR=$(MOUNT_DIR)/server -RDIR=$(MOUNT_DIR)/renderer -CMDIR=$(MOUNT_DIR)/qcommon -SDLDIR=$(MOUNT_DIR)/sdl -ASMDIR=$(MOUNT_DIR)/asm -SYSDIR=$(MOUNT_DIR)/sys -GDIR=$(MOUNT_DIR)/game -CGDIR=$(MOUNT_DIR)/cgame -NDIR=$(MOUNT_DIR)/null -UIDIR=$(MOUNT_DIR)/ui -JPDIR=$(MOUNT_DIR)/jpeg-8c -SPEEXDIR=$(MOUNT_DIR)/libspeex -ZDIR=$(MOUNT_DIR)/zlib -Q3ASMDIR=$(MOUNT_DIR)/tools/asm -LBURGDIR=$(MOUNT_DIR)/tools/lcc/lburg -Q3CPPDIR=$(MOUNT_DIR)/tools/lcc/cpp -Q3LCCETCDIR=$(MOUNT_DIR)/tools/lcc/etc -Q3LCCSRCDIR=$(MOUNT_DIR)/tools/lcc/src -SDLHDIR=$(MOUNT_DIR)/SDL12 -LIBSDIR=$(MOUNT_DIR)/libs -MASTERDIR=$(MOUNT_DIR)/master -TEMPDIR=/tmp - -bin_path=$(shell which $(1) 2> /dev/null) - -# We won't need this if we only build the server -ifneq ($(BUILD_CLIENT),0) - # set PKG_CONFIG_PATH to influence this, e.g. - # PKG_CONFIG_PATH=/opt/cross/i386-mingw32msvc/lib/pkgconfig - ifneq ($(call bin_path, pkg-config),) - CURL_CFLAGS=$(shell pkg-config --silence-errors --cflags libcurl) - CURL_LIBS=$(shell pkg-config --silence-errors --libs libcurl) - OPENAL_CFLAGS=$(shell pkg-config --silence-errors --cflags openal) - OPENAL_LIBS=$(shell pkg-config --silence-errors --libs openal) - SDL_CFLAGS=$(shell pkg-config --silence-errors --cflags sdl|sed 's/-Dmain=SDL_main//') - SDL_LIBS=$(shell pkg-config --silence-errors --libs sdl) - endif - # Use sdl-config if all else fails - ifeq ($(SDL_CFLAGS),) - ifneq ($(call bin_path, sdl-config),) - SDL_CFLAGS=$(shell sdl-config --cflags) - SDL_LIBS=$(shell sdl-config --libs) - endif - endif -endif - -# version info -VERSION=gpp1 - -USE_SVN= -SVN_VERSION= -ifeq ($(wildcard .svn),.svn) - SVN_REV=$(shell LANG=C svnversion .) - ifneq ($(SVN_REV),) - VERSION:=$(VERSION)_SVN$(SVN_REV) - SVN_VERSION=svn$(SVN_REV) - USE_SVN=1 - endif -endif - - -############################################################################# -# SETUP AND BUILD -- LINUX -############################################################################# - -## Defaults -LIB=lib - -INSTALL=install -MKDIR=mkdir - -ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu")) - - ifeq ($(ARCH),axp) - ARCH=alpha - else - ifeq ($(ARCH),x86_64) - LIB=lib64 - else - ifeq ($(ARCH),ppc64) - LIB=lib64 - else - ifeq ($(ARCH),s390x) - LIB=lib64 - endif - endif - endif - endif - - BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ - -pipe -DUSE_ICON - CLIENT_CFLAGS = $(SDL_CFLAGS) - SERVER_CFLAGS = - - ifeq ($(USE_OPENAL),1) - CLIENT_CFLAGS += -DUSE_OPENAL - ifeq ($(USE_OPENAL_DLOPEN),1) - CLIENT_CFLAGS += -DUSE_OPENAL_DLOPEN - endif - endif - - ifeq ($(USE_CURL),1) - CLIENT_CFLAGS += -DUSE_CURL - ifeq ($(USE_CURL_DLOPEN),1) - CLIENT_CFLAGS += -DUSE_CURL_DLOPEN - endif - endif - - ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_CFLAGS += -DUSE_CODEC_VORBIS - endif - - OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer - OPTIMIZE = $(OPTIMIZEVM) -ffast-math - - ifeq ($(ARCH),x86_64) - OPTIMIZEVM = -O3 -fomit-frame-pointer -funroll-loops \ - -falign-loops=2 -falign-jumps=2 -falign-functions=2 \ - -fstrength-reduce - OPTIMIZE = $(OPTIMIZEVM) -ffast-math - HAVE_VM_COMPILED = true - else - ifeq ($(ARCH),x86) - OPTIMIZEVM = -O3 -march=i586 -fomit-frame-pointer \ - -funroll-loops -falign-loops=2 -falign-jumps=2 \ - -falign-functions=2 -fstrength-reduce - OPTIMIZE = $(OPTIMIZEVM) -ffast-math - HAVE_VM_COMPILED=true - else - ifeq ($(ARCH),ppc) - BASE_CFLAGS += -maltivec - HAVE_VM_COMPILED=true - endif - ifeq ($(ARCH),ppc64) - BASE_CFLAGS += -maltivec - HAVE_VM_COMPILED=true - endif - ifeq ($(ARCH),sparc) - OPTIMIZE += -mtune=ultrasparc3 -mv8plus - OPTIMIZEVM += -mtune=ultrasparc3 -mv8plus - HAVE_VM_COMPILED=true - endif - ifeq ($(ARCH),alpha) - # According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=410555 - # -ffast-math will cause the client to die with SIGFPE on Alpha - OPTIMIZE = $(OPTIMIZEVM) - endif - endif - endif - - ifneq ($(HAVE_VM_COMPILED),true) - BASE_CFLAGS += -DNO_VM_COMPILED - endif - - SHLIBEXT=so - SHLIBCFLAGS=-fPIC -fvisibility=hidden - SHLIBLDFLAGS=-shared $(LDFLAGS) - - THREAD_LIBS=-lpthread - LIBS=-ldl -lm - - CLIENT_LIBS=$(SDL_LIBS) -lGL - - ifeq ($(USE_OPENAL),1) - ifneq ($(USE_OPENAL_DLOPEN),1) - CLIENT_LIBS += -lopenal - endif - endif - - ifeq ($(USE_CURL),1) - ifneq ($(USE_CURL_DLOPEN),1) - CLIENT_LIBS += -lcurl - endif - endif - - ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_LIBS += -lvorbisfile -lvorbis -logg - endif - - ifeq ($(USE_MUMBLE),1) - CLIENT_LIBS += -lrt - endif - - ifeq ($(USE_LOCAL_HEADERS),1) - CLIENT_CFLAGS += -I$(SDLHDIR)/include - endif - - ifeq ($(ARCH),x86) - # linux32 make ... - BASE_CFLAGS += -m32 - else - ifeq ($(ARCH),ppc64) - BASE_CFLAGS += -m64 - endif - endif -else # ifeq Linux - -############################################################################# -# SETUP AND BUILD -- MAC OS X -############################################################################# - -ifeq ($(PLATFORM),darwin) - HAVE_VM_COMPILED=true - LIBS = -framework Cocoa - CLIENT_LIBS= - OPTIMIZEVM= - - BASE_CFLAGS = -Wall -Wimplicit -Wstrict-prototypes - CLIENT_CFLAGS = - SERVER_CFLAGS = - - ifeq ($(ARCH),ppc) - BASE_CFLAGS += -faltivec - OPTIMIZEVM += -O3 - endif - ifeq ($(ARCH),ppc64) - BASE_CFLAGS += -faltivec - endif - ifeq ($(ARCH),x86) - OPTIMIZEVM += -march=prescott -mfpmath=sse - # x86 vm will crash without -mstackrealign since MMX instructions will be - # used no matter what and they corrupt the frame pointer in VM calls - BASE_CFLAGS += -mstackrealign - endif - - BASE_CFLAGS += -fno-strict-aliasing -DMACOS_X -fno-common -pipe - - ifeq ($(USE_OPENAL),1) - BASE_CFLAGS += -DUSE_OPENAL - ifneq ($(USE_OPENAL_DLOPEN),1) - CLIENT_LIBS += -framework OpenAL - else - CLIENT_CFLAGS += -DUSE_OPENAL_DLOPEN - endif - endif - - ifeq ($(USE_CURL),1) - CLIENT_CFLAGS += -DUSE_CURL - ifneq ($(USE_CURL_DLOPEN),1) - CLIENT_LIBS += -lcurl - else - CLIENT_CFLAGS += -DUSE_CURL_DLOPEN - endif - endif - - ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_CFLAGS += -DUSE_CODEC_VORBIS - CLIENT_LIBS += -lvorbisfile -lvorbis -logg - endif - - BASE_CFLAGS += -D_THREAD_SAFE=1 - - ifeq ($(USE_LOCAL_HEADERS),1) - BASE_CFLAGS += -I$(SDLHDIR)/include - endif - - # We copy sdlmain before ranlib'ing it so that subversion doesn't think - # the file has been modified by each build. - LIBSDLMAIN=$(B)/libSDLmain.a - LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDLmain.a - CLIENT_LIBS += -framework IOKit -framework OpenGL \ - $(LIBSDIR)/macosx/libSDL-1.2.0.dylib - - OPTIMIZEVM += -falign-loops=16 - OPTIMIZE = $(OPTIMIZEVM) -ffast-math - - ifneq ($(HAVE_VM_COMPILED),true) - BASE_CFLAGS += -DNO_VM_COMPILED - endif - - SHLIBEXT=dylib - SHLIBCFLAGS=-fPIC -fno-common - SHLIBLDFLAGS=-dynamiclib $(LDFLAGS) - - NOTSHLIBCFLAGS=-mdynamic-no-pic - - TOOLS_CFLAGS += -DMACOS_X - -else # ifeq darwin - - -############################################################################# -# SETUP AND BUILD -- MINGW32 -############################################################################# - -ifeq ($(PLATFORM),mingw32) - - # Some MinGW installations define CC to cc, but don't actually provide cc, - # so explicitly use gcc instead (which is the only option anyway) - ifeq ($(call bin_path, $(CC)),) - CC=gcc - endif - - ifndef WINDRES - WINDRES=windres - endif - - BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ - -DUSE_ICON - CLIENT_CFLAGS = - SERVER_CFLAGS = - - # In the absence of wspiapi.h, require Windows XP or later - ifeq ($(shell test -e $(CMDIR)/wspiapi.h; echo $$?),1) - BASE_CFLAGS += -DWINVER=0x501 - endif - - ifeq ($(USE_OPENAL),1) - CLIENT_CFLAGS += -DUSE_OPENAL - CLIENT_CFLAGS += $(OPENAL_CFLAGS) - ifeq ($(USE_OPENAL_DLOPEN),1) - CLIENT_CFLAGS += -DUSE_OPENAL_DLOPEN - else - CLIENT_LDFLAGS += $(OPENAL_LDFLAGS) - endif - endif - - ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_CFLAGS += -DUSE_CODEC_VORBIS - endif - - ifeq ($(ARCH),x64) - OPTIMIZEVM = -O3 -fno-omit-frame-pointer \ - -falign-loops=2 -funroll-loops -falign-jumps=2 -falign-functions=2 \ - -fstrength-reduce - OPTIMIZE = $(OPTIMIZEVM) --fast-math - HAVE_VM_COMPILED = true - endif - ifeq ($(ARCH),x86) - OPTIMIZEVM = -O3 -march=i586 -fno-omit-frame-pointer \ - -falign-loops=2 -funroll-loops -falign-jumps=2 -falign-functions=2 \ - -fstrength-reduce - OPTIMIZE = $(OPTIMIZEVM) -ffast-math - HAVE_VM_COMPILED = true - endif - - SHLIBEXT=dll - SHLIBCFLAGS= - SHLIBLDFLAGS=-shared $(LDFLAGS) - - BINEXT=.exe - - LIBS= -lws2_32 -lwinmm -lpsapi - CLIENT_LDFLAGS = -mwindows - CLIENT_LIBS = -lgdi32 -lole32 -lopengl32 - - ifeq ($(USE_CURL),1) - CLIENT_CFLAGS += -DUSE_CURL - CLIENT_CFLAGS += $(CURL_CFLAGS) - ifneq ($(USE_CURL_DLOPEN),1) - ifeq ($(USE_LOCAL_HEADERS),1) - CLIENT_CFLAGS += -DCURL_STATICLIB - ifeq ($(ARCH),x64) - CLIENT_LIBS += $(LIBSDIR)/win64/libcurl.a - else - CLIENT_LIBS += $(LIBSDIR)/win32/libcurl.a - endif - else - CLIENT_LIBS += $(CURL_LIBS) - endif - endif - endif - - ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_LIBS += -lvorbisfile -lvorbis -logg - endif - - ifeq ($(ARCH),x86) - # build 32bit - BASE_CFLAGS += -m32 - else - BASE_CFLAGS += -m64 - endif - - # libmingw32 must be linked before libSDLmain - CLIENT_LIBS += -lmingw32 - ifeq ($(USE_LOCAL_HEADERS),1) - CLIENT_CFLAGS += -I$(SDLHDIR)/include - ifeq ($(ARCH), x86) - CLIENT_LIBS += $(LIBSDIR)/win32/libSDLmain.a \ - $(LIBSDIR)/win32/libSDL.dll.a - else - CLIENT_LIBS += $(LIBSDIR)/win64/libSDLmain.a \ - $(LIBSDIR)/win64/libSDL.dll.a \ - $(LIBSDIR)/win64/libSDL.a - endif - else - CLIENT_CFLAGS += $(SDL_CFLAGS) - CLIENT_LIBS += $(SDL_LIBS) - endif - - BUILD_CLIENT_SMP = 0 - -else # ifeq mingw32 - -############################################################################# -# SETUP AND BUILD -- FREEBSD -############################################################################# - -ifeq ($(PLATFORM),freebsd) - - # flags - BASE_CFLAGS = $(shell env MACHINE_ARCH=$(ARCH) make -f /dev/null -VCFLAGS) \ - -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ - -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON - CLIENT_CFLAGS = $(SDL_CFLAGS) - SERVER_CFLAGS = - HAVE_VM_COMPILED = true - - OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer - OPTIMIZE = $(OPTIMIZEVM) -ffast-math - - SHLIBEXT=so - SHLIBCFLAGS=-fPIC - SHLIBLDFLAGS=-shared $(LDFLAGS) - - THREAD_LIBS=-lpthread - # don't need -ldl (FreeBSD) - LIBS=-lm - - CLIENT_LIBS = - - CLIENT_LIBS += $(SDL_LIBS) -lGL - - # optional features/libraries - ifeq ($(USE_OPENAL),1) - CLIENT_CFLAGS += -DUSE_OPENAL - ifeq ($(USE_OPENAL_DLOPEN),1) - CLIENT_CFLAGS += -DUSE_OPENAL_DLOPEN - CLIENT_LIBS += $(THREAD_LIBS) -lopenal - endif - endif - - ifeq ($(USE_CURL),1) - CLIENT_CFLAGS += -DUSE_CURL - ifeq ($(USE_CURL_DLOPEN),1) - CLIENT_CFLAGS += -DUSE_CURL_DLOPEN - CLIENT_LIBS += -lcurl - endif - endif - - ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_CFLAGS += -DUSE_CODEC_VORBIS - endif - - ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_LIBS += -lvorbisfile -lvorbis -logg - endif - - # cross-compiling tweaks - ifeq ($(ARCH),i386) - ifeq ($(CROSS_COMPILING),1) - BASE_CFLAGS += -m32 - endif - endif - ifeq ($(ARCH),amd64) - ifeq ($(CROSS_COMPILING),1) - BASE_CFLAGS += -m64 - endif - endif - -else # ifeq freebsd - -############################################################################# -# SETUP AND BUILD -- OPENBSD -############################################################################# - -ifeq ($(PLATFORM),openbsd) - - #default to i386, no tests done on anything else - ARCH=i386 - - BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ - -DUSE_ICON - CLIENT_CFLAGS = $(SDL_CFLAGS) - SERVER_CFLAGS = - - ifeq ($(USE_OPENAL),1) - CLIENT_CFLAGS += -DUSE_OPENAL - ifeq ($(USE_OPENAL_DLOPEN),1) - CLIENT_CFLAGS += -DUSE_OPENAL_DLOPEN - endif - endif - - ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_CFLAGS += -DUSE_CODEC_VORBIS - endif - - ifeq ($(USE_CURL),1) - CLIENT_CFLAGS += -DUSE_CURL $(CURL_CFLAGS) - USE_CURL_DLOPEN=0 - endif - - BASE_CFLAGS += -DNO_VM_COMPILED - HAVE_VM_COMPILED=false - - SHLIBEXT=so - SHLIBNAME=.$(SHLIBEXT) - SHLIBCFLAGS=-fPIC - SHLIBLDFLAGS=-shared $(LDFLAGS) - - THREAD_LIBS=-pthread - LIBS=-lm - - CLIENT_LIBS = - - CLIENT_LIBS += $(SDL_LIBS) -lGL - - ifeq ($(USE_OPENAL),1) - ifneq ($(USE_OPENAL_DLOPEN),1) - CLIENT_LIBS += $(THREAD_LIBS) -lossaudio -lopenal - endif - endif - - ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_LIBS += -lvorbisfile -lvorbis -logg - endif - - ifeq ($(USE_CURL),1) - ifneq ($(USE_CURL_DLOPEN),1) - CLIENT_LIBS += -lcurl - endif - endif - -else # ifeq openbsd - -############################################################################# -# SETUP AND BUILD -- NETBSD -############################################################################# - -ifeq ($(PLATFORM),netbsd) - - ifeq ($(shell uname -m),i386) - ARCH=x86 - endif - - LIBS=-lm - SHLIBEXT=so - SHLIBCFLAGS=-fPIC - SHLIBLDFLAGS=-shared $(LDFLAGS) - THREAD_LIBS=-lpthread - - BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes - CLIENT_CFLAGS = - SERVER_CFLAGS = - - ifneq ($(ARCH),x86) - BASE_CFLAGS += -DNO_VM_COMPILED - endif - - BUILD_CLIENT = 0 - BUILD_GAME_QVM = 0 - -else # ifeq netbsd - -############################################################################# -# SETUP AND BUILD -- IRIX -############################################################################# - -ifeq ($(PLATFORM),irix64) - - ARCH=mips #default to MIPS - - CC = c99 - MKDIR = mkdir -p - - BASE_CFLAGS=-Dstricmp=strcasecmp -Xcpluscomm -woff 1185 \ - -I. -I$(ROOT)/usr/include -DNO_VM_COMPILED - CLIENT_CFLAGS = $(SDL_CFLAGS) - OPTIMIZE = -O3 - - SHLIBEXT=so - SHLIBCFLAGS= - SHLIBLDFLAGS=-shared - - LIBS=-ldl -lm -lgen - # FIXME: The X libraries probably aren't necessary? - CLIENT_LIBS=-L/usr/X11/$(LIB) $(SDL_LIBS) -lGL \ - -lX11 -lXext -lm - -else # ifeq IRIX - -############################################################################# -# SETUP AND BUILD -- SunOS -############################################################################# - -ifeq ($(PLATFORM),sunos) - - CC=gcc - INSTALL=ginstall - MKDIR=gmkdir - COPYDIR="/usr/local/share/games/tremulous" - - ifneq (,$(findstring i86pc,$(shell uname -m))) - ARCH=x86 - else #default to sparc - ARCH=sparc - endif - - ifneq ($(ARCH),x86) - ifneq ($(ARCH),sparc) - $(error arch $(ARCH) is currently not supported) - endif - endif - - BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ - -pipe -DUSE_ICON - CLIENT_CFLAGS = $(SDL_CFLAGS) - SERVER_CFLAGS = - - OPTIMIZEVM = -O3 -funroll-loops - - ifeq ($(ARCH),sparc) - OPTIMIZEVM += -O3 \ - -fstrength-reduce -falign-functions=2 \ - -mtune=ultrasparc3 -mv8plus -mno-faster-structs - HAVE_VM_COMPILED=true - else - ifeq ($(ARCH),x86) - OPTIMIZEVM += -march=i586 -fomit-frame-pointer \ - -falign-loops=2 -falign-jumps=2 \ - -falign-functions=2 -fstrength-reduce - HAVE_VM_COMPILED=true - BASE_CFLAGS += -m32 - CLIENT_CFLAGS += -I/usr/X11/include/NVIDIA - CLIENT_LDFLAGS += -L/usr/X11/lib/NVIDIA -R/usr/X11/lib/NVIDIA - endif - endif - - OPTIMIZE = $(OPTIMIZEVM) -ffast-math - - ifneq ($(HAVE_VM_COMPILED),true) - BASE_CFLAGS += -DNO_VM_COMPILED - endif - - SHLIBEXT=so - SHLIBCFLAGS=-fPIC - SHLIBLDFLAGS=-shared $(LDFLAGS) - - THREAD_LIBS=-lpthread - LIBS=-lsocket -lnsl -ldl -lm - - BOTCFLAGS=-O0 - - CLIENT_LIBS +=$(SDL_LIBS) -lGL -lX11 -lXext -liconv -lm - -else # ifeq sunos - -############################################################################# -# SETUP AND BUILD -- GENERIC -############################################################################# - BASE_CFLAGS=-DNO_VM_COMPILED - OPTIMIZE = -O3 - - SHLIBEXT=so - SHLIBCFLAGS=-fPIC - SHLIBLDFLAGS=-shared - -endif #Linux -endif #darwin -endif #mingw32 -endif #FreeBSD -endif #OpenBSD -endif #NetBSD -endif #IRIX -endif #SunOS - -TARGETS = - -ifndef FULLBINEXT - FULLBINEXT=.$(ARCH)$(BINEXT) -endif - -ifndef SHLIBNAME - SHLIBNAME=$(ARCH).$(SHLIBEXT) -endif - -ifneq ($(BUILD_SERVER),0) - TARGETS += $(B)/tremded$(FULLBINEXT) -endif - -ifneq ($(BUILD_CLIENT),0) - TARGETS += $(B)/tremulous$(FULLBINEXT) - ifneq ($(BUILD_CLIENT_SMP),0) - TARGETS += $(B)/tremulous-smp$(FULLBINEXT) - endif -endif - -ifneq ($(BUILD_GAME_SO),0) - TARGETS += \ - $(B)/base/cgame$(SHLIBNAME) \ - $(B)/base/game$(SHLIBNAME) \ - $(B)/base/ui$(SHLIBNAME) -endif - -ifneq ($(BUILD_GAME_QVM),0) - ifneq ($(CROSS_COMPILING),1) - TARGETS += \ - $(B)/base/vm/cgame.qvm \ - $(B)/base/vm/game.qvm \ - $(B)/base/vm/ui.qvm - endif -endif - -ifeq ($(USE_MUMBLE),1) - CLIENT_CFLAGS += -DUSE_MUMBLE -endif - -ifeq ($(USE_VOIP),1) - CLIENT_CFLAGS += -DUSE_VOIP - SERVER_CFLAGS += -DUSE_VOIP - ifeq ($(USE_INTERNAL_SPEEX),1) - CLIENT_CFLAGS += -DFLOATING_POINT -DUSE_ALLOCA -I$(SPEEXDIR)/include - else - CLIENT_LIBS += -lspeex -lspeexdsp - endif -endif - -ifeq ($(USE_INTERNAL_ZLIB),1) - BASE_CFLAGS += -DNO_GZIP - BASE_CFLAGS += -I$(ZDIR) -else - LIBS += -lz -endif - -ifeq ($(USE_INTERNAL_JPEG),1) - BASE_CFLAGS += -DUSE_INTERNAL_JPEG - BASE_CFLAGS += -I$(JPDIR) -else - CLIENT_LIBS += -ljpeg -endif - -ifdef DEFAULT_BASEDIR - BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\" -endif - -ifeq ($(USE_LOCAL_HEADERS),1) - BASE_CFLAGS += -DUSE_LOCAL_HEADERS -endif - -ifeq ($(BUILD_STANDALONE),1) - BASE_CFLAGS += -DSTANDALONE -endif - -ifeq ($(GENERATE_DEPENDENCIES),1) - DEPEND_CFLAGS = -MMD -else - DEPEND_CFLAGS = -endif - -ifeq ($(NO_STRIP),1) - STRIP_FLAG = -else - STRIP_FLAG = -s -endif - -BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\" -BASE_CFLAGS += -DSVN_VERSION=\\\"$(SVN_VERSION)\\\" - -ifeq ($(V),1) -echo_cmd=@: -Q= -else -echo_cmd=@echo -Q=@ -endif - -define DO_CC -$(echo_cmd) "CC $<" -$(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) -o $@ -c $< -endef - -define DO_SMP_CC -$(echo_cmd) "SMP_CC $<" -$(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) -DSMP -o $@ -c $< -endef - -ifeq ($(GENERATE_DEPENDENCIES),1) - DO_QVM_DEP=cat $(@:%.o=%.d) | sed -e 's/\.o/\.asm/g' >> $(@:%.o=%.d) -endif - -define DO_SHLIB_CC -$(echo_cmd) "SHLIB_CC $<" -$(Q)$(CC) $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< -$(Q)$(DO_QVM_DEP) -endef - -define DO_GAME_CC -$(echo_cmd) "GAME_CC $<" -$(Q)$(CC) -DGAME $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< -$(Q)$(DO_QVM_DEP) -endef - -define DO_CGAME_CC -$(echo_cmd) "CGAME_CC $<" -$(Q)$(CC) -DCGAME $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< -$(Q)$(DO_QVM_DEP) -endef - -define DO_UI_CC -$(echo_cmd) "UI_CC $<" -$(Q)$(CC) -DUI $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< -$(Q)$(DO_QVM_DEP) -endef - -define DO_AS -$(echo_cmd) "AS $<" -$(Q)$(CC) $(CFLAGS) $(OPTIMIZE) -x assembler-with-cpp -o $@ -c $< -endef - -define DO_DED_CC -$(echo_cmd) "DED_CC $<" -$(Q)$(CC) $(NOTSHLIBCFLAGS) -DDEDICATED $(CFLAGS) $(SERVER_CFLAGS) $(OPTIMIZE) -o $@ -c $< -endef - -define DO_WINDRES -$(echo_cmd) "WINDRES $<" -$(Q)$(WINDRES) -i $< -o $@ -endef - - -############################################################################# -# MAIN TARGETS -############################################################################# - -default: release -all: debug release - -debug: - @$(MAKE) targets B=$(BD) CFLAGS="$(CFLAGS) $(BASE_CFLAGS) $(DEPEND_CFLAGS)" \ - OPTIMIZE="$(DEBUG_CFLAGS)" OPTIMIZEVM="$(DEBUG_CFLAGS)" \ - CLIENT_CFLAGS="$(CLIENT_CFLAGS)" SERVER_CFLAGS="$(SERVER_CFLAGS)" V=$(V) -ifeq ($(BUILD_MASTER_SERVER),1) - $(MAKE) -C $(MASTERDIR) debug -endif - -release: - @$(MAKE) targets B=$(BR) CFLAGS="$(CFLAGS) $(BASE_CFLAGS) $(DEPEND_CFLAGS)" \ - OPTIMIZE="-DNDEBUG $(OPTIMIZE)" OPTIMIZEVM="-DNDEBUG $(OPTIMIZEVM)" \ - CLIENT_CFLAGS="$(CLIENT_CFLAGS)" SERVER_CFLAGS="$(SERVER_CFLAGS)" V=$(V) -ifeq ($(BUILD_MASTER_SERVER),1) - $(MAKE) -C $(MASTERDIR) release -endif - -# Create the build directories, check libraries and print out -# an informational message, then start building -targets: makedirs - @echo "" - @echo "Building Tremulous in $(B):" - @echo " PLATFORM: $(PLATFORM)" - @echo " ARCH: $(ARCH)" - @echo " VERSION: $(VERSION)" - @echo " COMPILE_PLATFORM: $(COMPILE_PLATFORM)" - @echo " COMPILE_ARCH: $(COMPILE_ARCH)" - @echo " CC: $(CC)" - @echo "" - @echo " CFLAGS:" - -@for i in $(CFLAGS); \ - do \ - echo " $$i"; \ - done - -@for i in $(OPTIMIZE); \ - do \ - echo " $$i"; \ - done - @echo "" - @echo " CLIENT_CFLAGS:" - -@for i in $(CLIENT_CFLAGS); \ - do \ - echo " $$i"; \ - done - @echo "" - @echo " SERVER_CFLAGS:" - -@for i in $(SERVER_CFLAGS); \ - do \ - echo " $$i"; \ - done - @echo "" - @echo " LDFLAGS:" - -@for i in $(LDFLAGS); \ - do \ - echo " $$i"; \ - done - @echo "" - @echo " LIBS:" - -@for i in $(LIBS); \ - do \ - echo " $$i"; \ - done - @echo "" - @echo " CLIENT_LIBS:" - -@for i in $(CLIENT_LIBS); \ - do \ - echo " $$i"; \ - done - @echo "" - @echo " Output:" - -@for i in $(TARGETS); \ - do \ - echo " $$i"; \ - done - @echo "" -ifneq ($(TARGETS),) - @$(MAKE) $(TARGETS) V=$(V) -endif - -makedirs: - @if [ ! -d $(BUILD_DIR) ];then $(MKDIR) $(BUILD_DIR);fi - @if [ ! -d $(B) ];then $(MKDIR) $(B);fi - @if [ ! -d $(B)/client ];then $(MKDIR) $(B)/client;fi - @if [ ! -d $(B)/clientsmp ];then $(MKDIR) $(B)/clientsmp;fi - @if [ ! -d $(B)/ded ];then $(MKDIR) $(B)/ded;fi - @if [ ! -d $(B)/base ];then $(MKDIR) $(B)/base;fi - @if [ ! -d $(B)/base/cgame ];then $(MKDIR) $(B)/base/cgame;fi - @if [ ! -d $(B)/base/game ];then $(MKDIR) $(B)/base/game;fi - @if [ ! -d $(B)/base/ui ];then $(MKDIR) $(B)/base/ui;fi - @if [ ! -d $(B)/base/qcommon ];then $(MKDIR) $(B)/base/qcommon;fi - @if [ ! -d $(B)/base/vm ];then $(MKDIR) $(B)/base/vm;fi - @if [ ! -d $(B)/tools ];then $(MKDIR) $(B)/tools;fi - @if [ ! -d $(B)/tools/asm ];then $(MKDIR) $(B)/tools/asm;fi - @if [ ! -d $(B)/tools/etc ];then $(MKDIR) $(B)/tools/etc;fi - @if [ ! -d $(B)/tools/rcc ];then $(MKDIR) $(B)/tools/rcc;fi - @if [ ! -d $(B)/tools/cpp ];then $(MKDIR) $(B)/tools/cpp;fi - @if [ ! -d $(B)/tools/lburg ];then $(MKDIR) $(B)/tools/lburg;fi - -############################################################################# -# QVM BUILD TOOLS -############################################################################# - -TOOLS_OPTIMIZE = -g -Wall -fno-strict-aliasing -TOOLS_CFLAGS += $(TOOLS_OPTIMIZE) \ - -DTEMPDIR=\"$(TEMPDIR)\" -DSYSTEM=\"\" \ - -I$(Q3LCCSRCDIR) \ - -I$(LBURGDIR) -TOOLS_LIBS = -TOOLS_LDFLAGS = - -ifeq ($(GENERATE_DEPENDENCIES),1) - TOOLS_CFLAGS += -MMD -endif - -define DO_TOOLS_CC -$(echo_cmd) "TOOLS_CC $<" -$(Q)$(CC) $(TOOLS_CFLAGS) -o $@ -c $< -endef - -define DO_TOOLS_CC_DAGCHECK -$(echo_cmd) "TOOLS_CC_DAGCHECK $<" -$(Q)$(CC) $(TOOLS_CFLAGS) -Wno-unused -o $@ -c $< -endef - -LBURG = $(B)/tools/lburg/lburg$(BINEXT) -DAGCHECK_C = $(B)/tools/rcc/dagcheck.c -Q3RCC = $(B)/tools/q3rcc$(BINEXT) -Q3CPP = $(B)/tools/q3cpp$(BINEXT) -Q3LCC = $(B)/tools/q3lcc$(BINEXT) -Q3ASM = $(B)/tools/q3asm$(BINEXT) - -LBURGOBJ= \ - $(B)/tools/lburg/lburg.o \ - $(B)/tools/lburg/gram.o - -$(B)/tools/lburg/%.o: $(LBURGDIR)/%.c - $(DO_TOOLS_CC) - -$(LBURG): $(LBURGOBJ) - $(echo_cmd) "LD $@" - $(Q)$(CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $^ $(TOOLS_LIBS) - -Q3RCCOBJ = \ - $(B)/tools/rcc/alloc.o \ - $(B)/tools/rcc/bind.o \ - $(B)/tools/rcc/bytecode.o \ - $(B)/tools/rcc/dag.o \ - $(B)/tools/rcc/dagcheck.o \ - $(B)/tools/rcc/decl.o \ - $(B)/tools/rcc/enode.o \ - $(B)/tools/rcc/error.o \ - $(B)/tools/rcc/event.o \ - $(B)/tools/rcc/expr.o \ - $(B)/tools/rcc/gen.o \ - $(B)/tools/rcc/init.o \ - $(B)/tools/rcc/inits.o \ - $(B)/tools/rcc/input.o \ - $(B)/tools/rcc/lex.o \ - $(B)/tools/rcc/list.o \ - $(B)/tools/rcc/main.o \ - $(B)/tools/rcc/null.o \ - $(B)/tools/rcc/output.o \ - $(B)/tools/rcc/prof.o \ - $(B)/tools/rcc/profio.o \ - $(B)/tools/rcc/simp.o \ - $(B)/tools/rcc/stmt.o \ - $(B)/tools/rcc/string.o \ - $(B)/tools/rcc/sym.o \ - $(B)/tools/rcc/symbolic.o \ - $(B)/tools/rcc/trace.o \ - $(B)/tools/rcc/tree.o \ - $(B)/tools/rcc/types.o - -$(DAGCHECK_C): $(LBURG) $(Q3LCCSRCDIR)/dagcheck.md - $(echo_cmd) "LBURG $(Q3LCCSRCDIR)/dagcheck.md" - $(Q)$(LBURG) $(Q3LCCSRCDIR)/dagcheck.md $@ - -$(B)/tools/rcc/dagcheck.o: $(DAGCHECK_C) - $(DO_TOOLS_CC_DAGCHECK) - -$(B)/tools/rcc/%.o: $(Q3LCCSRCDIR)/%.c - $(DO_TOOLS_CC) - -$(Q3RCC): $(Q3RCCOBJ) - $(echo_cmd) "LD $@" - $(Q)$(CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $^ $(TOOLS_LIBS) - -Q3CPPOBJ = \ - $(B)/tools/cpp/cpp.o \ - $(B)/tools/cpp/lex.o \ - $(B)/tools/cpp/nlist.o \ - $(B)/tools/cpp/tokens.o \ - $(B)/tools/cpp/macro.o \ - $(B)/tools/cpp/eval.o \ - $(B)/tools/cpp/include.o \ - $(B)/tools/cpp/hideset.o \ - $(B)/tools/cpp/getopt.o \ - $(B)/tools/cpp/unix.o - -$(B)/tools/cpp/%.o: $(Q3CPPDIR)/%.c - $(DO_TOOLS_CC) - -$(Q3CPP): $(Q3CPPOBJ) - $(echo_cmd) "LD $@" - $(Q)$(CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $^ $(TOOLS_LIBS) - -Q3LCCOBJ = \ - $(B)/tools/etc/lcc.o \ - $(B)/tools/etc/bytecode.o - -$(B)/tools/etc/%.o: $(Q3LCCETCDIR)/%.c - $(DO_TOOLS_CC) - -$(Q3LCC): $(Q3LCCOBJ) $(Q3RCC) $(Q3CPP) - $(echo_cmd) "LD $@" - $(Q)$(CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $(Q3LCCOBJ) $(TOOLS_LIBS) - -define DO_Q3LCC -$(echo_cmd) "Q3LCC $<" -$(Q)$(Q3LCC) -o $@ $< -endef - -define DO_CGAME_Q3LCC -$(echo_cmd) "CGAME_Q3LCC $<" -$(Q)$(Q3LCC) -DPRODUCT_VERSION=\"$(VERSION)\" -DCGAME -DSVN_VERSION=\"$(SVN_VERSION)\" -o $@ $< -endef - -define DO_GAME_Q3LCC -$(echo_cmd) "GAME_Q3LCC $<" -$(Q)$(Q3LCC) -DPRODUCT_VERSION=\"$(VERSION)\" -DGAME -DSVN_VERSION=\"$(SVN_VERSION)\" -o $@ $< -endef - -define DO_UI_Q3LCC -$(echo_cmd) "UI_Q3LCC $<" -$(Q)$(Q3LCC) -DPRODUCT_VERSION=\"$(VERSION)\" -DUI -DSVN_VERSION=\"$(SVN_VERSION)\" -o $@ $< -endef - - -Q3ASMOBJ = \ - $(B)/tools/asm/q3asm.o \ - $(B)/tools/asm/cmdlib.o - -$(B)/tools/asm/%.o: $(Q3ASMDIR)/%.c - $(DO_TOOLS_CC) - -$(Q3ASM): $(Q3ASMOBJ) - $(echo_cmd) "LD $@" - $(Q)$(CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $^ $(TOOLS_LIBS) - - -############################################################################# -# CLIENT/SERVER -############################################################################# - -Q3OBJ = \ - $(B)/client/cl_cgame.o \ - $(B)/client/cl_cin.o \ - $(B)/client/cl_console.o \ - $(B)/client/cl_input.o \ - $(B)/client/cl_keys.o \ - $(B)/client/cl_main.o \ - $(B)/client/cl_net_chan.o \ - $(B)/client/cl_parse.o \ - $(B)/client/cl_scrn.o \ - $(B)/client/cl_ui.o \ - $(B)/client/cl_avi.o \ - \ - $(B)/client/cm_load.o \ - $(B)/client/cm_patch.o \ - $(B)/client/cm_polylib.o \ - $(B)/client/cm_test.o \ - $(B)/client/cm_trace.o \ - \ - $(B)/client/cmd.o \ - $(B)/client/common.o \ - $(B)/client/cvar.o \ - $(B)/client/files.o \ - $(B)/client/md4.o \ - $(B)/client/md5.o \ - $(B)/client/msg.o \ - $(B)/client/net_chan.o \ - $(B)/client/net_ip.o \ - $(B)/client/huffman.o \ - $(B)/client/parse.o \ - \ - $(B)/client/snd_adpcm.o \ - $(B)/client/snd_dma.o \ - $(B)/client/snd_mem.o \ - $(B)/client/snd_mix.o \ - $(B)/client/snd_wavelet.o \ - \ - $(B)/client/snd_main.o \ - $(B)/client/snd_codec.o \ - $(B)/client/snd_codec_wav.o \ - $(B)/client/snd_codec_ogg.o \ - \ - $(B)/client/qal.o \ - $(B)/client/snd_openal.o \ - \ - $(B)/client/cl_curl.o \ - \ - $(B)/client/sv_ccmds.o \ - $(B)/client/sv_client.o \ - $(B)/client/sv_game.o \ - $(B)/client/sv_init.o \ - $(B)/client/sv_main.o \ - $(B)/client/sv_net_chan.o \ - $(B)/client/sv_snapshot.o \ - $(B)/client/sv_world.o \ - \ - $(B)/client/q_math.o \ - $(B)/client/q_shared.o \ - \ - $(B)/client/unzip.o \ - $(B)/client/ioapi.o \ - $(B)/client/puff.o \ - $(B)/client/vm.o \ - $(B)/client/vm_interpreted.o \ - \ - $(B)/client/tr_animation.o \ - $(B)/client/tr_backend.o \ - $(B)/client/tr_bsp.o \ - $(B)/client/tr_cmds.o \ - $(B)/client/tr_curve.o \ - $(B)/client/tr_flares.o \ - $(B)/client/tr_font.o \ - $(B)/client/tr_image.o \ - $(B)/client/tr_image_png.o \ - $(B)/client/tr_image_jpg.o \ - $(B)/client/tr_image_bmp.o \ - $(B)/client/tr_image_tga.o \ - $(B)/client/tr_image_pcx.o \ - $(B)/client/tr_init.o \ - $(B)/client/tr_light.o \ - $(B)/client/tr_main.o \ - $(B)/client/tr_marks.o \ - $(B)/client/tr_mesh.o \ - $(B)/client/tr_model.o \ - $(B)/client/tr_noise.o \ - $(B)/client/tr_scene.o \ - $(B)/client/tr_shade.o \ - $(B)/client/tr_shade_calc.o \ - $(B)/client/tr_shader.o \ - $(B)/client/tr_shadows.o \ - $(B)/client/tr_sky.o \ - $(B)/client/tr_surface.o \ - $(B)/client/tr_world.o \ - \ - $(B)/client/sdl_gamma.o \ - $(B)/client/sdl_input.o \ - $(B)/client/sdl_snd.o \ - \ - $(B)/client/con_passive.o \ - $(B)/client/con_log.o \ - $(B)/client/sys_main.o - -ifneq ($(USE_INTERNAL_JPEG),0) - Q3OBJ += \ - $(B)/client/jaricom.o \ - $(B)/client/jcapimin.o \ - $(B)/client/jcapistd.o \ - $(B)/client/jcarith.o \ - $(B)/client/jccoefct.o \ - $(B)/client/jccolor.o \ - $(B)/client/jcdctmgr.o \ - $(B)/client/jchuff.o \ - $(B)/client/jcinit.o \ - $(B)/client/jcmainct.o \ - $(B)/client/jcmarker.o \ - $(B)/client/jcmaster.o \ - $(B)/client/jcomapi.o \ - $(B)/client/jcparam.o \ - $(B)/client/jcprepct.o \ - $(B)/client/jcsample.o \ - $(B)/client/jctrans.o \ - $(B)/client/jdapimin.o \ - $(B)/client/jdapistd.o \ - $(B)/client/jdarith.o \ - $(B)/client/jdatadst.o \ - $(B)/client/jdatasrc.o \ - $(B)/client/jdcoefct.o \ - $(B)/client/jdcolor.o \ - $(B)/client/jddctmgr.o \ - $(B)/client/jdhuff.o \ - $(B)/client/jdinput.o \ - $(B)/client/jdmainct.o \ - $(B)/client/jdmarker.o \ - $(B)/client/jdmaster.o \ - $(B)/client/jdmerge.o \ - $(B)/client/jdpostct.o \ - $(B)/client/jdsample.o \ - $(B)/client/jdtrans.o \ - $(B)/client/jerror.o \ - $(B)/client/jfdctflt.o \ - $(B)/client/jfdctfst.o \ - $(B)/client/jfdctint.o \ - $(B)/client/jidctflt.o \ - $(B)/client/jidctfst.o \ - $(B)/client/jidctint.o \ - $(B)/client/jmemmgr.o \ - $(B)/client/jmemnobs.o \ - $(B)/client/jquant1.o \ - $(B)/client/jquant2.o \ - $(B)/client/jutils.o -endif - -ifeq ($(ARCH),x86) - Q3OBJ += \ - $(B)/client/snd_mixa.o \ - $(B)/client/matha.o \ - $(B)/client/ftola.o \ - $(B)/client/snapvectora.o -endif - -ifeq ($(USE_VOIP),1) -ifeq ($(USE_INTERNAL_SPEEX),1) -Q3OBJ += \ - $(B)/client/bits.o \ - $(B)/client/buffer.o \ - $(B)/client/cb_search.o \ - $(B)/client/exc_10_16_table.o \ - $(B)/client/exc_10_32_table.o \ - $(B)/client/exc_20_32_table.o \ - $(B)/client/exc_5_256_table.o \ - $(B)/client/exc_5_64_table.o \ - $(B)/client/exc_8_128_table.o \ - $(B)/client/fftwrap.o \ - $(B)/client/filterbank.o \ - $(B)/client/filters.o \ - $(B)/client/gain_table.o \ - $(B)/client/gain_table_lbr.o \ - $(B)/client/hexc_10_32_table.o \ - $(B)/client/hexc_table.o \ - $(B)/client/high_lsp_tables.o \ - $(B)/client/jitter.o \ - $(B)/client/kiss_fft.o \ - $(B)/client/kiss_fftr.o \ - $(B)/client/lpc.o \ - $(B)/client/lsp.o \ - $(B)/client/lsp_tables_nb.o \ - $(B)/client/ltp.o \ - $(B)/client/mdf.o \ - $(B)/client/modes.o \ - $(B)/client/modes_wb.o \ - $(B)/client/nb_celp.o \ - $(B)/client/preprocess.o \ - $(B)/client/quant_lsp.o \ - $(B)/client/resample.o \ - $(B)/client/sb_celp.o \ - $(B)/client/smallft.o \ - $(B)/client/speex.o \ - $(B)/client/speex_callbacks.o \ - $(B)/client/speex_header.o \ - $(B)/client/stereo.o \ - $(B)/client/vbr.o \ - $(B)/client/vq.o \ - $(B)/client/window.o -endif -endif - -ifeq ($(USE_INTERNAL_ZLIB),1) -Q3OBJ += \ - $(B)/client/adler32.o \ - $(B)/client/crc32.o \ - $(B)/client/inffast.o \ - $(B)/client/inflate.o \ - $(B)/client/inftrees.o \ - $(B)/client/zutil.o -endif - -ifeq ($(HAVE_VM_COMPILED),true) - ifeq ($(ARCH),x86) - Q3OBJ += $(B)/client/vm_x86.o - endif - ifeq ($(ARCH),x86_64) - Q3OBJ += $(B)/client/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o - endif - ifeq ($(ARCH),amd64) - Q3OBJ += $(B)/client/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o - endif - ifeq ($(ARCH),x64) - Q3OBJ += $(B)/client/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o - endif - ifeq ($(ARCH),ppc) - Q3OBJ += $(B)/client/vm_powerpc.o $(B)/client/vm_powerpc_asm.o - endif - ifeq ($(ARCH),ppc64) - Q3OBJ += $(B)/client/vm_powerpc.o $(B)/client/vm_powerpc_asm.o - endif - ifeq ($(ARCH),sparc) - Q3OBJ += $(B)/client/vm_sparc.o - endif -endif - -ifeq ($(PLATFORM),mingw32) - Q3OBJ += \ - $(B)/client/win_resource.o \ - $(B)/client/sys_win32.o -else - Q3OBJ += \ - $(B)/client/sys_unix.o -endif - -ifeq ($(PLATFORM),darwin) - Q3OBJ += \ - $(B)/client/sys_osx.o -endif - -ifeq ($(USE_MUMBLE),1) - Q3OBJ += \ - $(B)/client/libmumblelink.o -endif - -Q3POBJ += \ - $(B)/client/sdl_glimp.o - -Q3POBJ_SMP += \ - $(B)/clientsmp/sdl_glimp.o - -$(B)/tremulous$(FULLBINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN) - $(echo_cmd) "LD $@" - $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \ - -o $@ $(Q3OBJ) $(Q3POBJ) \ - $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS) - -$(B)/tremulous-smp$(FULLBINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN) - $(echo_cmd) "LD $@" - $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(THREAD_LDFLAGS) \ - -o $@ $(Q3OBJ) $(Q3POBJ_SMP) \ - $(THREAD_LIBS) $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS) - -ifneq ($(strip $(LIBSDLMAIN)),) -ifneq ($(strip $(LIBSDLMAINSRC)),) -$(LIBSDLMAIN) : $(LIBSDLMAINSRC) - cp $< $@ - ranlib $@ -endif -endif - - - -############################################################################# -# DEDICATED SERVER -############################################################################# - -Q3DOBJ = \ - $(B)/ded/sv_client.o \ - $(B)/ded/sv_ccmds.o \ - $(B)/ded/sv_game.o \ - $(B)/ded/sv_init.o \ - $(B)/ded/sv_main.o \ - $(B)/ded/sv_net_chan.o \ - $(B)/ded/sv_snapshot.o \ - $(B)/ded/sv_world.o \ - \ - $(B)/ded/cm_load.o \ - $(B)/ded/cm_patch.o \ - $(B)/ded/cm_polylib.o \ - $(B)/ded/cm_test.o \ - $(B)/ded/cm_trace.o \ - $(B)/ded/cmd.o \ - $(B)/ded/common.o \ - $(B)/ded/cvar.o \ - $(B)/ded/files.o \ - $(B)/ded/md4.o \ - $(B)/ded/msg.o \ - $(B)/ded/net_chan.o \ - $(B)/ded/net_ip.o \ - $(B)/ded/huffman.o \ - $(B)/ded/parse.o \ - \ - $(B)/ded/q_math.o \ - $(B)/ded/q_shared.o \ - \ - $(B)/ded/unzip.o \ - $(B)/ded/ioapi.o \ - $(B)/ded/vm.o \ - $(B)/ded/vm_interpreted.o \ - \ - $(B)/ded/null_client.o \ - $(B)/ded/null_input.o \ - $(B)/ded/null_snddma.o \ - \ - $(B)/ded/con_log.o \ - $(B)/ded/sys_main.o - -ifeq ($(ARCH),x86) - Q3DOBJ += \ - $(B)/ded/ftola.o \ - $(B)/ded/snapvectora.o \ - $(B)/ded/matha.o -endif - -ifeq ($(USE_INTERNAL_ZLIB),1) -Q3DOBJ += \ - $(B)/ded/adler32.o \ - $(B)/ded/crc32.o \ - $(B)/ded/inffast.o \ - $(B)/ded/inflate.o \ - $(B)/ded/inftrees.o \ - $(B)/ded/zutil.o -endif - -ifeq ($(HAVE_VM_COMPILED),true) - ifeq ($(ARCH),x86) - Q3DOBJ += $(B)/ded/vm_x86.o - endif - ifeq ($(ARCH),x86_64) - Q3DOBJ += $(B)/ded/vm_x86_64.o $(B)/ded/vm_x86_64_assembler.o - endif - ifeq ($(ARCH),amd64) - Q3DOBJ += $(B)/ded/vm_x86_64.o $(B)/ded/vm_x86_64_assembler.o - endif - ifeq ($(ARCH),x64) - Q3DOBJ += $(B)/ded/vm_x86_64.o $(B)/ded/vm_x86_64_assembler.o - endif - ifeq ($(ARCH),ppc) - Q3DOBJ += $(B)/ded/vm_powerpc.o $(B)/ded/vm_powerpc_asm.o - endif - ifeq ($(ARCH),ppc64) - Q3DOBJ += $(B)/ded/vm_powerpc.o $(B)/ded/vm_powerpc_asm.o - endif - ifeq ($(ARCH),sparc) - Q3DOBJ += $(B)/ded/vm_sparc.o - endif -endif - -ifeq ($(PLATFORM),mingw32) - Q3DOBJ += \ - $(B)/ded/win_resource.o \ - $(B)/ded/sys_win32.o \ - $(B)/ded/con_win32.o -else - Q3DOBJ += \ - $(B)/ded/sys_unix.o \ - $(B)/ded/con_tty.o -endif - -ifeq ($(PLATFORM),darwin) - Q3DOBJ += \ - $(B)/ded/sys_osx.o -endif - -$(B)/tremded$(FULLBINEXT): $(Q3DOBJ) - $(echo_cmd) "LD $@" - $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(Q3DOBJ) $(LIBS) - - - -############################################################################# -## TREMULOUS CGAME -############################################################################# - -CGOBJ_ = \ - $(B)/base/cgame/cg_main.o \ - $(B)/base/cgame/bg_misc.o \ - $(B)/base/cgame/bg_pmove.o \ - $(B)/base/cgame/bg_slidemove.o \ - $(B)/base/cgame/bg_lib.o \ - $(B)/base/cgame/bg_alloc.o \ - $(B)/base/cgame/bg_voice.o \ - $(B)/base/cgame/cg_consolecmds.o \ - $(B)/base/cgame/cg_buildable.o \ - $(B)/base/cgame/cg_animation.o \ - $(B)/base/cgame/cg_animmapobj.o \ - $(B)/base/cgame/cg_draw.o \ - $(B)/base/cgame/cg_drawtools.o \ - $(B)/base/cgame/cg_ents.o \ - $(B)/base/cgame/cg_event.o \ - $(B)/base/cgame/cg_marks.o \ - $(B)/base/cgame/cg_players.o \ - $(B)/base/cgame/cg_playerstate.o \ - $(B)/base/cgame/cg_predict.o \ - $(B)/base/cgame/cg_servercmds.o \ - $(B)/base/cgame/cg_snapshot.o \ - $(B)/base/cgame/cg_view.o \ - $(B)/base/cgame/cg_weapons.o \ - $(B)/base/cgame/cg_scanner.o \ - $(B)/base/cgame/cg_attachment.o \ - $(B)/base/cgame/cg_trails.o \ - $(B)/base/cgame/cg_particles.o \ - $(B)/base/cgame/cg_tutorial.o \ - $(B)/base/ui/ui_shared.o \ - \ - $(B)/base/qcommon/q_math.o \ - $(B)/base/qcommon/q_shared.o - -CGOBJ = $(CGOBJ_) $(B)/base/cgame/cg_syscalls.o -CGVMOBJ = $(CGOBJ_:%.o=%.asm) - -$(B)/base/cgame$(SHLIBNAME): $(CGOBJ) - $(echo_cmd) "LD $@" - $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(CGOBJ) - -$(B)/base/vm/cgame.qvm: $(CGVMOBJ) $(CGDIR)/cg_syscalls.asm $(Q3ASM) - $(echo_cmd) "Q3ASM $@" - $(Q)$(Q3ASM) -o $@ $(CGVMOBJ) $(CGDIR)/cg_syscalls.asm - - - -############################################################################# -## TREMULOUS GAME -############################################################################# - -GOBJ_ = \ - $(B)/base/game/g_main.o \ - $(B)/base/game/bg_misc.o \ - $(B)/base/game/bg_pmove.o \ - $(B)/base/game/bg_slidemove.o \ - $(B)/base/game/bg_lib.o \ - $(B)/base/game/bg_alloc.o \ - $(B)/base/game/bg_voice.o \ - $(B)/base/game/g_active.o \ - $(B)/base/game/g_client.o \ - $(B)/base/game/g_cmds.o \ - $(B)/base/game/g_combat.o \ - $(B)/base/game/g_physics.o \ - $(B)/base/game/g_buildable.o \ - $(B)/base/game/g_misc.o \ - $(B)/base/game/g_missile.o \ - $(B)/base/game/g_mover.o \ - $(B)/base/game/g_session.o \ - $(B)/base/game/g_spawn.o \ - $(B)/base/game/g_svcmds.o \ - $(B)/base/game/g_target.o \ - $(B)/base/game/g_team.o \ - $(B)/base/game/g_trigger.o \ - $(B)/base/game/g_utils.o \ - $(B)/base/game/g_maprotation.o \ - $(B)/base/game/g_weapon.o \ - $(B)/base/game/g_admin.o \ - $(B)/base/game/g_namelog.o \ - \ - $(B)/base/qcommon/q_math.o \ - $(B)/base/qcommon/q_shared.o - -GOBJ = $(GOBJ_) $(B)/base/game/g_syscalls.o -GVMOBJ = $(GOBJ_:%.o=%.asm) - -$(B)/base/game$(SHLIBNAME): $(GOBJ) - $(echo_cmd) "LD $@" - $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GOBJ) - -$(B)/base/vm/game.qvm: $(GVMOBJ) $(GDIR)/g_syscalls.asm $(Q3ASM) - $(echo_cmd) "Q3ASM $@" - $(Q)$(Q3ASM) -o $@ $(GVMOBJ) $(GDIR)/g_syscalls.asm - - - -############################################################################# -## TREMULOUS UI -############################################################################# - -UIOBJ_ = \ - $(B)/base/ui/ui_main.o \ - $(B)/base/ui/ui_atoms.o \ - $(B)/base/ui/ui_shared.o \ - $(B)/base/ui/ui_gameinfo.o \ - \ - $(B)/base/ui/bg_misc.o \ - $(B)/base/ui/bg_lib.o \ - $(B)/base/qcommon/q_math.o \ - $(B)/base/qcommon/q_shared.o - -UIOBJ = $(UIOBJ_) $(B)/base/ui/ui_syscalls.o -UIVMOBJ = $(UIOBJ_:%.o=%.asm) - -$(B)/base/ui$(SHLIBNAME): $(UIOBJ) - $(echo_cmd) "LD $@" - $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(UIOBJ) - -$(B)/base/vm/ui.qvm: $(UIVMOBJ) $(UIDIR)/ui_syscalls.asm $(Q3ASM) - $(echo_cmd) "Q3ASM $@" - $(Q)$(Q3ASM) -o $@ $(UIVMOBJ) $(UIDIR)/ui_syscalls.asm - - - -############################################################################# -## CLIENT/SERVER RULES -############################################################################# - -$(B)/client/%.o: $(ASMDIR)/%.s - $(DO_AS) - -$(B)/client/%.o: $(CDIR)/%.c - $(DO_CC) - -$(B)/client/%.o: $(SDIR)/%.c - $(DO_CC) - -$(B)/client/%.o: $(CMDIR)/%.c - $(DO_CC) - -$(B)/client/%.o: $(JPDIR)/%.c - $(DO_CC) - -$(B)/client/%.o: $(SPEEXDIR)/%.c - $(DO_CC) - -$(B)/client/%.o: $(ZDIR)/%.c - $(DO_CC) - -$(B)/client/%.o: $(RDIR)/%.c - $(DO_CC) - -$(B)/client/%.o: $(SDLDIR)/%.c - $(DO_CC) - -$(B)/clientsmp/%.o: $(SDLDIR)/%.c - $(DO_SMP_CC) - -$(B)/client/%.o: $(SYSDIR)/%.c - $(DO_CC) - -$(B)/client/%.o: $(SYSDIR)/%.m - $(DO_CC) - -$(B)/client/%.o: $(SYSDIR)/%.rc - $(DO_WINDRES) - - -$(B)/ded/%.o: $(ASMDIR)/%.s - $(DO_AS) - -$(B)/ded/%.o: $(SDIR)/%.c - $(DO_DED_CC) - -$(B)/ded/%.o: $(CMDIR)/%.c - $(DO_DED_CC) - -$(B)/ded/%.o: $(ZDIR)/%.c - $(DO_DED_CC) - -$(B)/ded/%.o: $(SYSDIR)/%.c - $(DO_DED_CC) - -$(B)/ded/%.o: $(SYSDIR)/%.m - $(DO_DED_CC) - -$(B)/ded/%.o: $(SYSDIR)/%.rc - $(DO_WINDRES) - -$(B)/ded/%.o: $(NDIR)/%.c - $(DO_DED_CC) - -# Extra dependencies to ensure the SVN version is incorporated -ifeq ($(USE_SVN),1) - $(B)/client/cl_console.o : .svn/entries - $(B)/client/common.o : .svn/entries - $(B)/ded/common.o : .svn/entries -endif - - -############################################################################# -## GAME MODULE RULES -############################################################################# - -$(B)/base/cgame/bg_%.o: $(GDIR)/bg_%.c - $(DO_CGAME_CC) - -$(B)/base/cgame/%.o: $(CGDIR)/%.c - $(DO_CGAME_CC) - -$(B)/base/cgame/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC) - $(DO_CGAME_Q3LCC) - -$(B)/base/cgame/%.asm: $(CGDIR)/%.c $(Q3LCC) - $(DO_CGAME_Q3LCC) - - -$(B)/base/game/%.o: $(GDIR)/%.c - $(DO_GAME_CC) - -$(B)/base/game/%.asm: $(GDIR)/%.c $(Q3LCC) - $(DO_GAME_Q3LCC) - - -$(B)/base/ui/bg_%.o: $(GDIR)/bg_%.c - $(DO_UI_CC) - -$(B)/base/ui/%.o: $(UIDIR)/%.c - $(DO_UI_CC) - -$(B)/base/ui/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC) - $(DO_UI_Q3LCC) - -$(B)/base/ui/%.asm: $(UIDIR)/%.c $(Q3LCC) - $(DO_UI_Q3LCC) - - -$(B)/base/qcommon/%.o: $(CMDIR)/%.c - $(DO_SHLIB_CC) - -$(B)/base/qcommon/%.asm: $(CMDIR)/%.c $(Q3LCC) - $(DO_Q3LCC) - - -############################################################################# -# MISC -############################################################################# - -OBJ = $(Q3OBJ) $(Q3POBJ) $(Q3POBJ_SMP) $(Q3DOBJ) \ - $(GOBJ) $(CGOBJ) $(UIOBJ) \ - $(GVMOBJ) $(CGVMOBJ) $(UIVMOBJ) -TOOLSOBJ = $(LBURGOBJ) $(Q3CPPOBJ) $(Q3RCCOBJ) $(Q3LCCOBJ) $(Q3ASMOBJ) - - -clean: clean-debug clean-release - @$(MAKE) -C $(MASTERDIR) clean - -clean-debug: - @$(MAKE) clean2 B=$(BD) - -clean-release: - @$(MAKE) clean2 B=$(BR) - -clean2: - @echo "CLEAN $(B)" - @rm -f $(OBJ) - @rm -f $(OBJ_D_FILES) - @rm -f $(TARGETS) - -toolsclean: toolsclean-debug toolsclean-release - -toolsclean-debug: - @$(MAKE) toolsclean2 B=$(BD) - -toolsclean-release: - @$(MAKE) toolsclean2 B=$(BR) - -toolsclean2: - @echo "TOOLS_CLEAN $(B)" - @rm -f $(TOOLSOBJ) - @rm -f $(TOOLSOBJ_D_FILES) - @rm -f $(LBURG) $(DAGCHECK_C) $(Q3RCC) $(Q3CPP) $(Q3LCC) $(Q3ASM) - -distclean: clean toolsclean - @rm -rf $(BUILD_DIR) - -dist: - rm -rf tremulous-$(SVN_VERSION) - svn export . tremulous-$(SVN_VERSION) - tar --owner=root --group=root --force-local -cjf tremulous-$(SVN_VERSION).tar.bz2 tremulous-$(SVN_VERSION) - rm -rf tremulous-$(SVN_VERSION) - -############################################################################# -# DEPENDENCIES -############################################################################# - -ifneq ($(B),) - OBJ_D_FILES=$(filter %.d,$(OBJ:%.o=%.d)) - TOOLSOBJ_D_FILES=$(filter %.d,$(TOOLSOBJ:%.o=%.d)) - -include $(OBJ_D_FILES) $(TOOLSOBJ_D_FILES) -endif - -.PHONY: all clean clean2 clean-debug clean-release copyfiles \ - debug default dist distclean makedirs \ - release targets \ - toolsclean toolsclean2 toolsclean-debug toolsclean-release \ - $(OBJ_D_FILES) $(TOOLSOBJ_D_FILES) diff --git a/Makefile.local b/Makefile.local deleted file mode 100644 index b129e26..0000000 --- a/Makefile.local +++ /dev/null @@ -1,3 +0,0 @@ -CC=gcc -USE_CURL=1 -BUILD_GAME_QVM=1
\ No newline at end of file diff --git a/src/cgame/cg_syscalls_11.asm b/src/cgame/cg_syscalls_11.asm new file mode 100644 index 0000000..0893ebc --- /dev/null +++ b/src/cgame/cg_syscalls_11.asm @@ -0,0 +1,115 @@ +code + +equ trap_Print -1 +equ trap_Error -2 +equ trap_Milliseconds -3 +equ trap_Cvar_Register -4 +equ trap_Cvar_Update -5 +equ trap_Cvar_Set -6 +equ trap_Cvar_VariableStringBuffer -7 +equ trap_Argc -8 +equ trap_Argv -9 +equ trap_Args -10 +equ trap_FS_FOpenFile -11 +equ trap_FS_Read -12 +equ trap_FS_Write -13 +equ trap_FS_FCloseFile -14 +equ trap_SendConsoleCommand -15 +equ trap_AddCommand -16 +equ trap_SendClientCommand -17 +equ trap_UpdateScreen -18 +equ trap_CM_LoadMap -19 +equ trap_CM_NumInlineModels -20 +equ trap_CM_InlineModel -21 +equ trap_CM_LoadModel -22 +equ trap_CM_TempBoxModel -23 +equ trap_CM_PointContents -24 +equ trap_CM_TransformedPointContents -25 +equ trap_CM_BoxTrace -26 +equ trap_CM_TransformedBoxTrace -27 +equ trap_CM_MarkFragments -28 +equ trap_S_StartSound -29 +equ trap_S_StartLocalSound -30 +equ trap_S_ClearLoopingSounds -31 +equ trap_S_AddLoopingSound -32 +equ trap_S_UpdateEntityPosition -33 +equ trap_S_Respatialize -34 +equ trap_S_RegisterSound -35 +equ trap_S_StartBackgroundTrack -36 +equ trap_R_LoadWorldMap -37 +equ trap_R_RegisterModel -38 +equ trap_R_RegisterSkin -39 +equ trap_R_RegisterShader -40 +equ trap_R_ClearScene -41 +equ trap_R_AddRefEntityToScene -42 +equ trap_R_AddPolyToScene -43 +equ trap_R_AddLightToScene -44 +equ trap_R_RenderScene -45 +equ trap_R_SetColor -46 +equ trap_R_DrawStretchPic -47 +equ trap_R_ModelBounds -48 +equ trap_R_LerpTag -49 +equ trap_GetGlconfig -50 +equ trap_GetGameState -51 +equ trap_GetCurrentSnapshotNumber -52 +equ trap_GetSnapshot -53 +equ trap_GetServerCommand -54 +equ trap_GetCurrentCmdNumber -55 +equ trap_GetUserCmd -56 +equ trap_SetUserCmdValue -57 +equ trap_R_RegisterShaderNoMip -58 +equ trap_MemoryRemaining -59 +equ trap_R_RegisterFont -60 +equ trap_Key_IsDown -61 +equ trap_Key_GetCatcher -62 +equ trap_Key_SetCatcher -63 +equ trap_Key_GetKey -64 +equ trap_Parse_AddGlobalDefine -65 +equ trap_Parse_LoadSource -66 +equ trap_Parse_FreeSource -67 +equ trap_Parse_ReadToken -68 +equ trap_Parse_SourceFileAndLine -69 +equ trap_S_StopBackgroundTrack -70 +equ trap_RealTime -71 +equ trap_SnapVector -72 +equ trap_RemoveCommand -73 +equ trap_R_LightForPoint -74 +equ trap_CIN_PlayCinematic -75 +equ trap_CIN_StopCinematic -76 +equ trap_CIN_RunCinematic -77 +equ trap_CIN_DrawCinematic -78 +equ trap_CIN_SetExtents -79 +equ trap_R_RemapShader -80 +equ trap_S_AddRealLoopingSound -81 +equ trap_S_StopLoopingSound -82 +equ trap_CM_TempCapsuleModel -83 +equ trap_CM_CapsuleTrace -84 +equ trap_CM_TransformedCapsuleTrace -85 +equ trap_R_AddAdditiveLightToScene -86 +equ trap_GetEntityToken -87 +equ trap_R_AddPolysToScene -88 +equ trap_R_inPVS -89 +equ trap_FS_Seek -90 +equ trap_FS_GetFileList -91 +equ trap_LiteralArgs -92 +equ trap_CM_BiSphereTrace -93 +equ trap_CM_TransformedBiSphereTrace -94 +equ trap_GetDemoState -95 +equ trap_GetDemoPos -96 +equ trap_GetDemoName -97 +equ trap_Key_KeynumToStringBuf -98 +equ trap_Key_GetBindingBuf -99 +equ trap_Key_SetBinding -100 + +equ memset -201 +equ memcpy -202 +equ strncpy -203 +equ sin -204 +equ cos -205 +equ atan2 -206 +equ sqrt -207 +equ floor -208 +equ ceil -209 +equ testPrintInt -210 +equ testPrintFloat -211 + diff --git a/src/game/g_main.c b/src/game/g_main.c index 65cdf87..9da8bee 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -28,7 +28,7 @@ TREMULOUS EDGE MOD SRC FILE #include "g_local.h" #include "newedge_version.h" -#define G_MOD_VERSION "Aardvark 0.5x" SVN_VERSION +#define G_MOD_VERSION "Aardvark 0.5x" level_locals_t level; typedef struct diff --git a/src/tools/lcc/lburg/gram.c b/src/tools/lcc/lburg/gram.c new file mode 100644 index 0000000..f6ee9f9 --- /dev/null +++ b/src/tools/lcc/lburg/gram.c @@ -0,0 +1,1686 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + + + +/* Copy the first part of user declarations. */ +#line 1 "src/tools/lcc/lburg/gram.y" /* yacc.c:339 */ + +#include <stdio.h> +#include "lburg.h" +static char rcsid[] = "$Id: gram.y 145 2001-10-17 21:53:10Z timo $"; +/*lint -e616 -e527 -e652 -esym(552,yynerrs) -esym(563,yynewstate,yyerrlab) */ +static int yylineno = 0; + +#line 74 "y.tab.c" /* yacc.c:339 */ + +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + TERMINAL = 258, + START = 259, + PPERCENT = 260, + ID = 261, + TEMPLATE = 262, + CODE = 263, + INT = 264 + }; +#endif +/* Tokens. */ +#define TERMINAL 258 +#define START 259 +#define PPERCENT 260 +#define ID 261 +#define TEMPLATE 262 +#define CODE 263 +#define INT 264 + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +union YYSTYPE +{ +#line 8 "src/tools/lcc/lburg/gram.y" /* yacc.c:355 */ + + int n; + char *string; + Tree tree; + +#line 135 "y.tab.c" /* yacc.c:355 */ +}; + +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE yylval; + +int yyparse (void); + + + +/* Copy the second part of user declarations. */ + +#line 152 "y.tab.c" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 3 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 35 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 16 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 9 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 20 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 37 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 264 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 10, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 13, 14, 2, 2, 15, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 12, 2, + 2, 11, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint8 yyrline[] = +{ + 0, 22, 22, 23, 26, 27, 30, 31, 35, 36, + 39, 40, 43, 44, 45, 46, 49, 52, 53, 54, + 57 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "TERMINAL", "START", "PPERCENT", "ID", + "TEMPLATE", "CODE", "INT", "'\\n'", "'='", "':'", "'('", "')'", "','", + "$accept", "spec", "decls", "decl", "blist", "rules", "nonterm", "tree", + "cost", YY_NULLPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 10, 61, 58, 40, 41, 44 +}; +# endif + +#define YYPACT_NINF -26 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-26))) + +#define YYTABLE_NINF -4 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int8 yypact[] = +{ + -26, 11, 0, -26, 5, -26, 8, -26, -26, -26, + -26, 3, -26, 7, 6, 9, -26, -26, 12, -26, + 13, 14, -26, 15, -26, 16, 17, 15, 18, 4, + -26, 20, -26, 15, -26, 19, -26 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 4, 0, 0, 1, 0, 10, 0, 12, 8, 5, + 9, 0, 16, 0, 0, 0, 6, 7, 0, 14, + 0, 0, 15, 0, 11, 17, 0, 0, 0, 0, + 20, 0, 18, 0, 13, 0, 19 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -26, -26, -26, -26, -26, -26, 21, -25, -26 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 1, 2, 9, 11, 14, 13, 26, 31 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int8 yytable[] = +{ + -3, 4, 29, 5, 6, 7, -2, 18, 35, 15, + 8, 3, 12, 16, 12, 10, 19, 17, 32, 33, + 21, 25, 22, 24, 28, 23, 30, 0, 0, 27, + 34, 0, 0, 36, 0, 20 +}; + +static const yytype_int8 yycheck[] = +{ + 0, 1, 27, 3, 4, 5, 0, 1, 33, 6, + 10, 0, 6, 10, 6, 10, 10, 10, 14, 15, + 11, 6, 10, 9, 7, 12, 8, -1, -1, 13, + 10, -1, -1, 14, -1, 14 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 17, 18, 0, 1, 3, 4, 5, 10, 19, + 10, 20, 6, 22, 21, 6, 10, 10, 1, 10, + 22, 11, 10, 12, 9, 6, 23, 13, 7, 23, + 8, 24, 14, 15, 10, 23, 14 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 16, 17, 17, 18, 18, 19, 19, 19, 19, + 20, 20, 21, 21, 21, 21, 22, 23, 23, 23, + 24 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 3, 1, 0, 2, 3, 3, 1, 2, + 0, 4, 0, 7, 2, 3, 1, 1, 4, 6, + 1 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +{ + YYUSE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +/* Number of syntax errors so far. */ +int yynerrs; + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (void) +{ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 22 "src/tools/lcc/lburg/gram.y" /* yacc.c:1646 */ + { yylineno = 0; } +#line 1242 "y.tab.c" /* yacc.c:1646 */ + break; + + case 3: +#line 23 "src/tools/lcc/lburg/gram.y" /* yacc.c:1646 */ + { yylineno = 0; } +#line 1248 "y.tab.c" /* yacc.c:1646 */ + break; + + case 7: +#line 31 "src/tools/lcc/lburg/gram.y" /* yacc.c:1646 */ + { + if (nonterm((yyvsp[-1].string))->number != 1) + yyerror("redeclaration of the start symbol\n"); + } +#line 1257 "y.tab.c" /* yacc.c:1646 */ + break; + + case 9: +#line 36 "src/tools/lcc/lburg/gram.y" /* yacc.c:1646 */ + { yyerrok; } +#line 1263 "y.tab.c" /* yacc.c:1646 */ + break; + + case 11: +#line 40 "src/tools/lcc/lburg/gram.y" /* yacc.c:1646 */ + { term((yyvsp[-2].string), (yyvsp[0].n)); } +#line 1269 "y.tab.c" /* yacc.c:1646 */ + break; + + case 13: +#line 44 "src/tools/lcc/lburg/gram.y" /* yacc.c:1646 */ + { rule((yyvsp[-5].string), (yyvsp[-3].tree), (yyvsp[-2].string), (yyvsp[-1].string)); } +#line 1275 "y.tab.c" /* yacc.c:1646 */ + break; + + case 15: +#line 46 "src/tools/lcc/lburg/gram.y" /* yacc.c:1646 */ + { yyerrok; } +#line 1281 "y.tab.c" /* yacc.c:1646 */ + break; + + case 16: +#line 49 "src/tools/lcc/lburg/gram.y" /* yacc.c:1646 */ + { nonterm((yyval.string) = (yyvsp[0].string)); } +#line 1287 "y.tab.c" /* yacc.c:1646 */ + break; + + case 17: +#line 52 "src/tools/lcc/lburg/gram.y" /* yacc.c:1646 */ + { (yyval.tree) = tree((yyvsp[0].string), 0, 0); } +#line 1293 "y.tab.c" /* yacc.c:1646 */ + break; + + case 18: +#line 53 "src/tools/lcc/lburg/gram.y" /* yacc.c:1646 */ + { (yyval.tree) = tree((yyvsp[-3].string), (yyvsp[-1].tree), 0); } +#line 1299 "y.tab.c" /* yacc.c:1646 */ + break; + + case 19: +#line 54 "src/tools/lcc/lburg/gram.y" /* yacc.c:1646 */ + { (yyval.tree) = tree((yyvsp[-5].string), (yyvsp[-3].tree), (yyvsp[-1].tree)); } +#line 1305 "y.tab.c" /* yacc.c:1646 */ + break; + + case 20: +#line 57 "src/tools/lcc/lburg/gram.y" /* yacc.c:1646 */ + { if (*(yyvsp[0].string) == 0) (yyval.string) = "0"; } +#line 1311 "y.tab.c" /* yacc.c:1646 */ + break; + + +#line 1315 "y.tab.c" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 59 "src/tools/lcc/lburg/gram.y" /* yacc.c:1906 */ + +#include <assert.h> +#include <stdarg.h> +#include <ctype.h> +#include <string.h> +#include <limits.h> + +int errcnt = 0; +FILE *infp = NULL; +FILE *outfp = NULL; +static char buf[BUFSIZ], *bp = buf; +static int ppercent = 0; +static int code = 0; + +static int get(void) { + if (*bp == 0) { + bp = buf; + *bp = 0; + if (fgets(buf, sizeof buf, infp) == NULL) + return EOF; + yylineno++; + while (buf[0] == '%' && buf[1] == '{' && buf[2] == '\n') { + for (;;) { + if (fgets(buf, sizeof buf, infp) == NULL) { + yywarn("unterminated %{...%}\n"); + return EOF; + } + yylineno++; + if (strcmp(buf, "%}\n") == 0) + break; + fputs(buf, outfp); + } + if (fgets(buf, sizeof buf, infp) == NULL) + return EOF; + yylineno++; + } + } + return *bp++; +} + +void yyerror(char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + if (yylineno > 0) + fprintf(stderr, "line %d: ", yylineno); + vfprintf(stderr, fmt, ap); + if (fmt[strlen(fmt)-1] != '\n') + fprintf(stderr, "\n"); + errcnt++; + va_end(ap); +} + +int yylex(void) { + int c; + + if (code) { + char *p; + bp += strspn(bp, " \t\f"); + p = strchr(bp, '\n'); + if (p == NULL) + p = strchr(bp, '\n'); + while (p > bp && isspace(p[-1])) + p--; + yylval.string = alloc(p - bp + 1); + strncpy(yylval.string, bp, p - bp); + yylval.string[p - bp] = 0; + bp = p; + code--; + return CODE; + } + while ((c = get()) != EOF) { + switch (c) { + case ' ': case '\f': case '\t': + continue; + case '\n': + case '(': case ')': case ',': + case ':': case '=': + return c; + } + if (c == '%' && *bp == '%') { + bp++; + return ppercent++ ? 0 : PPERCENT; + } else if (c == '%' && strncmp(bp, "term", 4) == 0 + && isspace(bp[4])) { + bp += 4; + return TERMINAL; + } else if (c == '%' && strncmp(bp, "start", 5) == 0 + && isspace(bp[5])) { + bp += 5; + return START; + } else if (c == '"') { + char *p = strchr(bp, '"'); + if (p == NULL) { + yyerror("missing \" in assembler template\n"); + p = strchr(bp, '\n'); + if (p == NULL) + p = strchr(bp, '\0'); + } + assert(p); + yylval.string = alloc(p - bp + 1); + strncpy(yylval.string, bp, p - bp); + yylval.string[p - bp] = 0; + bp = *p == '"' ? p + 1 : p; + code++; + return TEMPLATE; + } else if (isdigit(c)) { + int n = 0; + do { + int d = c - '0'; + if (n > (INT_MAX - d)/10) + yyerror("integer greater than %d\n", INT_MAX); + else + n = 10*n + d; + c = get(); + } while (c != EOF && isdigit(c)); + bp--; + yylval.n = n; + return INT; + } else if (isalpha(c)) { + char *p = bp - 1; + while (isalpha(*bp) || isdigit(*bp) || *bp == '_') + bp++; + yylval.string = alloc(bp - p + 1); + strncpy(yylval.string, p, bp - p); + yylval.string[bp - p] = 0; + return ID; + } else if (isprint(c)) + yyerror("invalid character `%c'\n", c); + else + yyerror("invalid character `\\%03o'\n", (unsigned char)c); + } + return 0; +} + +void yywarn(char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + if (yylineno > 0) + fprintf(stderr, "line %d: ", yylineno); + fprintf(stderr, "warning: "); + vfprintf(stderr, fmt, ap); +} diff --git a/src/ui/ui_syscalls_11.asm b/src/ui/ui_syscalls_11.asm new file mode 100644 index 0000000..64d2ca3 --- /dev/null +++ b/src/ui/ui_syscalls_11.asm @@ -0,0 +1,98 @@ +code + +equ trap_Error -1 +equ trap_Print -2 +equ trap_Milliseconds -3 +equ trap_Cvar_Set -4 +equ trap_Cvar_VariableValue -5 +equ trap_Cvar_VariableStringBuffer -6 +equ trap_Cvar_SetValue -7 +equ trap_Cvar_Reset -8 +equ trap_Cvar_Create -9 +equ trap_Cvar_InfoStringBuffer -10 +equ trap_Argc -11 +equ trap_Argv -12 +equ trap_Cmd_ExecuteText -13 +equ trap_FS_FOpenFile -14 +equ trap_FS_Read -15 +equ trap_FS_Write -16 +equ trap_FS_FCloseFile -17 +equ trap_FS_GetFileList -18 +equ trap_R_RegisterModel -19 +equ trap_R_RegisterSkin -20 +equ trap_R_RegisterShaderNoMip -21 +equ trap_R_ClearScene -22 +equ trap_R_AddRefEntityToScene -23 +equ trap_R_AddPolyToScene -24 +equ trap_R_AddLightToScene -25 +equ trap_R_RenderScene -26 +equ trap_R_SetColor -27 +equ trap_R_DrawStretchPic -28 +equ trap_UpdateScreen -29 +equ trap_CM_LerpTag -30 +equ trap_CM_LoadModel -31 +equ trap_S_RegisterSound -32 +equ trap_S_StartLocalSound -33 +equ trap_Key_KeynumToStringBuf -34 +equ trap_Key_GetBindingBuf -35 +equ trap_Key_SetBinding -36 +equ trap_Key_IsDown -37 +equ trap_Key_GetOverstrikeMode -38 +equ trap_Key_SetOverstrikeMode -39 +equ trap_Key_ClearStates -40 +equ trap_Key_GetCatcher -41 +equ trap_Key_SetCatcher -42 +equ trap_GetClipboardData -43 +equ trap_GetGlconfig -44 +equ trap_GetClientState -45 +equ trap_GetConfigString -46 +equ trap_LAN_GetPingQueueCount -47 +equ trap_LAN_ClearPing -48 +equ trap_LAN_GetPing -49 +equ trap_LAN_GetPingInfo -50 +equ trap_Cvar_Register -51 +equ trap_Cvar_Update -52 +equ trap_MemoryRemaining -53 +equ trap_R_RegisterFont -54 +equ trap_R_ModelBounds -55 +equ trap_Parse_AddGlobalDefine -56 +equ trap_Parse_LoadSource -57 +equ trap_Parse_FreeSource -58 +equ trap_Parse_ReadToken -59 +equ trap_Parse_SourceFileAndLine -60 +equ trap_S_StopBackgroundTrack -61 +equ trap_S_StartBackgroundTrack -62 +equ trap_RealTime -63 +equ trap_LAN_GetServerCount -64 +equ trap_LAN_GetServerAddressString -65 +equ trap_LAN_GetServerInfo -66 +equ trap_LAN_MarkServerVisible -67 +equ trap_LAN_UpdateVisiblePings -68 +equ trap_LAN_ResetPings -69 +equ trap_LAN_LoadCachedServers -70 +equ trap_LAN_SaveCachedServers -71 +equ trap_LAN_AddServer -72 +equ trap_LAN_RemoveServer -73 +equ trap_CIN_PlayCinematic -74 +equ trap_CIN_StopCinematic -75 +equ trap_CIN_RunCinematic -76 +equ trap_CIN_DrawCinematic -77 +equ trap_CIN_SetExtents -78 +equ trap_R_RemapShader -79 +equ trap_LAN_ServerStatus -80 +equ trap_LAN_GetServerPing -81 +equ trap_LAN_ServerIsVisible -82 +equ trap_LAN_CompareServers -83 +equ trap_FS_Seek -84 +equ trap_SetPbClStatus -85 + +equ memset -101 +equ memcpy -102 +equ strncpy -103 +equ sin -104 +equ cos -105 +equ atan2 -106 +equ sqrt -107 +equ floor -108 +equ ceil -109 + |