Makefile cleanups: fixed building with GCC 3, made tabs into spaces where outside command context; Windows: make startup window stay 3 seconds if there was an error -- this way you won't mistake yourself forgetting to copy game data for a crash *d'oh*

git-svn-id: https://svn.eduke32.com/eduke32@1693 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2010-08-12 21:06:51 +00:00
parent 6185aedded
commit 5e3d6ca527
8 changed files with 258 additions and 218 deletions

View file

@ -9,6 +9,7 @@ PRETTY_OUTPUT = 1
# SDK locations - adjust to match your setup # SDK locations - adjust to match your setup
DXROOT=../sdk/dx DXROOT=../sdk/dx
#DXROOT=c:/sdks/directx/dx8
# Engine options # Engine options
SUPERBUILD = 1 SUPERBUILD = 1
@ -31,6 +32,9 @@ PROFILER?=0
ifneq (0,$(KRANDDEBUG)) ifneq (0,$(KRANDDEBUG))
RELEASE=0 RELEASE=0
endif endif
ifneq (0,$(PROFILER))
DEBUGANYWAY=1
endif
# Build locations # Build locations
SRC=source SRC=source
@ -43,12 +47,12 @@ o=o
# ENETROOT=$(ESRC)/enet # ENETROOT=$(ESRC)/enet
ifneq (0,$(RELEASE)) ifneq (0,$(RELEASE))
# Debugging disabled # Debugging disabled
debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL) -fno-stack-protector debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL) $(F_NO_STACK_PROTECTOR)
LIBS=-lm LIBS=-lm
else else
# Debugging enabled # Debugging enabled
debug=-ggdb -O0 -DDEBUGGINGAIDS -fstack-protector-all debug=-ggdb -O0 -DDEBUGGINGAIDS $(F_STACK_PROTECTOR_ALL)
LIBS=-lm LIBS=-lm
ifneq (0,$(KRANDDEBUG)) ifneq (0,$(KRANDDEBUG))
@ -58,7 +62,7 @@ else
endif endif
ifneq (0,$(DEBUGANYWAY)) ifneq (0,$(DEBUGANYWAY))
debug+=-ggdb debug+=-ggdb
endif endif
JAUDIOLIBDIR=$(SRC)/jaudiolib JAUDIOLIBDIR=$(SRC)/jaudiolib
@ -74,13 +78,13 @@ RC=windres
STRIP=strip STRIP=strip
OURCFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \ OURCFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS \ -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS \
-I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(JAUDIOLIBDIR)/include -I$(ENETDIR)/include -D_FORTIFY_SOURCE=2 \ -I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(JAUDIOLIBDIR)/include -I$(ENETDIR)/include -D_FORTIFY_SOURCE=2 \
-fjump-tables $(ARCH) $(F_JUMP_TABLES) $(ARCH)
OURCXXFLAGS=-fno-exceptions -fno-rtti OURCXXFLAGS=-fno-exceptions -fno-rtti
NASMFLAGS = -s NASMFLAGS= -s
EXESUFFIX= EXESUFFIX=
include $(EROOT)/Makefile.shared include $(EROOT)/Makefile.shared
@ -88,14 +92,15 @@ include $(EROOT)/Makefile.shared
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OBJ=obj_win OBJ=obj_win
EOBJ=eobj_win EOBJ=eobj_win
LIBS+= -lssp -Wl,--enable-auto-import LIBS+= $(L_SSP) -Wl,--enable-auto-import
else else
LIBS+= -ldl -pthread LIBS+= -ldl -pthread
ifeq (1,$(PROFILER)) ifneq (0,$(PROFILER))
LIBS+= -lprofiler LIBS+= -lprofiler
debug+= -pg
endif endif
OBJ=obj OBJ=obj
EOBJ=eobj EOBJ=eobj
endif endif
JMACTOBJ=$(OBJ)/file_lib.$o \ JMACTOBJ=$(OBJ)/file_lib.$o \
@ -138,58 +143,59 @@ EDITOROBJS=$(OBJ)/astub.$o \
# PLATFORM SPECIFIC SETTINGS # PLATFORM SPECIFIC SETTINGS
ifeq ($(PLATFORM),LINUX) ifeq ($(PLATFORM),LINUX)
OURCFLAGS += -fno-pic OURCFLAGS += -fno-pic
NASMFLAGS += -f elf NASMFLAGS += -f elf
LIBS += -lvorbisfile -lvorbis -logg LIBS += -lvorbisfile -lvorbis -logg
endif endif
ifeq ($(PLATFORM),DARWIN) ifeq ($(PLATFORM),DARWIN)
ifeq (1,$(SDL_FRAMEWORK)) ifeq (1,$(SDL_FRAMEWORK))
OURCFLAGS += -fno-pic -IApple/include -I/Library/Frameworks/SDL.framework/Headers \ OURCFLAGS += -fno-pic -IApple/include -I/Library/Frameworks/SDL.framework/Headers \
-I-I/Library/Frameworks/SDL_mixer.framework/Headers -I-I/Library/Frameworks/SDL_mixer.framework/Headers
LIBS += -read_only_relocs suppress -LApple/lib -lvorbisfile -lvorbis -logg -lm \ LIBS += -read_only_relocs suppress -LApple/lib -lvorbisfile -lvorbis -logg -lm \
-Wl,-framework,SDL -Wl,-framework,SDL_mixer Apple/lib/libSDLmain.a \ -Wl,-framework,SDL -Wl,-framework,SDL_mixer Apple/lib/libSDLmain.a \
-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \ -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
-Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \ -Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \
-Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL \ -Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL \
-Wl,-framework,QuickTime -lm -Wl,-framework,QuickTime -lm
else else
OURCFLAGS += -fno-pic -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL OURCFLAGS += -fno-pic -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
LIBS += -read_only_relocs suppress -lvorbisfile -lvorbis -logg -lm -lSDL_mixer \ LIBS += -read_only_relocs suppress -lvorbisfile -lvorbis -logg -lm -lSDL_mixer \
-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \ -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
-Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \ -Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \
-Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL \ -Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL \
-Wl,-framework,QuickTime -lm -Wl,-framework,QuickTime -lm
endif endif
NASMFLAGS += -f Mach-O NASMFLAGS += -f Mach-O
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURCFLAGS += -fno-pic -DUNDERSCORES -I$(DXROOT)/include OURCFLAGS += -fno-pic -DUNDERSCORES -I$(DXROOT)/include
NASMFLAGS+= -DUNDERSCORES -f win32 NASMFLAGS+= -DUNDERSCORES -f win32
LIBS += -L$(JAUDIOLIBDIR)/third-party/mingw32/lib -lvorbisfile -lvorbis -logg -lwsock32 -lws2_32 -lwinmm -ldsound LIBS += -L$(JAUDIOLIBDIR)/third-party/mingw32/lib -lvorbisfile -lvorbis -logg -lwsock32 -lws2_32 -lwinmm -ldsound
GAMEOBJS+= $(OBJ)/gameres.$o $(OBJ)/winbits.$o $(OBJ)/startwin.game.$o $(OBJ)/music.$o $(OBJ)/midi.$o $(OBJ)/mpu401.$o GAMEOBJS+= $(OBJ)/gameres.$o $(OBJ)/winbits.$o $(OBJ)/startwin.game.$o $(OBJ)/music.$o $(OBJ)/midi.$o $(OBJ)/mpu401.$o
EDITOROBJS+= $(OBJ)/buildres.$o EDITOROBJS+= $(OBJ)/buildres.$o
JAUDIOLIB=libjfaudiolib_win32.a JAUDIOLIB=libjfaudiolib_win32.a
ENETLIB=libenet_win32.a ENETLIB=libenet_win32.a
else else
# -lGLU to build with gluBuild2DMipmaps
ifeq ($(RENDERTYPE),SDL) ifeq ($(RENDERTYPE),SDL)
ifeq (0,$(SDL_FRAMEWORK)) ifeq (0,$(SDL_FRAMEWORK))
OURCFLAGS+= $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags)) OURCFLAGS+= $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags))
LIBS+= -lSDL_mixer LIBS+= -lSDL_mixer
else else
OURCFLAGS += -DSDL_FRAMEWORK OURCFLAGS += -DSDL_FRAMEWORK
endif endif
ifeq (1,$(HAVE_GTK2)) ifeq (1,$(HAVE_GTK2))
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
GAMEOBJS+= $(OBJ)/game_banner.$o $(OBJ)/startgtk.game.$o GAMEOBJS+= $(OBJ)/game_banner.$o $(OBJ)/startgtk.game.$o
EDITOROBJS+= $(OBJ)/editor_banner.$o EDITOROBJS+= $(OBJ)/editor_banner.$o
endif endif
GAMEOBJS+= $(OBJ)/game_icon.$o $(OBJ)/sdlmusic.$o GAMEOBJS+= $(OBJ)/game_icon.$o $(OBJ)/sdlmusic.$o
EDITOROBJS+= $(OBJ)/build_icon.$o EDITOROBJS+= $(OBJ)/build_icon.$o
endif endif
endif endif
@ -200,7 +206,10 @@ OURCXXFLAGS+= $(BUILDCFLAGS)
MISCLINKOPTS= MISCLINKOPTS=
ifneq (0,$(KRANDDEBUG)) ifneq (0,$(KRANDDEBUG))
MISCLINKOPTS=-Wl,-Map=$@.memmap MISCLINKOPTS=-Wl,-Map=$@.memmap
endif
ifneq (0,$(PROFILER))
MISCLINKOPTS=-pg
endif endif
ifeq ($(PRETTY_OUTPUT),1) ifeq ($(PRETTY_OUTPUT),1)
@ -236,7 +245,7 @@ ifeq (1,$(RELEASE))
ifeq (0,$(DEBUGANYWAY)) ifeq (0,$(DEBUGANYWAY))
$(STRIP) mapster32$(EXESUFFIX) $(STRIP) mapster32$(EXESUFFIX)
endif endif
endif endif
include Makefile.deps include Makefile.deps
@ -248,9 +257,9 @@ ifeq ($(PRETTY_OUTPUT),1)
endif endif
$(MAKE) -C $(EROOT)/ "OBJ=../$(EOBJ)" \ $(MAKE) -C $(EROOT)/ "OBJ=../$(EOBJ)" \
SUPERBUILD=$(SUPERBUILD) POLYMOST=$(POLYMOST) DEBUGANYWAY=$(DEBUGANYWAY) KRANDDEBUG=$(KRANDDEBUG)\ SUPERBUILD=$(SUPERBUILD) POLYMOST=$(POLYMOST) DEBUGANYWAY=$(DEBUGANYWAY) KRANDDEBUG=$(KRANDDEBUG)\
USE_OPENGL=$(USE_OPENGL) BUILD32_ON_64=$(BUILD32_ON_64) \ USE_OPENGL=$(USE_OPENGL) BUILD32_ON_64=$(BUILD32_ON_64) PROFILER=$(PROFILER)\
NOASM=$(NOASM) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL) $@ NOASM=$(NOASM) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL) $@
ifeq ($(PRETTY_OUTPUT),1) ifeq ($(PRETTY_OUTPUT),1)
printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)\033[0;35m \033[0m\n" printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)\033[0;35m \033[0m\n"
endif endif
@ -279,7 +288,7 @@ endif
$(OBJ)/%.$o: $(SRC)/%.nasm $(OBJ)/%.$o: $(SRC)/%.nasm
$(COMPILE_STATUS) $(COMPILE_STATUS)
$(AS) $(NASMFLAGS) $< -o $@ $(AS) $(NASMFLAGS) $< -o $@
$(OBJ)/%.$o: $(SRC)/%.c $(OBJ)/%.$o: $(SRC)/%.c
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi

View file

@ -29,7 +29,7 @@ BUILD32_ON_64 ?= 0
NEDMALLOC ?= 1 NEDMALLOC ?= 1
ifeq (0,$(USE_OPENGL)) ifeq (0,$(USE_OPENGL))
POLYMER = 0 POLYMER = 0
endif endif
# Debugging/Build options # Debugging/Build options
@ -41,11 +41,15 @@ RELEASE?=1
DEBUGANYWAY?=0 DEBUGANYWAY?=0
KRANDDEBUG?=0 KRANDDEBUG?=0
EFENCE?=0 EFENCE?=0
OPTLEVEL ?= 2 OPTLEVEL?=2
PROFILER?=0
ifneq (0,$(KRANDDEBUG)) ifneq (0,$(KRANDDEBUG))
RELEASE=0 RELEASE=0
endif endif
ifneq (0,$(PROFILER))
DEBUGANYWAY=1
endif
# SDK locations for Windows - adjust to match your setup # SDK locations for Windows - adjust to match your setup
# #
@ -71,19 +75,23 @@ asm=nasm
# #
ifneq ($(RELEASE),0) ifneq ($(RELEASE),0)
# Debugging disabled # Debugging disabled
debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL) -fno-stack-protector debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL) $(F_NO_STACK_PROTECTOR)
LIBS=-lm LIBS=-lm
else else
# Debugging enabled # Debugging enabled
debug=-ggdb -O0 -DDEBUGGINGAIDS -DNOSDLPARACHUTE -fstack-protector-all debug=-ggdb -O0 -DDEBUGGINGAIDS -DNOSDLPARACHUTE $(F_STACK_PROTECTOR_ALL)
LIBS=-lm -lssp -Wl,--enable-auto-import LIBS=-lm $(L_SSP) -Wl,--enable-auto-import
ifneq (0,$(KRANDDEBUG)) ifneq (0,$(KRANDDEBUG))
debug+=-DKRANDDEBUG=1 debug+=-DKRANDDEBUG=1
endif
ifneq (0,$(PROFILER))
LIBS+= -lprofiler
debug+= -pg
endif endif
endif endif
ifneq (0,$(DEBUGANYWAY)) ifneq (0,$(DEBUGANYWAY))
debug+=-ggdb debug+=-ggdb
endif endif
CC=gcc CC=gcc
@ -96,7 +104,8 @@ RANLIB=ranlib
OURCFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \ OURCFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
-Wno-char-subscripts -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS \ -Wno-char-subscripts -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS \
-DKSFORBUILD -I$(INC) -D_FORTIFY_SOURCE=2 \ -DKSFORBUILD -I$(INC) -D_FORTIFY_SOURCE=2 \
-fjump-tables $(ARCH) $(F_JUMP_TABLES) $(ARCH)
OURCXXFLAGS=-fno-exceptions -fno-rtti OURCXXFLAGS=-fno-exceptions -fno-rtti
ASFLAGS=-s #-g ASFLAGS=-s #-g
EXESUFFIX= EXESUFFIX=
@ -134,16 +143,16 @@ ENGINEOBJS+= \
$(OBJ)/mutex.$o $(OBJ)/mutex.$o
ifeq (1,$(USE_OPENGL)) ifeq (1,$(USE_OPENGL))
ENGINEOBJS+= $(OBJ)/mdsprite.$o ENGINEOBJS+= $(OBJ)/mdsprite.$o
ENGINEOBJS+= $(OBJ)/glbuild.$o ENGINEOBJS+= $(OBJ)/glbuild.$o
endif endif
ifeq (1,$(POLYMER)) ifeq (1,$(POLYMER))
ENGINEOBJS+= $(OBJ)/polymer.$o ENGINEOBJS+= $(OBJ)/polymer.$o
endif endif
ifeq (1,$(NEDMALLOC)) ifeq (1,$(NEDMALLOC))
ENGINEOBJS+= $(OBJ)/nedmalloc.$o ENGINEOBJS+= $(OBJ)/nedmalloc.$o
endif endif
EDITOROBJS=$(OBJ)/build.$o \ EDITOROBJS=$(OBJ)/build.$o \
@ -152,53 +161,53 @@ EDITOROBJS=$(OBJ)/build.$o \
# PLATFORM SPECIFIC SETTINGS # PLATFORM SPECIFIC SETTINGS
ifeq ($(PLATFORM),LINUX) ifeq ($(PLATFORM),LINUX)
ASFLAGS+= -f elf ASFLAGS+= -f elf
endif endif
ifeq ($(PLATFORM),DARWIN) ifeq ($(PLATFORM),DARWIN)
ENGINEOBJS += $(OBJ)/StartupWinController.editor.$o \ ENGINEOBJS += $(OBJ)/StartupWinController.editor.$o \
$(OBJ)//osxbits.$o $(OBJ)//osxbits.$o
ASFLAGS += -f Mach-O ASFLAGS += -f Mach-O
OURCFLAGS += -fno-pic OURCFLAGS += -fno-pic
TARGETOPTS += -DNOASM TARGETOPTS += -DNOASM
endif endif
ifeq ($(PLATFORM),BSD) ifeq ($(PLATFORM),BSD)
ASFLAGS+= -f elf ASFLAGS+= -f elf
OURCFLAGS+= -I/usr/X11R6/include OURCFLAGS+= -I/usr/X11R6/include
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include -I$(FMODROOTWIN)/inc # -I$(ENETROOT)/include OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include -I$(FMODROOTWIN)/inc # -I$(ENETROOT)/include
LIBS+= -lwsock32 -lws2_32 -lwinmm #-L$(ENETROOT) LIBS+= -lwsock32 -lws2_32 -lwinmm #-L$(ENETROOT)
ASFLAGS+= -DUNDERSCORES -f win32 ASFLAGS+= -DUNDERSCORES -f win32
endif endif
ifeq ($(PLATFORM),BEOS) ifeq ($(PLATFORM),BEOS)
ASFLAGS+= -f elf ASFLAGS+= -f elf
TARGETOPTS+= -DNOASM TARGETOPTS+= -DNOASM
endif endif
ifeq ($(PLATFORM),SYLLABLE) ifeq ($(PLATFORM),SYLLABLE)
ASFLAGS+= -f elf ASFLAGS+= -f elf
endif endif
ifeq ($(RENDERTYPE),SDL) ifeq ($(RENDERTYPE),SDL)
ENGINEOBJS+= $(OBJ)/sdlayer.$o ENGINEOBJS+= $(OBJ)/sdlayer.$o
OURCFLAGS+= $(subst -Dmain=SDL_main,,$(SDLCONFIG_CFLAGS)) OURCFLAGS+= $(subst -Dmain=SDL_main,,$(SDLCONFIG_CFLAGS))
ifeq (1,$(HAVE_GTK2)) ifeq (1,$(HAVE_GTK2))
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
ENGINEOBJS+= $(OBJ)/gtkbits.$o ENGINEOBJS+= $(OBJ)/gtkbits.$o
ifeq ($(LINKED_GTK),0) ifeq ($(LINKED_GTK),0)
ENGINEOBJS+= $(OBJ)/dynamicgtk.$o ENGINEOBJS+= $(OBJ)/dynamicgtk.$o
endif endif
EDITOROBJS+= $(OBJ)/startgtk.editor.$o EDITOROBJS+= $(OBJ)/startgtk.editor.$o
endif endif
endif endif
ifeq ($(RENDERTYPE),WIN) ifeq ($(RENDERTYPE),WIN)
ENGINEOBJS+= $(OBJ)/winlayer.$o $(OBJ)/rawinput.$o ENGINEOBJS+= $(OBJ)/winlayer.$o $(OBJ)/rawinput.$o
EDITOROBJS+= $(OBJ)/startwin.editor.$o EDITOROBJS+= $(OBJ)/startwin.editor.$o
endif endif
ifneq (0,$(EFENCE)) ifneq (0,$(EFENCE))
LIBS+= -lefence LIBS+= -lefence
OURCFLAGS+= -DEFENCE OURCFLAGS+= -DEFENCE
endif endif
OURCFLAGS+= $(BUILDCFLAGS) OURCFLAGS+= $(BUILDCFLAGS)
@ -225,7 +234,7 @@ $(OBJ)/$(EDITORLIB): $(EDITOROBJS)
pragmacheck$(EXESUFFIX): $(OBJ)/pragmacheck.$o $(OBJ)/pragmas.$o pragmacheck$(EXESUFFIX): $(OBJ)/pragmacheck.$o $(OBJ)/pragmas.$o
$(CC) $(subst -Dmain=app_main,,$(OURCFLAGS)) -o $@ $^ $(CC) $(subst -Dmain=app_main,,$(OURCFLAGS)) -o $@ $^
kextract$(EXESUFFIX): $(OBJ)/kextract.$o $(OBJ)/compat.$o $(OBJ)/nedmalloc.$o kextract$(EXESUFFIX): $(OBJ)/kextract.$o $(OBJ)/compat.$o $(OBJ)/nedmalloc.$o
$(CC) -o $@ $^ $(LIBS) $(CC) -o $@ $^ $(LIBS)
kgroup$(EXESUFFIX): $(OBJ)/kgroup.$o $(OBJ)/compat.$o $(OBJ)/nedmalloc.$o kgroup$(EXESUFFIX): $(OBJ)/kgroup.$o $(OBJ)/compat.$o $(OBJ)/nedmalloc.$o

View file

@ -18,9 +18,23 @@ SDL_FRAMEWORK = 0
STDCPPLIB=-lsupc++ STDCPPLIB=-lsupc++
BUILDCFLAGS= BUILDCFLAGS=
# GCC version, for conditional selection of flags.
# This is easier than trying to squeeze it out of gcc --version:
GCC_MAJOR ?= 4
ifeq (4,$(GCC_MAJOR))
F_NO_STACK_PROTECTOR := -fno-stack-protector
# there are some link-time issues with stack protectors, so make it possible to override
F_STACK_PROTECTOR_ALL ?= -fstack-protector-all
F_JUMP_TABLES := -fjump-tables
M_TUNE_GENERIC := -mtune=generic
M_STACKREALIGN := -mstackrealign
L_SSP := -lssp
endif
ifndef ARCH ifndef ARCH
ifeq ($(findstring i686, $(shell uname -m)), i686) ifeq ($(findstring i686, $(shell uname -m)), i686)
ARCH=-march=pentium3 -mtune=generic -mmmx # -msse2 -mfpmath=sse,387 -malign-double -mstackrealign ARCH=-march=pentium3 $(M_TUNE_GENERIC) -mmmx # -msse2 -mfpmath=sse,387 -malign-double $(M_STACKREALIGN)
else else
ARCH= ARCH=
endif endif
@ -31,159 +45,159 @@ endif
# CC and giving us PLATFORM specifically. # CC and giving us PLATFORM specifically.
# #
ifndef PLATFORM ifndef PLATFORM
uname=$(strip $(shell uname -s)) uname=$(strip $(shell uname -s))
PLATFORM=UNKNOWN PLATFORM=UNKNOWN
ifeq ($(findstring Linux,$(uname)),Linux) ifeq ($(findstring Linux,$(uname)),Linux)
PLATFORM=LINUX PLATFORM=LINUX
endif endif
ifeq ($(findstring BSD,$(uname)),BSD) ifeq ($(findstring BSD,$(uname)),BSD)
PLATFORM=BSD PLATFORM=BSD
endif endif
ifeq ($(findstring MINGW,$(uname)),MINGW) ifeq ($(findstring MINGW,$(uname)),MINGW)
PLATFORM=WINDOWS PLATFORM=WINDOWS
endif endif
ifeq ($(findstring Darwin,$(uname)),Darwin) ifeq ($(findstring Darwin,$(uname)),Darwin)
PLATFORM=DARWIN PLATFORM=DARWIN
endif endif
ifeq ($(findstring BeOS,$(uname)),BeOS) ifeq ($(findstring BeOS,$(uname)),BeOS)
PLATFORM=BEOS PLATFORM=BEOS
endif endif
ifeq ($(findstring skyos,$(uname)),skyos) ifeq ($(findstring skyos,$(uname)),skyos)
PLATFORM=SKYOS PLATFORM=SKYOS
endif endif
ifeq ($(findstring QNX,$(uname)),QNX) ifeq ($(findstring QNX,$(uname)),QNX)
PLATFORM=QNX PLATFORM=QNX
endif endif
ifeq ($(findstring SunOS,$(uname)),SunOS) ifeq ($(findstring SunOS,$(uname)),SunOS)
PLATFORM=SUNOS PLATFORM=SUNOS
endif endif
ifeq ($(findstring syllable,$(uname)),syllable) ifeq ($(findstring syllable,$(uname)),syllable)
PLATFORM=SYLLABLE PLATFORM=SYLLABLE
endif endif
endif endif
ifeq ($(PLATFORM),LINUX) ifeq ($(PLATFORM),LINUX)
RENDERTYPE=SDL RENDERTYPE=SDL
BUILDCFLAGS+= -DHAVE_INTTYPES BUILDCFLAGS+= -DHAVE_INTTYPES
GTKCOMPAT32=0 GTKCOMPAT32=0
ifeq ($(findstring x86_64,$(shell uname -m)),x86_64) ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
ifeq (1,$(BUILD32_ON_64)) ifeq (1,$(BUILD32_ON_64))
# On my 64bit Gentoo these are the 32bit emulation libs # On my 64bit Gentoo these are the 32bit emulation libs
LIBS+= -m32 -L/emul/linux/x86/usr/lib LIBS+= -m32 -L/emul/linux/x86/usr/lib
BUILDCFLAGS+= -m32 BUILDCFLAGS+= -m32
# Override WITHOUT_GTK=0 # Override WITHOUT_GTK=0
GTKCOMPAT32=1 GTKCOMPAT32=1
else else
override NOASM=1 override NOASM=1
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),DARWIN) ifeq ($(PLATFORM),DARWIN)
RENDERTYPE = SDL RENDERTYPE = SDL
BUILDCFLAGS += -DHAVE_INTTYPES BUILDCFLAGS += -DHAVE_INTTYPES
GTKCOMPAT32 = 0 GTKCOMPAT32 = 0
SDL_FRAMEWORK = 1 SDL_FRAMEWORK = 1
# ASM won't work on PowerPC and currently throws errors on i386 too :-/ # ASM won't work on PowerPC and currently throws errors on i386 too :-/
override NOASM = 1 override NOASM = 1
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
RENDERTYPE ?= WIN RENDERTYPE ?= WIN
BUILDCFLAGS+= -DHAVE_INTTYPES BUILDCFLAGS+= -DHAVE_INTTYPES
EXESUFFIX=.exe EXESUFFIX=.exe
LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32 #-lshfolder LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32 #-lshfolder
# STDCPPLIB=-lstdc++ # STDCPPLIB=-lstdc++
endif endif
ifeq ($(PLATFORM),BSD) ifeq ($(PLATFORM),BSD)
RENDERTYPE=SDL RENDERTYPE=SDL
BUILDCFLAGS+= -DHAVE_INTTYPES BUILDCFLAGS+= -DHAVE_INTTYPES
endif endif
ifeq ($(PLATFORM),BEOS) ifeq ($(PLATFORM),BEOS)
RENDERTYPE=SDL RENDERTYPE=SDL
STDCPPLIB=-lstdc++ STDCPPLIB=-lstdc++
endif endif
ifeq ($(PLATFORM),SKYOS) ifeq ($(PLATFORM),SKYOS)
RENDERTYPE=SDL RENDERTYPE=SDL
EXESUFFIX=.app EXESUFFIX=.app
override NOASM=1 override NOASM=1
BUILDCFLAGS+= -DUNDERSCORES BUILDCFLAGS+= -DUNDERSCORES
SDLCONFIG= SDLCONFIG=
SDLCONFIG_CFLAGS=-I/boot/programs/sdk/include/sdl SDLCONFIG_CFLAGS=-I/boot/programs/sdk/include/sdl
LIBS+= -lSDL -lnet LIBS+= -lSDL -lnet
endif endif
ifeq ($(PLATFORM),QNX) ifeq ($(PLATFORM),QNX)
RENDERTYPE=SDL RENDERTYPE=SDL
override USE_OPENGL=0 override USE_OPENGL=0
override NOASM=1 override NOASM=1
STDCPPLIB=-lstdc++ STDCPPLIB=-lstdc++
LIBS+= -lsocket LIBS+= -lsocket
endif endif
ifeq ($(PLATFORM),SUNOS) ifeq ($(PLATFORM),SUNOS)
RENDERTYPE=SDL RENDERTYPE=SDL
override USE_OPENGL=0 override USE_OPENGL=0
override NOASM=1 override NOASM=1
STDCPPLIB=-lstdc++ STDCPPLIB=-lstdc++
LIBS+= -lsocket -lnsl LIBS+= -lsocket -lnsl
endif endif
ifeq ($(PLATFORM),SYLLABLE) ifeq ($(PLATFORM),SYLLABLE)
RENDERTYPE=SDL RENDERTYPE=SDL
override USE_OPENGL=0 override USE_OPENGL=0
override NOASM=1 override NOASM=1
endif endif
ifeq ($(RENDERTYPE),SDL) ifeq ($(RENDERTYPE),SDL)
ifeq ($(SDL_FRAMEWORK),1) ifeq ($(SDL_FRAMEWORK),1)
LIBS += -Wl,-framework,SDL LIBS += -Wl,-framework,SDL
SDLCONFIG_CFLAGS+= -I/Library/Frameworks/SDL.framework/Headers SDLCONFIG_CFLAGS+= -I/Library/Frameworks/SDL.framework/Headers
else else
ifneq ($(SDLCONFIG),) ifneq ($(SDLCONFIG),)
LIBS+= $(shell $(SDLCONFIG) --libs) LIBS+= $(shell $(SDLCONFIG) --libs)
SDLCONFIG_CFLAGS+=$(shell $(SDLCONFIG) --cflags) SDLCONFIG_CFLAGS+=$(shell $(SDLCONFIG) --cflags)
endif endif
endif endif
ifeq (1,$(WITHOUT_GTK)) ifeq (1,$(WITHOUT_GTK))
HAVE_GTK2=0 HAVE_GTK2=0
else else
ifneq (No,$(shell pkg-config --exists gtk+-2.0 || echo No)) ifneq (No,$(shell pkg-config --exists gtk+-2.0 || echo No))
HAVE_GTK2=1 HAVE_GTK2=1
# On my 64bit Gentoo box I have Cairo enabled which means the libs list includes # On my 64bit Gentoo box I have Cairo enabled which means the libs list includes
# -lpangocairo-1.0 and -lcairo, however the 32bit compatibility libraries don't # -lpangocairo-1.0 and -lcairo, however the 32bit compatibility libraries don't
# include cairo, so we need to filter out those -l switches in order to link # include cairo, so we need to filter out those -l switches in order to link
ifneq ($(LINKED_GTK),0) ifneq ($(LINKED_GTK),0)
ifeq ($(GTKCOMPAT32),1) ifeq ($(GTKCOMPAT32),1)
LIBS+= $(shell pkg-config --libs gtk+-2.0 | sed 's/\s-l\(pango\)\{0,1\}cairo\S*\s/ /g') LIBS+= $(shell pkg-config --libs gtk+-2.0 | sed 's/\s-l\(pango\)\{0,1\}cairo\S*\s/ /g')
else else
LIBS+= $(shell pkg-config --libs gtk+-2.0) LIBS+= $(shell pkg-config --libs gtk+-2.0)
endif endif
endif endif
else else
HAVE_GTK2=0 HAVE_GTK2=0
endif endif
endif endif
else else
ifeq ($(RENDERTYPE),WIN) ifeq ($(RENDERTYPE),WIN)
LIBS+= -mwindows -ldxguid LIBS+= -mwindows -ldxguid
endif endif
endif endif
BUILDCFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1 BUILDCFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1
ifneq (0,$(SUPERBUILD)) ifneq (0,$(SUPERBUILD))
BUILDCFLAGS+= -DSUPERBUILD BUILDCFLAGS+= -DSUPERBUILD
endif endif
ifneq (0,$(POLYMOST)) ifneq (0,$(POLYMOST))
BUILDCFLAGS+= -DPOLYMOST BUILDCFLAGS+= -DPOLYMOST
endif endif
ifneq (0,$(USE_OPENGL)) ifneq (0,$(USE_OPENGL))
BUILDCFLAGS+= -DUSE_OPENGL BUILDCFLAGS+= -DUSE_OPENGL
endif endif
ifneq (0,$(NOASM)) ifneq (0,$(NOASM))
BUILDCFLAGS+= -DNOASM BUILDCFLAGS+= -DNOASM
endif endif
ifneq (0,$(LINKED_GTK)) ifneq (0,$(LINKED_GTK))
BUILDCFLAGS+= -DLINKED_GTK BUILDCFLAGS+= -DLINKED_GTK
endif endif
ifneq (0,$(POLYMER)) ifneq (0,$(POLYMER))
@ -195,7 +209,7 @@ ifneq (0,$(POLYMER))
endif endif
ifneq (0,$(NEDMALLOC)) ifneq (0,$(NEDMALLOC))
BUILDCFLAGS+= -DNEDMALLOC BUILDCFLAGS+= -DNEDMALLOC
endif endif
ifeq ($(PRETTY_OUTPUT),1) ifeq ($(PRETTY_OUTPUT),1)

View file

@ -77,6 +77,7 @@
# endif # endif
# include <fcntl.h> # include <fcntl.h>
# include <ctype.h> # include <ctype.h>
# include <stdint.h>
# include <sys/types.h> # include <sys/types.h>
# include <sys/stat.h> # include <sys/stat.h>
# include <errno.h> # include <errno.h>
@ -540,5 +541,10 @@ char *Bstrupr(char *);
} }
#endif #endif
// timer defs for profiling function chunks the simple way
#define EDUKE32_TMRDEF int32_t t[20], ti=0; const char *tmrstr=__func__; fprintf(stderr,"%s\n",tmrstr); t[ti++]=getticks();
#define EDUKE32_TMRTIC t[ti++]=getticks()
#define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii<ti; ii++) fprintf(stderr,"%d ", t[ii]-t[ii-1]); fprintf(stderr,"\n"); } while (0)
#endif // __compat_h__ #endif // __compat_h__

View file

@ -491,6 +491,8 @@ int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, in
fclose(stdout); fclose(stdout);
if (r) Sleep(3000);
startwin_close(); startwin_close();
if (instanceflag) CloseHandle(instanceflag); if (instanceflag) CloseHandle(instanceflag);

View file

@ -57,4 +57,4 @@ int32_t krd_print(const char *filename);
void krd_enable(int32_t which); void krd_enable(int32_t which);
#endif #endif
#endif #endif

View file

@ -324,4 +324,4 @@ void krd_enable(int32_t which);
#define Net_EnterText(x, y, t, dalen, c) _EnterText(1,x,y,t,dalen,c) #define Net_EnterText(x, y, t, dalen, c) _EnterText(1,x,y,t,dalen,c)
#define S_StopSound(num) S_StopEnvSound(num, -1) #define S_StopSound(num) S_StopEnvSound(num, -1)
#endif #endif

View file

@ -48,4 +48,4 @@ void P_ResetWeapons(int32_t snum);
void clearfifo(void); void clearfifo(void);
void xyzmirror(int32_t i,int32_t wn); void xyzmirror(int32_t i,int32_t wn);
#endif #endif