Files
nethack/sys/unix/hints/include/multiw-2.500
T
nhmall 29951cccd1 add support for optional builder-created make.prefs
Set things up so that the Makefile build will look for 'make.prefs'
at the top of the NetHack source tree.

If 'make.prefs' is present, the Makefile build will include it
just ahead of the PRE section of a hints file specified to
sys/unix/setup.sh, or practically the first thing during a
Makefile build if no hints file was specified.

The advantage of using a 'make.prefs' is that instead of putting a
series of Makefile variable value assignments on the command line
each time, like this:
    make WANT_WIN_X11=1 WANT_WIN_TTY=1 WANT_WIN_CURSES=1 c2x=1 resp=1 update
you can, instead, put those preferences into make.prefs, like this:

# start of make.prefs
WANT_WIN_X11=1
WANT_WIN_TTY=1
WANT_WIN_CURSES=1
c2x=1
resp=1
# end of make.prefs

Now, my make command just needs to specify a target:
    make update

The syntax for checking whether make.prefs exists, and for including
it, is GNU make, or bsd make, specific, so sys/unix/mkmkfile.sh will
insert the correct syntax for the make that is in-use when
sys/unix/setup.sh is executed.

The 'make.prefs' file isn't limited to Makefile variable assignments, and
can contain any valid make syntax for the version of make on your system,
but adding make syntax beyond Makefile variable assignment will cause
your make.prefs file to become specific to that version of make. There
are syntactical differences between GNU make and bsd make, particularly
for directives and conditional tests.

The 'make.prefs' file can potentially eliminate much/all of the manual
editing of distributed repository Makefiles or hints files that you, as
a NetHack developer or builder, might routinely carry out.
You have the option of placing your preference changes in 'make.prefs'
instead.

Related reference for .500 hints file variables:

In the NetHack source tree:
sys/unix/README.hints

On GitHub:
https://github.com/NetHack/NetHack/blob/NetHack-5.0/sys/unix/README-hints

For example, on macOS, where GNU make is being used, and I typically
set things up using the macOS.500 hints file:
    sys/unix/setup.sh sys/unix/hints/macOS.500
I might have the following make.prefs in the root of my NetHack source tree:
#---- snip -------
$(info Attention - Using make.prefs)
WANT_MACSOUND=1
resp=1
#---- end-snip ---

For another example, on Linux, where GNU make is being used, and I
typically set things up using the linux.500 hints file:
    sys/unix/setup.sh sys/unix/hints/linux.500
I might have the following make.prefs file in the root of my NetHack
source tree:
#---- snip -------
$(info Using make.prefs)
WANT_WIN_X11=1
WANT_WIN_TTY=1
WANT_WIN_CURSES=1
c2x=1
resp=1
#---- end-snip ---
2026-05-18 13:03:31 -04:00

216 lines
4.5 KiB
Plaintext

#------------------------------------------------------------------------------
# NetHack 5.0 multiw-2.500 $NHDT-Date: 1599337709 2020/09/05 20:28:29 $ $NHDT-Branch: NetHack-5.0 $
#
# Sorts out support for multiple window ports (interfaces) to included in the build.
#
# Included from:
# hints/linux.500
# hints/macOS.500
#
# The following will be set appropriately following this:
# - WANT_WIN_XXX (at least one will be set; default is TTY)
# - WANT_DEFAULT (set to match one of the enabled WANT_WIN_XXX)
# - WINCFLAGS
# - WINSRC
# - WINOBJ0
#---
# User selections could be specified as combinations of any of the following:
# WANT_WIN_TTY=1, WANT_WIN_CURSES=1, WANT_WIN_QT=1, WANT_WIN_X11=1
# The selections will all be linked into the same binary.
#
# Assuming you have the prerequisite packages mentioned above, you can
# specify, right on the make command line, which window ports (or interfaces)
# to include in your build. Doing it via the make command line means that won't
# have to edit the Makefile.
#
# make WANT_WIN_QT=1 WANT_WIN_X11=1 WANT_WIN_CURSES=1 WANT_WIN_TTY=1 install
#
# Add WANT_DEFAULT=Qt (or other interface) if you want nethack to use
# something other than tty as the default interface.
#
ifdef WANT_WIN_ALL
WANT_WIN_TTY=1
WANT_WIN_CURSES=1
WANT_WIN_X11=1
WANT_WIN_QT=1
else
# Make sure that at least one interface is enabled.
ifndef WANT_WIN_TTY
ifndef WANT_WIN_CURSES
ifndef WANT_WIN_X11
ifndef WANT_WIN_QT
WANT_WIN_TTY=1
endif
endif
endif
endif
endif
ifdef WANT_LIBNH
WANT_DEFAULT=shim
endif
# Make sure that a default interface is specified; this doesn't guarantee
# sanity for something like 'make WANT_WIN_CURSES=1 WANT_DEFAULT=X11' but
# 'makedefs -v' would notice, complain, and quit causing 'make' to quit.
ifndef WANT_DEFAULT
# pick the first one enabled among { tty, curses, X11, Qt }
ifdef WANT_WIN_TTY
WANT_DEFAULT=tty
else
ifdef WANT_WIN_CURSES
WANT_DEFAULT=curses
else
ifdef WANT_WIN_X11
WANT_DEFAULT=X11
else
ifdef WANT_WIN_QT
WANT_DEFAULT=Qt
else
# ? shouldn't be able to get here...
endif
endif
endif
endif
endif
WINCFLAGS=
WINSRC =
WINOBJ0 =
SND_CFLAGS=
XTRASRC =
ifdef WANT_WIN_TTY
WINSRC += $(WINTTYSRC)
WINOBJ0 += $(WINTTYOBJ)
else
WINCFLAGS += -DNOTTYGRAPHICS
endif
ifdef WANT_WIN_CURSES
WINCFLAGS += -DCURSES_GRAPHICS
ifeq "$(USE_GENL_PUTMIXED)" "1"
WINCFLAGS += -DUSE_GENL_PUTMIXED
else
WINCFLAGS += -D_XOPEN_SOURCE_EXTENDED=1
endif
WINSRC += $(WINCURSESSRC)
WINOBJ0 += $(WINCURSESOBJ)
endif
ifdef WANT_WIN_X11
WINCFLAGS += -DX11_GRAPHICS
WINSRC += $(WIINX11SRC)
WINOBJ0 += $(WINX11OBJ)
XTRASRC += tile.c
endif
ifndef WANT_WIN_QT
ifdef WANT_WIN_ALL
WANT_WIN_QT=1
endif
ifdef WANT_WIN_QT4
ifndef WANT_WIN_QT
WANT_WIN_QT=1
endif # not WANT_WIN_QT
endif # WANT_WIN_QT4
ifdef WANT_WIN_QT5
ifndef WANT_WIN_QT
WANT_WIN_QT=1
endif # not WANT_WIN_QT
endif # WANT_WIN_QT5
ifdef WANT_WIN_QT6
ifndef WANT_WIN_QT
WANT_WIN_QT=1
endif # not WANT_WIN_QT
endif # WANT_WIN_QT6
endif # not def WANT_WIN_QT
ifdef WANT_WIN_QT
# WANT_WIN_QT5 is the default
ifndef WANT_WIN_QT4
ifndef WANT_WIN_QT5
ifndef WANT_WIN_QT6
WANT_WIN_QT5=1
endif # not WANT_WIN_QT6
endif # not WANT_WIN_QT5
endif # not WANT_WIN_QT4
ifdef WANT_WIN_QT4
#Slackware 14.2 puts Qt4 here
#if your Qt4 is elsewhere, change this to match
QT4DIR=/usr/lib64/qt
QTDIR=$(QT4DIR)
endif # WANT_WIN_QT4
endif # WANT_WIN_QT
ifdef WANT_WIN_QT
WINCFLAGS += -DQT_GRAPHICS
WINSRC += $(WINQTSRC)
WINOBJ0 += $(WINQTOBJ)
ifndef WANT_WIN_QT4
SNDCFLAGS += -DSND_LIB_QTSOUND
endif #! WANT_WIN_QT4
HAVE_SNDLIB = 1
NEEDS_SND_USERSOUNDS = 1
NEEDS_SND_SEAUTOMAP = 1
XTRASRC += tile.c
#
ifndef CPLUSPLUS_NEEDED
CPLUSPLUS_NEEDED = 1
endif # CPLUSPLUS_NEEDED
ifdef WANT_WIN_QT6
CPLUSPLUS_NEED20 = 1
CPLUSPLUS_NEED_DEPSUPPRESS = 1
endif # WANT_WIN_QT6
endif # WANT_WIN_QT
ifeq "$(GIT)" "1"
ifndef GITSUBMODULES
GITSUBMODULES=1
endif
endif
ifeq "$(git)" "1"
ifndef GITSUBMODULES
GITSUBMODULES=1
endif
endif
ifeq "$(CPPREGEX)" "1"
REGEXOBJ=$(TARGETPFX)cppregex.o
ifndef CPLUSPLUS_NEEDED
CPLUSPLUS_NEEDED = 1
endif
endif
ifeq "$(cppregex)" "1"
REGEXOBJ=$(TARGETPFX)cppregex.o
ifndef CPLUSPLUS_NEEDED
CPLUSPLUS_NEEDED = 1
endif
endif
ifeq "$(musl)" "1"
MUSL=1
endif
ifeq "$(MUSL)" "1"
ifneq "$(NOCRASHREPORT)" "1"
NOCRASHREPORT=1
endif
WINCFLAGS += -DMUSL_LIBC
# use this instead of col -bx
COLCMD=../util/stripbs
STRIPBS=../util/stripbs
else
WINCFLAGS += -DGNU_LIBC
endif
ifeq "$(NOCRASHREPORT)" "1"
WINCFLAGS += -DNOCRASHREPORT
endif
#end of hints/include/multiw-2.500
#------------------------------------------------------------------------------