X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=makefile.inc;h=33cbc0438525ef568d77e9858a68673580f2f160;hb=316549daf20e3a6a71841f87da516f7bb9cf340f;hp=2534cff705da601a3b61acbd5cb46d0c77557cf8;hpb=86401a55abf8aa5bab83820146bd7154e077630a;p=xonotic%2Fdarkplaces.git diff --git a/makefile.inc b/makefile.inc index 2534cff7..33cbc043 100644 --- a/makefile.inc +++ b/makefile.inc @@ -126,18 +126,20 @@ OBJ_MENU= \ # note that builddate.c is very intentionally not compiled to a .o before # being linked, because it should be recompiled every time an executable is # built to give the executable a proper date string -OBJ_SV= builddate.c sys_unix.o vid_null.o thread_null.o $(OBJ_SND_NULL) $(OBJ_COMMON) +OBJ_SV= builddate.c sys_null.o vid_null.o thread_null.o $(OBJ_SND_NULL) $(OBJ_COMMON) OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o thread_sdl.o $(OBJ_MENU) $(OBJ_SND_COMMON) $(OBJ_SND_XMP) snd_sdl.o $(OBJ_VIDEO_CAPTURE) $(OBJ_COMMON) # Compilation +# -D_POSIX_C_SOURCE=200809L doesn't enable all of POSIX 2008, wtf? +# -D_DEFAULT_SOURCE does enables all of POSIX 2008 (without GNU extensions). ifeq ($(PEDANTIC),1) - CFLAGS_STANDARD=-std=c11 -pedantic -D_POSIX_C_SOURCE=200809L -DCONFIG_PEDANTIC + CFLAGS_STANDARD=-std=c17 -pedantic -D_DEFAULT_SOURCE -DCONFIG_PEDANTIC else CFLAGS_STANDARD= endif -CFLAGS_WARNINGS=-Wall -Winline -Werror=vla -Werror=c++-compat -Wwrite-strings -Wshadow -Wold-style-definition -Wstrict-prototypes -Wsign-compare -Wdeclaration-after-statement -Wmissing-prototypes +CFLAGS_WARNINGS=-Wall -Werror=vla -Wc++-compat -Wwrite-strings -Wshadow -Wold-style-definition -Wstrict-prototypes -Wsign-compare -Wdeclaration-after-statement -Wmissing-prototypes CFLAGS_TCC= ifeq ($(CC), tcc) @@ -171,14 +173,17 @@ ifeq ($(DP_SSE),1) endif # bones_was_here: added -mno-avx because when compiling for (at least) haswell or skylake with gcc or clang, with both -O2 and -O3, AVX auto-vectorisation causes subtle bugs in Xonotic QC physics, and changes the hash generated by the CI pipeline. AVX2 seems to be OK. -OPTIM_DEBUG=$(CPUOPTIMIZATIONS) +# We can get good stack traces at -O1 with -fno-omit-frame-pointer (as recommended by ASan docs) for a hefty boost compared to unoptimised. +OPTIM_DEBUG=-O1 -fno-omit-frame-pointer $(CPUOPTIMIZATIONS) #OPTIM_RELEASE=-O2 -fno-strict-aliasing -ffast-math -funroll-loops $(CPUOPTIMIZATIONS) #OPTIM_RELEASE=-O2 -fno-strict-aliasing -fno-math-errno -fno-trapping-math -fno-signaling-nans -fcx-limited-range -funroll-loops $(CPUOPTIMIZATIONS) #OPTIM_RELEASE=-O2 -fno-strict-aliasing -funroll-loops $(CPUOPTIMIZATIONS) #OPTIM_RELEASE=-O2 -fno-strict-aliasing $(CPUOPTIMIZATIONS) #OPTIM_RELEASE=-O3 -fno-strict-aliasing $(CPUOPTIMIZATIONS) #OPTIM_RELEASE=-O3 -fno-strict-aliasing -fno-math-errno -fno-trapping-math $(CPUOPTIMIZATIONS) -OPTIM_RELEASE=-O3 -fno-math-errno -fno-trapping-math $(CPUOPTIMIZATIONS) +# -Winline is here instead of in CFLAGS_WARNINGS because we need inlining disabled for good stack traces in debug builds, +# also because UBSan and ASan cause this warning to be spammed. +OPTIM_RELEASE=-O3 -fno-math-errno -fno-trapping-math $(CPUOPTIMIZATIONS) -Winline # NOTE: *never* *ever* use the -ffast-math or -funsafe-math-optimizations flag # Also, since gcc 5, -ffinite-math-only makes NaN and zero compare equal inside engine code but not inside QC, which causes error spam for seemingly valid QC code like if (x != 0) return 1 / x; @@ -216,8 +221,10 @@ CMD_UNIXMKDIR=mkdir -p ##### Linux specific variables ##### # Link -LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl $(LDFLAGS_UNIXSDL) +# -rdynamic allows glibc backtrace_symbols_fd() to convert addresses to function names +# with a much smaller binary than with full debug symbols +LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -rdynamic +LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -rdynamic $(LDFLAGS_UNIXSDL) ##### Mac OS X specific variables #####