separate the C compiler flags and C++ compiler flags where needed
This commit is contained in:
@@ -176,7 +176,7 @@ SYSOBJ = $(TARGETPFX)ioctl.o $(TARGETPFX)unixmain.o $(TARGETPFX)unixtty.o \
|
|||||||
# The Qt and Be window systems are written in C++, while the rest of
|
# The Qt and Be window systems are written in C++, while the rest of
|
||||||
# NetHack is standard C. If using Qt, uncomment the LINK line here to get
|
# NetHack is standard C. If using Qt, uncomment the LINK line here to get
|
||||||
# the C++ libraries linked in.
|
# the C++ libraries linked in.
|
||||||
CXXFLAGS = $(CFLAGS) -I. -I$(QTDIR)/include $(QTCXXFLAGS)
|
CXXFLAGS = $(CCXXFLAGS) -I. -I$(QTDIR)/include $(QTCXXFLAGS)
|
||||||
CXX ?= g++
|
CXX ?= g++
|
||||||
MOC ?= moc
|
MOC ?= moc
|
||||||
#LINK=g++
|
#LINK=g++
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers \
|
|||||||
CFLAGS+=-pedantic
|
CFLAGS+=-pedantic
|
||||||
CFLAGS+=-Wmissing-declarations
|
CFLAGS+=-Wmissing-declarations
|
||||||
CFLAGS+=-Wformat-nonliteral
|
CFLAGS+=-Wformat-nonliteral
|
||||||
CFLAGS+=-DGCC_WARN
|
|
||||||
# As of LLVM build 2336.1.00, this gives dozens of spurious messages, so
|
# As of LLVM build 2336.1.00, this gives dozens of spurious messages, so
|
||||||
# # leave it out by default.
|
# # leave it out by default.
|
||||||
# #CFLAGS+=-Wunreachable-code
|
# #CFLAGS+=-Wunreachable-code
|
||||||
@@ -46,39 +45,42 @@ CFLAGS+=-Wmissing-prototypes
|
|||||||
CFLAGS+=-Wold-style-definition
|
CFLAGS+=-Wold-style-definition
|
||||||
CFLAGS+=-Wstrict-prototypes
|
CFLAGS+=-Wstrict-prototypes
|
||||||
|
|
||||||
ifdef WANT_WIN_QT
|
CCXXFLAGS = -g -I../include -DNOTPARMDECL
|
||||||
QTCXXFLAGS = -g -I../include -DNOTPARMDECL
|
CCXXFLAGS+=-Wall -Wextra -Wno-missing-field-initializers \
|
||||||
QTCXXFLAGS+=-Wall -Wextra -Wno-missing-field-initializers \
|
|
||||||
-Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings
|
-Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings
|
||||||
QTCXXFLAGS+=-pedantic
|
CCXXFLAGS+=-pedantic
|
||||||
QTCXXFLAGS+=-Wmissing-declarations
|
CCXXFLAGS+=-Wmissing-declarations
|
||||||
QTCXXFLAGS+=-Wformat-nonliteral
|
CCXXFLAGS+=-Wformat-nonliteral
|
||||||
QTCXXFLAGS+=-DGCC_WARN
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq "$(CCISCLANG)" ""
|
ifeq "$(CCISCLANG)" ""
|
||||||
#gcc-specific here
|
# gcc-specific follows
|
||||||
CFLAGS+=-Wmissing-parameter-type
|
CFLAGS+=-Wmissing-parameter-type
|
||||||
|
ifdef WANT_WIN_QT
|
||||||
|
CCXXFLAGS+= -Wno-deprecated-copy
|
||||||
|
endif # WANT_WIN_QT
|
||||||
# get the version of gcc
|
# get the version of gcc
|
||||||
GCCGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9)
|
GCCGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9)
|
||||||
ifeq "$(GCCGTEQ9)" "1"
|
ifeq "$(GCCGTEQ9)" "1"
|
||||||
# flags present in gcc version greater than or equal to 9 can go here
|
# flags present in gcc version greater than or equal to 9 can go here
|
||||||
#CFLAGS+=-Wno-format-overflow
|
CFLAGS+=-Wformat-overflow
|
||||||
endif #gcc version greater than or equal to 9
|
endif #gcc version greater than or equal to 9
|
||||||
|
#still in gcc-specific section here
|
||||||
ifdef WANT_WIN_QT
|
|
||||||
# get the version of g++
|
# get the version of g++
|
||||||
GPPGTEQ9 := $(shell expr `$(CXX) -dumpversion | cut -f1 -d.` \>= 9)
|
GPPGTEQ9 := $(shell expr `$(CXX) -dumpversion | cut -f1 -d.` \>= 9)
|
||||||
ifeq "$(GPPGTEQ9)" "1"
|
ifeq "$(GPPGTEQ9)" "1"
|
||||||
#QTCXXFLAGS+=-Wno-format-overflow
|
CCXXFLAGS+=-Wformat-overflow
|
||||||
endif #g++ version greater than or equal to 9
|
endif #g++ version greater than or equal to 9
|
||||||
#QTCXXFLAGS+= -Wno-format-truncation
|
# end of gcc-specific
|
||||||
QTCXXFLAGS+= -Wno-deprecated-copy
|
|
||||||
endif #WANT_WIN_QT
|
|
||||||
|
|
||||||
else # clang
|
else # clang-specific follows
|
||||||
# clang-specific here
|
ifdef WANT_WIN_QT
|
||||||
endif # clang
|
CCXXFLAGS+=-Wno-deprecated-declarations
|
||||||
|
endif # WANT_WIN_QT
|
||||||
|
endif # clang-specific ends here
|
||||||
|
|
||||||
|
# enable some optional code in various NetHack source files
|
||||||
|
CFLAGS+=-DGCC_WARN
|
||||||
|
CCXXFLAGS+=-DGCC_WARN
|
||||||
|
|
||||||
#end of compiler.2020
|
#end of compiler.2020
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ SYSCFLAGS=-DLUA_USE_POSIX
|
|||||||
LINK=g++
|
LINK=g++
|
||||||
CXX=g++ -std=gnu++11
|
CXX=g++ -std=gnu++11
|
||||||
|
|
||||||
QTCXXFLAGS = $(CFLAGS)
|
CCXXFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
WINSRC = $(WINQTSRC)
|
WINSRC = $(WINQTSRC)
|
||||||
WINOBJ = $(WINQTOBJ)
|
WINOBJ = $(WINQTOBJ)
|
||||||
|
|||||||
@@ -115,14 +115,6 @@ endif # WANT_WIN_X11
|
|||||||
ifdef WANT_WIN_QT
|
ifdef WANT_WIN_QT
|
||||||
# Qt5 requires C++11
|
# Qt5 requires C++11
|
||||||
LINK = $(CXX)
|
LINK = $(CXX)
|
||||||
QTCXXFLAGS += -Wno-deprecated-declarations
|
|
||||||
ifeq "$(CCISCLANG)" ""
|
|
||||||
# get the version of g++
|
|
||||||
GPPGTEQ9 := $(shell expr `$(CXX) -dumpversion | cut -f1 -d.` \>= 9)
|
|
||||||
ifeq "$(GPPGTEQ9)" "1"
|
|
||||||
QTCXXFLAGS+= -Wno-format-truncation
|
|
||||||
endif #g++ version greater than or equal to 9
|
|
||||||
endif #not clang
|
|
||||||
QTCXXFLAGS += $(sort $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags))
|
QTCXXFLAGS += $(sort $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags))
|
||||||
QTCXXFLAGS += -fPIC
|
QTCXXFLAGS += -fPIC
|
||||||
WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
|
WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
|
||||||
|
|||||||
@@ -120,14 +120,6 @@ endif # WANT_WIN_X11
|
|||||||
ifdef WANT_WIN_QT
|
ifdef WANT_WIN_QT
|
||||||
# Qt5 requires C++11
|
# Qt5 requires C++11
|
||||||
LINK = $(CXX)
|
LINK = $(CXX)
|
||||||
QTCXXFLAGS += -Wno-deprecated-declarations
|
|
||||||
ifeq "$(CCISCLANG)" ""
|
|
||||||
# get the version of g++
|
|
||||||
GPPGTEQ9 := $(shell expr `$(CXX) -dumpversion | cut -f1 -d.` \>= 9)
|
|
||||||
ifeq "$(GPPGTEQ9)" "1"
|
|
||||||
QTCXXFLAGS+= -Wno-format-truncation
|
|
||||||
endif #g++ version greater than or equal to 9
|
|
||||||
endif #not clang
|
|
||||||
QTCXXFLAGS += $(sort $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags))
|
QTCXXFLAGS += $(sort $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags))
|
||||||
WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
|
WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
|
||||||
WINSRC += $(WINQTSRC)
|
WINSRC += $(WINQTSRC)
|
||||||
|
|||||||
Reference in New Issue
Block a user