]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Makefile: misc cleanups and fixes
authorbones_was_here <bones_was_here@xonotic.au>
Tue, 26 Dec 2023 09:53:50 +0000 (19:53 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Tue, 26 Dec 2023 12:10:16 +0000 (22:10 +1000)
Mostly removing cruft, deduplicating, consolidating.

Defaults to system default compiler instead of gcc.
Fixes parallel builds which were broken in
8a9f7e9e336cede20ec7da6bebc0f81a86ab79db by insufficient RTFM.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
makefile
makefile.inc

index a3cdd69d9108f4ddc75588b556cd7a7d51e63945..6b01dcbfdf5de1088eafddcf4606cb958224b963 100644 (file)
--- a/makefile
+++ b/makefile
@@ -66,13 +66,6 @@ else
        CMD_MKDIR=$(CMD_UNIXMKDIR)
 endif
 
-# 64bits AMD CPUs use another lib directory
-ifeq ($(DP_MACHINE),x86_64)
-       UNIX_X11LIBPATH:=/usr/X11R6/lib64
-else
-       UNIX_X11LIBPATH:=/usr/X11R6/lib
-endif
-
 # default targets
 TARGETS_DEBUG=sv-debug sdl-debug
 TARGETS_PROFILE=sv-profile sdl-profile
@@ -80,6 +73,7 @@ TARGETS_RELEASE=sv-release sdl-release
 TARGETS_RELEASE_PROFILE=sv-release-profile sdl-release-profile
 TARGETS_NEXUIZ=sv-nexuiz sdl-nexuiz
 
+
 ###### Optional features #####
 DP_VIDEO_CAPTURE?=enabled
 ifeq ($(DP_VIDEO_CAPTURE), enabled)
@@ -210,26 +204,6 @@ ifeq ($(DP_MAKE_TARGET), bsd)
 endif
 
 # Win32 configuration
-ifeq ($(WIN32RELEASE), 1)
-#      TARGET=i686-pc-mingw32
-#      CC=$(TARGET)-g++
-#      WINDRES=$(TARGET)-windres
-       CPUOPTIMIZATIONS=-march=pentium3 -mfpmath=sse -fno-math-errno -fno-rounding-math -fno-signaling-nans -fno-trapping-math
-#       CPUOPTIMIZATIONS+=-DUSE_WSPIAPI_H -DSUPPORTIPV6
-       LDFLAGS_WINCOMMON=-Wl,--large-address-aware
-else
-       LDFLAGS_WINCOMMON=
-endif
-
-ifeq ($(WIN64RELEASE), 1)
-#      TARGET=x86_64-pc-mingw32
-#      CC=$(TARGET)-g++
-#      WINDRES=$(TARGET)-windres
-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
-
-
 ifeq ($(DP_MAKE_TARGET), mingw)
        OBJ_ICON=darkplaces.o
        OBJ_ICON_NEXUIZ=nexuiz.o
@@ -258,6 +232,16 @@ endif
 
 ##### Library linking #####
 # SDL2
+SDL_CONFIG?=sdl2-config
+SDLCONFIG_UNIXCFLAGS?=`$(SDL_CONFIG) --cflags`
+SDLCONFIG_UNIXCFLAGS_X11?=
+SDLCONFIG_UNIXLIBS?=`$(SDL_CONFIG) --libs`
+SDLCONFIG_UNIXLIBS_X11?=-lX11
+SDLCONFIG_UNIXSTATICLIBS?=`$(SDL_CONFIG) --static-libs`
+SDLCONFIG_UNIXSTATICLIBS_X11?=-lX11
+SDLCONFIG_MACOSXCFLAGS=$(SDLCONFIG_UNIXCFLAGS)
+SDLCONFIG_MACOSXLIBS=$(SDLCONFIG_UNIXLIBS)
+SDLCONFIG_MACOSXSTATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS)
 ifeq ($(DP_LINK_SDL), shared)
        SDL_LIBS=$(SDLCONFIG_LIBS)
 else ifeq ($(DP_LINK_SDL), static)
@@ -349,10 +333,6 @@ endif
 
 
 ##### Extra CFLAGS #####
-ifneq ($(CC), tcc)
-       CFLAGS_MAKEDEP?=-MMD
-endif
-
 ifdef DP_FS_BASEDIR
        CFLAGS_FS=-DDP_FS_BASEDIR=\"$(DP_FS_BASEDIR)\"
 else
@@ -375,6 +355,7 @@ CFLAGS_NET=
 # Systems without IPv6 support should uncomment this:
 #CFLAGS_NET+=-DNOSUPPORTIPV6
 
+
 ##### GNU Make specific definitions #####
 
 DO_LD=$(CC) -o ../../../$@ $^ $(LDFLAGS)
index b24ab2be4befe670240db0b81db132cf3172b134..2534cff705da601a3b61acbd5cb46d0c77557cf8 100644 (file)
@@ -2,42 +2,7 @@
 CHECKLEVEL1 = @if [ "$(LEVEL)" != 1 ]; then $(MAKE) help; false; fi
 CHECKLEVEL2 = @if [ "$(LEVEL)" != 2 ]; then $(MAKE) help; false; fi
 
-# Choose the compiler you want to use
-CC?=gcc
-
-# athlon optimizations
-#CPUOPTIMIZATIONS?=-march=athlon
-# athlon xp optimizations
-#CPUOPTIMIZATIONS?=-march=athlon-xp
-# athlon 64 optimizations
-#CPUOPTIMIZATIONS?=-march=athlon64 -m32
-# Pentium 3 optimizations
-#CPUOPTIMIZATIONS?=-march=pentium3
-# Pentium 4 optimizations
-#CPUOPTIMIZATIONS?=-march=pentium4
-# 686 (Pentium Pro/II) optimizations
-#CPUOPTIMIZATIONS?=-march=i686
-# No specific CPU (386 compatible)
-CPUOPTIMIZATIONS?=
-# x86
-ifeq ($(DP_SSE),1)
-       CPUOPTIMIZATIONS+=-mno-avx
-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.
-# Also moved -fno-math-errno -fno-trapping-math (etc) to OPTIM_RELEASE as they're not CPU-specific.
-# 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;
 
-SDL_CONFIG?=sdl2-config
-SDLCONFIG_UNIXCFLAGS?=`$(SDL_CONFIG) --cflags`
-SDLCONFIG_UNIXCFLAGS_X11?=
-SDLCONFIG_UNIXLIBS?=`$(SDL_CONFIG) --libs`
-SDLCONFIG_UNIXLIBS_X11?=-lX11
-SDLCONFIG_UNIXSTATICLIBS?=`$(SDL_CONFIG) --static-libs`
-SDLCONFIG_UNIXSTATICLIBS_X11?=-lX11
-SDLCONFIG_MACOSXCFLAGS=$(SDLCONFIG_UNIXCFLAGS)
-SDLCONFIG_MACOSXLIBS=$(SDLCONFIG_UNIXLIBS)
-SDLCONFIG_MACOSXSTATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS)
 STRIP?=strip
 
 
@@ -172,10 +137,13 @@ else
        CFLAGS_STANDARD=
 endif
 
-CFLAGS_TCC=
+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_TCC=
 ifeq ($(CC), tcc)
        CFLAGS_TCC=-DSDL_DISABLE_IMMINTRIN_H
+else
+       CFLAGS_MAKEDEP?=-MMD
 endif
 
 CFLAGS_COMMON=$(CFLAGS_STANDARD) $(CFLAGS_TCC) $(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_SND_XMP) $(CFLAGS_NET) $(CFLAGS_SDL) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES -I../../../
@@ -195,6 +163,14 @@ else
        CFLAGS_SSE2=
 endif # ifeq ($(DP_SSE),1)
 
+# No specific CPU
+CPUOPTIMIZATIONS?=
+# x86
+ifeq ($(DP_SSE),1)
+       CPUOPTIMIZATIONS+=-mno-avx
+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)
 #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)
@@ -510,7 +486,6 @@ $(EXE_SDLNEXUIZ): $(OBJ_SDL) $(OBJ_ICON_NEXUIZ)
 
 # If requested, these targets must always run first:
 .EXTRA_PREREQS := $(filter clean clean-profile, $(MAKECMDGOALS))
-.NOTPARALLEL: $(.EXTRA_PREREQS)
 
 clean:
        -$(CMD_RM) $(EXE_SV)