less verbose compiler command lines during build

If using hints file sys/unix/hints/linux.370 or sys/unix/hints/macOS.370
allow the majority of the boilerplate compile switches to reside in a
compiler response file, instead of on the command line.

Include one of the following on your make command line:

make response=1
  or
make resp=1

It can be combined with other make command line options. See
sys/unix/README-hints for further information about those.

The response files that it uses are:
    CC   (clang or gcc)    src/nethack_cc.rsp
    CXx  (clang++ or g++)  src/nethack_cxx.rsp

Note: I think the reduced clutter should actually become the default,
and the override should be noresponse=1 to NOT use it, but I'm
not sure how others feel, so for now, it requires
    make resp=1
Feedback on whether that should become the default or not
is welcome.

Tested on Linux with gcc-15 and on Linux with clang-20.

I haven't had a chance to test it on macOS yet.
This commit is contained in:
nhmall
2025-09-07 12:50:54 -04:00
parent d5d40b322c
commit 349fbe93b1
6 changed files with 52 additions and 3 deletions

View File

@@ -198,7 +198,7 @@ ARFLAGS = rcs
# 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
# the C++ libraries linked in.
CXXFLAGS = $(CCXXFLAGS) -I. -I$(QTDIR)/include $(QTCXXFLAGS)
CXXFLAGS ?= $(CCXXFLAGS) -I. -I$(QTDIR)/include $(QTCXXFLAGS)
CXX ?= g++
MOC ?= moc
MOCPATH ?= $(QTDIR)/bin/$(MOC)
@@ -642,7 +642,11 @@ DATE_O = $(TARGETPFX)date.o
all: $(GAME)
@echo ""
pregame:
create_responsefiles:
echo $(CC_COMPILER_SWITCHES) >$(CC_RESPONSEFILE)
echo $(CXX_COMPILER_SWITCHES) >$(CXX_RESPONSEFILE)
pregame: $(RESPONSEFILES)
$(PREGAME)
$(GAME): pregame $(MAKEDEFS) $(LUALIB) $(WAVS) $(SYSTEM)
@@ -808,6 +812,7 @@ clean:
-rm -f *.o $(HACK_H) $(CONFIG_H)
-rm -f monstr.c vis_tab.c ../include/vis_tab.h #obsolete generated files
true; $(CLEANMORE)
true; $(CLEAN_CC_RESPONSEFILE) $(CLEAN_CXX_RESPONSEFILE)
spotless: clean
-rm -f a.out core $(HACKLIB) $(GAMEBIN) Sys*