Add -fcommon to CFLAGS to unbreak the build against modern compilers,

e.g. Clang 11 or GCC 10, and remove unsupported optimization options.

Reported by:	pkg-fallout
This commit is contained in:
Alexey Dokuchaev 2020-09-10 04:04:40 +00:00
parent 4b06166895
commit 73f76d306b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=548182
2 changed files with 18 additions and 14 deletions

View File

@ -26,7 +26,7 @@
-X11_LDFLAGS=-L/usr/X11R6/lib -lX11 -lXext
+
+# Compiler flags.
+SHARED_FLAGS:=-Isource -I./ -I../ $(CFLAGS)
+SHARED_FLAGS:=-Isource -I./ -I../ $(CFLAGS) -fcommon
+RELEASE_CFLAGS=$(SHARED_FLAGS)
+DEBUG_CFLAGS=$(SHARED_FLAGS) -g -DC_ONLY
+
@ -80,7 +80,7 @@
-ifeq ($(wildcard /usr/include/X11/extensions/xf86vmode.h),/usr/include/X11/extensions/xf86vmode.h)
+ifeq ($(strip $(WITH_OPT_CFLAGS)),YES)
+RELEASE_CFLAGS += -O2 -fno-strict-aliasing -ffast-math -fexpensive-optimizations
+RELEASE_CFLAGS += -O2 -fno-strict-aliasing -ffast-math
+endif
+
+ifeq ($(strip $(WITH_HOMEDIR)),YES)

View File

@ -1,5 +1,5 @@
--- ./Makefile.orig Sun Dec 31 14:01:34 2006
+++ ./Makefile Fri Jan 5 15:51:35 2007
--- Makefile.orig 2006-12-31 17:01:34 UTC
+++ Makefile
@@ -9,7 +9,7 @@
# Check OS type.
@ -162,14 +162,25 @@
BASE_CFLAGS+=-I$(LOCALBASE)/include \
-I$(X11BASE)/include \
@@ -168,15 +165,11 @@ RELEASE_CFLAGS+=$(BASE_CFLAGS) \
@@ -158,25 +155,18 @@ BASE_CFLAGS+=-I$(LOCALBASE)/include \
-DGAME_NAME='\"$(GAME_NAME)\"' \
-DQ2P_VERSION='\"$(VERSION)\"' \
-DCC_VERSION='\"$(CC_VERSION)\"' \
- -Wall \
+ -Wall -fcommon \
-pipe #-Werror
RELEASE_CFLAGS+=$(BASE_CFLAGS) \
- -ffloat-store \
-fno-strict-aliasing \
-DNDEBUG
ifeq ($(strip $(OPTIMIZE)),YES)
RELEASE_CFLAGS+=-O3 \
- -march=$(MARCH) \
-funroll-loops \
-fstrength-reduce \
-fexpensive-optimizations \
- -fstrength-reduce \
- -fexpensive-optimizations \
- -falign-loops=2 \
- -falign-jumps=2 \
- -falign-functions=2
@ -230,10 +241,3 @@
@echo
@echo "**Built $@ with cflags:"
@echo "$(CC) $(CC_VERSION) $(CFLAGS)";
@@ -935,4 +928,4 @@ bz2:
@tar cjvf $(Q2P_VERSION_BZ2)-$(OSTYPE)-$(DATE).tar.bz2 $(BINDIR)
@printf ".... Done.\n"
-
\ No newline at end of file
+