compiler settings alignment between macOS.2020 and linux.2020

get the warning flags on linux and macOS into better alignment

move the compiler flags into hints/include/compiler.2020 so that
maintenance changes can be made there and take effect for both
linux and macOS

this will likely trigger some initial new code warnings to be
investigated on either or both platforms
This commit is contained in:
nhmall
2021-01-22 16:05:30 -05:00
parent 77d4b4c955
commit 18a4a41b15
4 changed files with 90 additions and 77 deletions

View File

@@ -16,21 +16,11 @@
# linux.2020 hints file provides a single-user build for Linux (such
# as Ubuntu focal).
# compiler flags: CCFLAGS is used to construct a value for CFLAGS with
# various -I, -D, and -W settings appended below;
# these are the settings of most interest for an end-user build
# (clang doesn't support '-Og', gcc needs 4.x or later)
CCFLAGS = -g
#CCFLAGS = -g -Og
#CCFLAGS = -O2
# Note: this is not the usual 'CFLAGS' which is used in default
# rules for compiling C code; specifying a value for that on the
# 'make' command line should be avoided.
# note: '#-INCLUDE' is not just a comment; multiw-1 contains sections 1 to 3
# note: '#-INCLUDE' is not just a comment
# multiw-1.2020 contains sections 1 to 2
#-INCLUDE multiw-1.2020
# 4. If you set WANT_WIN_QT, you need to
# 3. If you set WANT_WIN_QT, you need to
# A) set QTDIR either here or in the environment to point to the Qt5
# Library installation root.
# B) set XPMLIB to point to the Xpm library
@@ -46,7 +36,7 @@ ifndef LIBXPM
LIBXPM= -L/opt/X11/lib -lXpm
endif
#5. Other
#4. Other
GAMEUID = $(USER)
GAMEGRP = games
@@ -57,21 +47,10 @@ GAMEGRP = games
#-INCLUDE multiw-2.2020
CFLAGS=$(CCFLAGS) -I../include -DNOTPARMDECL
# compiler.2020 contains compiler detection and adjustments common
# to both linux and macOS
ifeq "$(CCISCLANG)" ""
# get the version of gcc
GCCGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9)
ifeq "$(GCCGTEQ9)" "1"
CFLAGS+=-Wno-format-overflow
endif #gcc version greater than or equal to 9
endif #not clang
# As of LLVM build 2336.1.00, this gives dozens of spurious messages, so
# leave it out by default.
#CFLAGS+=-Wunreachable-code
#CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit \
# -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings
#CFLAGS+=-DGCC_WARN
#-INCLUDE compiler.2020
# NetHack sources control
CFLAGS+=-DDLB