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
@ -44,11 +48,11 @@ o=o
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))
@ -76,11 +80,11 @@ 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,11 +92,12 @@ 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
@ -174,6 +179,7 @@ ifeq ($(PLATFORM),WINDOWS)
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))
@ -202,6 +208,9 @@ MISCLINKOPTS=
ifneq (0,$(KRANDDEBUG)) ifneq (0,$(KRANDDEBUG))
MISCLINKOPTS=-Wl,-Map=$@.memmap MISCLINKOPTS=-Wl,-Map=$@.memmap
endif endif
ifneq (0,$(PROFILER))
MISCLINKOPTS=-pg
endif
ifeq ($(PRETTY_OUTPUT),1) ifeq ($(PRETTY_OUTPUT),1)
.SILENT: .SILENT:
@ -248,7 +257,7 @@ 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"

View file

@ -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,15 +75,19 @@ 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 endif
ifneq (0,$(PROFILER))
LIBS+= -lprofiler
debug+= -pg
endif
endif endif
ifneq (0,$(DEBUGANYWAY)) ifneq (0,$(DEBUGANYWAY))
@ -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=

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

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);