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
DXROOT=../sdk/dx
#DXROOT=c:/sdks/directx/dx8
# Engine options
SUPERBUILD = 1
@ -31,6 +32,9 @@ PROFILER?=0
ifneq (0,$(KRANDDEBUG))
RELEASE=0
endif
ifneq (0,$(PROFILER))
DEBUGANYWAY=1
endif
# Build locations
SRC=source
@ -43,12 +47,12 @@ o=o
# ENETROOT=$(ESRC)/enet
ifneq (0,$(RELEASE))
# Debugging disabled
debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL) -fno-stack-protector
# Debugging disabled
debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL) $(F_NO_STACK_PROTECTOR)
LIBS=-lm
else
# Debugging enabled
debug=-ggdb -O0 -DDEBUGGINGAIDS -fstack-protector-all
# Debugging enabled
debug=-ggdb -O0 -DDEBUGGINGAIDS $(F_STACK_PROTECTOR_ALL)
LIBS=-lm
ifneq (0,$(KRANDDEBUG))
@ -58,7 +62,7 @@ else
endif
ifneq (0,$(DEBUGANYWAY))
debug+=-ggdb
debug+=-ggdb
endif
JAUDIOLIBDIR=$(SRC)/jaudiolib
@ -74,13 +78,13 @@ RC=windres
STRIP=strip
OURCFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
-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 \
-fjump-tables $(ARCH)
-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 \
$(F_JUMP_TABLES) $(ARCH)
OURCXXFLAGS=-fno-exceptions -fno-rtti
NASMFLAGS = -s
NASMFLAGS= -s
EXESUFFIX=
include $(EROOT)/Makefile.shared
@ -88,14 +92,15 @@ include $(EROOT)/Makefile.shared
ifeq ($(PLATFORM),WINDOWS)
OBJ=obj_win
EOBJ=eobj_win
LIBS+= -lssp -Wl,--enable-auto-import
LIBS+= $(L_SSP) -Wl,--enable-auto-import
else
LIBS+= -ldl -pthread
ifeq (1,$(PROFILER))
ifneq (0,$(PROFILER))
LIBS+= -lprofiler
debug+= -pg
endif
OBJ=obj
EOBJ=eobj
OBJ=obj
EOBJ=eobj
endif
JMACTOBJ=$(OBJ)/file_lib.$o \
@ -138,58 +143,59 @@ EDITOROBJS=$(OBJ)/astub.$o \
# PLATFORM SPECIFIC SETTINGS
ifeq ($(PLATFORM),LINUX)
OURCFLAGS += -fno-pic
NASMFLAGS += -f elf
LIBS += -lvorbisfile -lvorbis -logg
OURCFLAGS += -fno-pic
NASMFLAGS += -f elf
LIBS += -lvorbisfile -lvorbis -logg
endif
ifeq ($(PLATFORM),DARWIN)
ifeq (1,$(SDL_FRAMEWORK))
OURCFLAGS += -fno-pic -IApple/include -I/Library/Frameworks/SDL.framework/Headers \
-I-I/Library/Frameworks/SDL_mixer.framework/Headers
LIBS += -read_only_relocs suppress -LApple/lib -lvorbisfile -lvorbis -logg -lm \
-Wl,-framework,SDL -Wl,-framework,SDL_mixer Apple/lib/libSDLmain.a \
-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
-Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \
-Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL \
-Wl,-framework,QuickTime -lm
ifeq (1,$(SDL_FRAMEWORK))
OURCFLAGS += -fno-pic -IApple/include -I/Library/Frameworks/SDL.framework/Headers \
-I-I/Library/Frameworks/SDL_mixer.framework/Headers
LIBS += -read_only_relocs suppress -LApple/lib -lvorbisfile -lvorbis -logg -lm \
-Wl,-framework,SDL -Wl,-framework,SDL_mixer Apple/lib/libSDLmain.a \
-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
-Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \
-Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL \
-Wl,-framework,QuickTime -lm
else
OURCFLAGS += -fno-pic -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
LIBS += -read_only_relocs suppress -lvorbisfile -lvorbis -logg -lm -lSDL_mixer \
-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
-Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \
-Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL \
-Wl,-framework,QuickTime -lm
endif
NASMFLAGS += -f Mach-O
else
OURCFLAGS += -fno-pic -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
LIBS += -read_only_relocs suppress -lvorbisfile -lvorbis -logg -lm -lSDL_mixer \
-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
-Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \
-Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL \
-Wl,-framework,QuickTime -lm
endif
NASMFLAGS += -f Mach-O
endif
ifeq ($(PLATFORM),WINDOWS)
OURCFLAGS += -fno-pic -DUNDERSCORES -I$(DXROOT)/include
NASMFLAGS+= -DUNDERSCORES -f win32
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
EDITOROBJS+= $(OBJ)/buildres.$o
OURCFLAGS += -fno-pic -DUNDERSCORES -I$(DXROOT)/include
NASMFLAGS+= -DUNDERSCORES -f win32
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
EDITOROBJS+= $(OBJ)/buildres.$o
JAUDIOLIB=libjfaudiolib_win32.a
ENETLIB=libenet_win32.a
else
# -lGLU to build with gluBuild2DMipmaps
ifeq ($(RENDERTYPE),SDL)
ifeq (0,$(SDL_FRAMEWORK))
OURCFLAGS+= $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags))
ifeq (0,$(SDL_FRAMEWORK))
OURCFLAGS+= $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags))
LIBS+= -lSDL_mixer
else
OURCFLAGS += -DSDL_FRAMEWORK
endif
else
OURCFLAGS += -DSDL_FRAMEWORK
endif
ifeq (1,$(HAVE_GTK2))
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
GAMEOBJS+= $(OBJ)/game_banner.$o $(OBJ)/startgtk.game.$o
EDITOROBJS+= $(OBJ)/editor_banner.$o
endif
ifeq (1,$(HAVE_GTK2))
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
GAMEOBJS+= $(OBJ)/game_banner.$o $(OBJ)/startgtk.game.$o
EDITOROBJS+= $(OBJ)/editor_banner.$o
endif
GAMEOBJS+= $(OBJ)/game_icon.$o $(OBJ)/sdlmusic.$o
EDITOROBJS+= $(OBJ)/build_icon.$o
GAMEOBJS+= $(OBJ)/game_icon.$o $(OBJ)/sdlmusic.$o
EDITOROBJS+= $(OBJ)/build_icon.$o
endif
endif
@ -200,7 +206,10 @@ OURCXXFLAGS+= $(BUILDCFLAGS)
MISCLINKOPTS=
ifneq (0,$(KRANDDEBUG))
MISCLINKOPTS=-Wl,-Map=$@.memmap
MISCLINKOPTS=-Wl,-Map=$@.memmap
endif
ifneq (0,$(PROFILER))
MISCLINKOPTS=-pg
endif
ifeq ($(PRETTY_OUTPUT),1)
@ -236,7 +245,7 @@ ifeq (1,$(RELEASE))
ifeq (0,$(DEBUGANYWAY))
$(STRIP) mapster32$(EXESUFFIX)
endif
endif
endif
include Makefile.deps
@ -248,9 +257,9 @@ ifeq ($(PRETTY_OUTPUT),1)
endif
$(MAKE) -C $(EROOT)/ "OBJ=../$(EOBJ)" \
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) $@
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"
endif
@ -279,7 +288,7 @@ endif
$(OBJ)/%.$o: $(SRC)/%.nasm
$(COMPILE_STATUS)
$(AS) $(NASMFLAGS) $< -o $@
$(OBJ)/%.$o: $(SRC)/%.c
$(COMPILE_STATUS)
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
ifeq (0,$(USE_OPENGL))
POLYMER = 0
POLYMER = 0
endif
# Debugging/Build options
@ -41,11 +41,15 @@ RELEASE?=1
DEBUGANYWAY?=0
KRANDDEBUG?=0
EFENCE?=0
OPTLEVEL ?= 2
OPTLEVEL?=2
PROFILER?=0
ifneq (0,$(KRANDDEBUG))
RELEASE=0
endif
ifneq (0,$(PROFILER))
DEBUGANYWAY=1
endif
# SDK locations for Windows - adjust to match your setup
#
@ -71,19 +75,23 @@ asm=nasm
#
ifneq ($(RELEASE),0)
# 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
else
# Debugging enabled
debug=-ggdb -O0 -DDEBUGGINGAIDS -DNOSDLPARACHUTE -fstack-protector-all
LIBS=-lm -lssp -Wl,--enable-auto-import
debug=-ggdb -O0 -DDEBUGGINGAIDS -DNOSDLPARACHUTE $(F_STACK_PROTECTOR_ALL)
LIBS=-lm $(L_SSP) -Wl,--enable-auto-import
ifneq (0,$(KRANDDEBUG))
debug+=-DKRANDDEBUG=1
debug+=-DKRANDDEBUG=1
endif
ifneq (0,$(PROFILER))
LIBS+= -lprofiler
debug+= -pg
endif
endif
ifneq (0,$(DEBUGANYWAY))
debug+=-ggdb
debug+=-ggdb
endif
CC=gcc
@ -96,7 +104,8 @@ RANLIB=ranlib
OURCFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
-Wno-char-subscripts -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS \
-DKSFORBUILD -I$(INC) -D_FORTIFY_SOURCE=2 \
-fjump-tables $(ARCH)
$(F_JUMP_TABLES) $(ARCH)
OURCXXFLAGS=-fno-exceptions -fno-rtti
ASFLAGS=-s #-g
EXESUFFIX=
@ -134,16 +143,16 @@ ENGINEOBJS+= \
$(OBJ)/mutex.$o
ifeq (1,$(USE_OPENGL))
ENGINEOBJS+= $(OBJ)/mdsprite.$o
ENGINEOBJS+= $(OBJ)/glbuild.$o
ENGINEOBJS+= $(OBJ)/mdsprite.$o
ENGINEOBJS+= $(OBJ)/glbuild.$o
endif
ifeq (1,$(POLYMER))
ENGINEOBJS+= $(OBJ)/polymer.$o
ENGINEOBJS+= $(OBJ)/polymer.$o
endif
ifeq (1,$(NEDMALLOC))
ENGINEOBJS+= $(OBJ)/nedmalloc.$o
ENGINEOBJS+= $(OBJ)/nedmalloc.$o
endif
EDITOROBJS=$(OBJ)/build.$o \
@ -152,53 +161,53 @@ EDITOROBJS=$(OBJ)/build.$o \
# PLATFORM SPECIFIC SETTINGS
ifeq ($(PLATFORM),LINUX)
ASFLAGS+= -f elf
ASFLAGS+= -f elf
endif
ifeq ($(PLATFORM),DARWIN)
ENGINEOBJS += $(OBJ)/StartupWinController.editor.$o \
$(OBJ)//osxbits.$o
ASFLAGS += -f Mach-O
OURCFLAGS += -fno-pic
TARGETOPTS += -DNOASM
ENGINEOBJS += $(OBJ)/StartupWinController.editor.$o \
$(OBJ)//osxbits.$o
ASFLAGS += -f Mach-O
OURCFLAGS += -fno-pic
TARGETOPTS += -DNOASM
endif
ifeq ($(PLATFORM),BSD)
ASFLAGS+= -f elf
OURCFLAGS+= -I/usr/X11R6/include
ASFLAGS+= -f elf
OURCFLAGS+= -I/usr/X11R6/include
endif
ifeq ($(PLATFORM),WINDOWS)
OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include -I$(FMODROOTWIN)/inc # -I$(ENETROOT)/include
LIBS+= -lwsock32 -lws2_32 -lwinmm #-L$(ENETROOT)
ASFLAGS+= -DUNDERSCORES -f win32
OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include -I$(FMODROOTWIN)/inc # -I$(ENETROOT)/include
LIBS+= -lwsock32 -lws2_32 -lwinmm #-L$(ENETROOT)
ASFLAGS+= -DUNDERSCORES -f win32
endif
ifeq ($(PLATFORM),BEOS)
ASFLAGS+= -f elf
TARGETOPTS+= -DNOASM
ASFLAGS+= -f elf
TARGETOPTS+= -DNOASM
endif
ifeq ($(PLATFORM),SYLLABLE)
ASFLAGS+= -f elf
ASFLAGS+= -f elf
endif
ifeq ($(RENDERTYPE),SDL)
ENGINEOBJS+= $(OBJ)/sdlayer.$o
OURCFLAGS+= $(subst -Dmain=SDL_main,,$(SDLCONFIG_CFLAGS))
ifeq (1,$(HAVE_GTK2))
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
ENGINEOBJS+= $(OBJ)/gtkbits.$o
ifeq ($(LINKED_GTK),0)
ENGINEOBJS+= $(OBJ)/dynamicgtk.$o
endif
EDITOROBJS+= $(OBJ)/startgtk.editor.$o
endif
ENGINEOBJS+= $(OBJ)/sdlayer.$o
OURCFLAGS+= $(subst -Dmain=SDL_main,,$(SDLCONFIG_CFLAGS))
ifeq (1,$(HAVE_GTK2))
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
ENGINEOBJS+= $(OBJ)/gtkbits.$o
ifeq ($(LINKED_GTK),0)
ENGINEOBJS+= $(OBJ)/dynamicgtk.$o
endif
EDITOROBJS+= $(OBJ)/startgtk.editor.$o
endif
endif
ifeq ($(RENDERTYPE),WIN)
ENGINEOBJS+= $(OBJ)/winlayer.$o $(OBJ)/rawinput.$o
EDITOROBJS+= $(OBJ)/startwin.editor.$o
ENGINEOBJS+= $(OBJ)/winlayer.$o $(OBJ)/rawinput.$o
EDITOROBJS+= $(OBJ)/startwin.editor.$o
endif
ifneq (0,$(EFENCE))
LIBS+= -lefence
OURCFLAGS+= -DEFENCE
LIBS+= -lefence
OURCFLAGS+= -DEFENCE
endif
OURCFLAGS+= $(BUILDCFLAGS)
@ -225,7 +234,7 @@ $(OBJ)/$(EDITORLIB): $(EDITOROBJS)
pragmacheck$(EXESUFFIX): $(OBJ)/pragmacheck.$o $(OBJ)/pragmas.$o
$(CC) $(subst -Dmain=app_main,,$(OURCFLAGS)) -o $@ $^
kextract$(EXESUFFIX): $(OBJ)/kextract.$o $(OBJ)/compat.$o $(OBJ)/nedmalloc.$o
$(CC) -o $@ $^ $(LIBS)
kgroup$(EXESUFFIX): $(OBJ)/kgroup.$o $(OBJ)/compat.$o $(OBJ)/nedmalloc.$o

View file

@ -18,9 +18,23 @@ SDL_FRAMEWORK = 0
STDCPPLIB=-lsupc++
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
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
ARCH=
endif
@ -31,159 +45,159 @@ endif
# CC and giving us PLATFORM specifically.
#
ifndef PLATFORM
uname=$(strip $(shell uname -s))
PLATFORM=UNKNOWN
ifeq ($(findstring Linux,$(uname)),Linux)
PLATFORM=LINUX
endif
ifeq ($(findstring BSD,$(uname)),BSD)
PLATFORM=BSD
endif
ifeq ($(findstring MINGW,$(uname)),MINGW)
PLATFORM=WINDOWS
endif
ifeq ($(findstring Darwin,$(uname)),Darwin)
PLATFORM=DARWIN
endif
ifeq ($(findstring BeOS,$(uname)),BeOS)
PLATFORM=BEOS
endif
ifeq ($(findstring skyos,$(uname)),skyos)
PLATFORM=SKYOS
endif
ifeq ($(findstring QNX,$(uname)),QNX)
PLATFORM=QNX
endif
ifeq ($(findstring SunOS,$(uname)),SunOS)
PLATFORM=SUNOS
endif
ifeq ($(findstring syllable,$(uname)),syllable)
PLATFORM=SYLLABLE
endif
uname=$(strip $(shell uname -s))
PLATFORM=UNKNOWN
ifeq ($(findstring Linux,$(uname)),Linux)
PLATFORM=LINUX
endif
ifeq ($(findstring BSD,$(uname)),BSD)
PLATFORM=BSD
endif
ifeq ($(findstring MINGW,$(uname)),MINGW)
PLATFORM=WINDOWS
endif
ifeq ($(findstring Darwin,$(uname)),Darwin)
PLATFORM=DARWIN
endif
ifeq ($(findstring BeOS,$(uname)),BeOS)
PLATFORM=BEOS
endif
ifeq ($(findstring skyos,$(uname)),skyos)
PLATFORM=SKYOS
endif
ifeq ($(findstring QNX,$(uname)),QNX)
PLATFORM=QNX
endif
ifeq ($(findstring SunOS,$(uname)),SunOS)
PLATFORM=SUNOS
endif
ifeq ($(findstring syllable,$(uname)),syllable)
PLATFORM=SYLLABLE
endif
endif
ifeq ($(PLATFORM),LINUX)
RENDERTYPE=SDL
BUILDCFLAGS+= -DHAVE_INTTYPES
GTKCOMPAT32=0
RENDERTYPE=SDL
BUILDCFLAGS+= -DHAVE_INTTYPES
GTKCOMPAT32=0
ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
ifeq (1,$(BUILD32_ON_64))
# On my 64bit Gentoo these are the 32bit emulation libs
LIBS+= -m32 -L/emul/linux/x86/usr/lib
BUILDCFLAGS+= -m32
# Override WITHOUT_GTK=0
GTKCOMPAT32=1
else
override NOASM=1
endif
endif
ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
ifeq (1,$(BUILD32_ON_64))
# On my 64bit Gentoo these are the 32bit emulation libs
LIBS+= -m32 -L/emul/linux/x86/usr/lib
BUILDCFLAGS+= -m32
# Override WITHOUT_GTK=0
GTKCOMPAT32=1
else
override NOASM=1
endif
endif
endif
ifeq ($(PLATFORM),DARWIN)
RENDERTYPE = SDL
BUILDCFLAGS += -DHAVE_INTTYPES
GTKCOMPAT32 = 0
SDL_FRAMEWORK = 1
# ASM won't work on PowerPC and currently throws errors on i386 too :-/
override NOASM = 1
RENDERTYPE = SDL
BUILDCFLAGS += -DHAVE_INTTYPES
GTKCOMPAT32 = 0
SDL_FRAMEWORK = 1
# ASM won't work on PowerPC and currently throws errors on i386 too :-/
override NOASM = 1
endif
ifeq ($(PLATFORM),WINDOWS)
RENDERTYPE ?= WIN
BUILDCFLAGS+= -DHAVE_INTTYPES
EXESUFFIX=.exe
LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32 #-lshfolder
# STDCPPLIB=-lstdc++
RENDERTYPE ?= WIN
BUILDCFLAGS+= -DHAVE_INTTYPES
EXESUFFIX=.exe
LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32 #-lshfolder
# STDCPPLIB=-lstdc++
endif
ifeq ($(PLATFORM),BSD)
RENDERTYPE=SDL
BUILDCFLAGS+= -DHAVE_INTTYPES
RENDERTYPE=SDL
BUILDCFLAGS+= -DHAVE_INTTYPES
endif
ifeq ($(PLATFORM),BEOS)
RENDERTYPE=SDL
STDCPPLIB=-lstdc++
RENDERTYPE=SDL
STDCPPLIB=-lstdc++
endif
ifeq ($(PLATFORM),SKYOS)
RENDERTYPE=SDL
EXESUFFIX=.app
override NOASM=1
BUILDCFLAGS+= -DUNDERSCORES
SDLCONFIG=
SDLCONFIG_CFLAGS=-I/boot/programs/sdk/include/sdl
LIBS+= -lSDL -lnet
RENDERTYPE=SDL
EXESUFFIX=.app
override NOASM=1
BUILDCFLAGS+= -DUNDERSCORES
SDLCONFIG=
SDLCONFIG_CFLAGS=-I/boot/programs/sdk/include/sdl
LIBS+= -lSDL -lnet
endif
ifeq ($(PLATFORM),QNX)
RENDERTYPE=SDL
override USE_OPENGL=0
override NOASM=1
STDCPPLIB=-lstdc++
LIBS+= -lsocket
RENDERTYPE=SDL
override USE_OPENGL=0
override NOASM=1
STDCPPLIB=-lstdc++
LIBS+= -lsocket
endif
ifeq ($(PLATFORM),SUNOS)
RENDERTYPE=SDL
override USE_OPENGL=0
override NOASM=1
STDCPPLIB=-lstdc++
LIBS+= -lsocket -lnsl
RENDERTYPE=SDL
override USE_OPENGL=0
override NOASM=1
STDCPPLIB=-lstdc++
LIBS+= -lsocket -lnsl
endif
ifeq ($(PLATFORM),SYLLABLE)
RENDERTYPE=SDL
override USE_OPENGL=0
override NOASM=1
RENDERTYPE=SDL
override USE_OPENGL=0
override NOASM=1
endif
ifeq ($(RENDERTYPE),SDL)
ifeq ($(SDL_FRAMEWORK),1)
LIBS += -Wl,-framework,SDL
SDLCONFIG_CFLAGS+= -I/Library/Frameworks/SDL.framework/Headers
else
ifneq ($(SDLCONFIG),)
LIBS+= $(shell $(SDLCONFIG) --libs)
SDLCONFIG_CFLAGS+=$(shell $(SDLCONFIG) --cflags)
endif
endif
ifeq ($(SDL_FRAMEWORK),1)
LIBS += -Wl,-framework,SDL
SDLCONFIG_CFLAGS+= -I/Library/Frameworks/SDL.framework/Headers
else
ifneq ($(SDLCONFIG),)
LIBS+= $(shell $(SDLCONFIG) --libs)
SDLCONFIG_CFLAGS+=$(shell $(SDLCONFIG) --cflags)
endif
endif
ifeq (1,$(WITHOUT_GTK))
HAVE_GTK2=0
else
ifneq (No,$(shell pkg-config --exists gtk+-2.0 || echo No))
HAVE_GTK2=1
# 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
# include cairo, so we need to filter out those -l switches in order to link
ifneq ($(LINKED_GTK),0)
ifeq ($(GTKCOMPAT32),1)
LIBS+= $(shell pkg-config --libs gtk+-2.0 | sed 's/\s-l\(pango\)\{0,1\}cairo\S*\s/ /g')
else
LIBS+= $(shell pkg-config --libs gtk+-2.0)
endif
endif
else
HAVE_GTK2=0
endif
endif
ifeq (1,$(WITHOUT_GTK))
HAVE_GTK2=0
else
ifneq (No,$(shell pkg-config --exists gtk+-2.0 || echo No))
HAVE_GTK2=1
# 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
# include cairo, so we need to filter out those -l switches in order to link
ifneq ($(LINKED_GTK),0)
ifeq ($(GTKCOMPAT32),1)
LIBS+= $(shell pkg-config --libs gtk+-2.0 | sed 's/\s-l\(pango\)\{0,1\}cairo\S*\s/ /g')
else
LIBS+= $(shell pkg-config --libs gtk+-2.0)
endif
endif
else
HAVE_GTK2=0
endif
endif
else
ifeq ($(RENDERTYPE),WIN)
LIBS+= -mwindows -ldxguid
endif
ifeq ($(RENDERTYPE),WIN)
LIBS+= -mwindows -ldxguid
endif
endif
BUILDCFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1
ifneq (0,$(SUPERBUILD))
BUILDCFLAGS+= -DSUPERBUILD
BUILDCFLAGS+= -DSUPERBUILD
endif
ifneq (0,$(POLYMOST))
BUILDCFLAGS+= -DPOLYMOST
BUILDCFLAGS+= -DPOLYMOST
endif
ifneq (0,$(USE_OPENGL))
BUILDCFLAGS+= -DUSE_OPENGL
BUILDCFLAGS+= -DUSE_OPENGL
endif
ifneq (0,$(NOASM))
BUILDCFLAGS+= -DNOASM
BUILDCFLAGS+= -DNOASM
endif
ifneq (0,$(LINKED_GTK))
BUILDCFLAGS+= -DLINKED_GTK
BUILDCFLAGS+= -DLINKED_GTK
endif
ifneq (0,$(POLYMER))
@ -195,7 +209,7 @@ ifneq (0,$(POLYMER))
endif
ifneq (0,$(NEDMALLOC))
BUILDCFLAGS+= -DNEDMALLOC
BUILDCFLAGS+= -DNEDMALLOC
endif
ifeq ($(PRETTY_OUTPUT),1)

View file

@ -77,6 +77,7 @@
# endif
# include <fcntl.h>
# include <ctype.h>
# include <stdint.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <errno.h>
@ -540,5 +541,10 @@ char *Bstrupr(char *);
}
#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__

View file

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

View file

@ -57,4 +57,4 @@ int32_t krd_print(const char *filename);
void krd_enable(int32_t which);
#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 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 xyzmirror(int32_t i,int32_t wn);
#endif
#endif