--- /dev/null
+#------------------------------------------------------------------------------
+# NetHack 3.7 multiw-1.2020 $NHDT-Date: 1597332785 2020/08/13 15:33:05 $ $NHDT-Branch: NetHack-3.7 $
+
+# 1. Which windowing interface(s) should be included in this binary?
+# One or more of these can be manually uncommented and/or can be specified
+# on the 'make' command line. If none are enabled, tty will be used.
+#WANT_WIN_TTY=1
+#WANT_WIN_CURSES=1
+#WANT_WIN_X11=1
+#WANT_WIN_QT=1
+
+# 2. What is the default window system?
+# Exactly one of these can be manually uncommented and/or can be specified
+# on the 'make' command line. If none is enabled, the first among
+# WANT_WIN_{tty,curses,X11,Qt} that is enabled will become default.
+#WANT_DEFAULT=tty
+#WANT_DEFAULT=curses
+#WANT_DEFAULT=Qt
+#WANT_DEFAULT=X11
+
+# 3. compiler detection or optional override
+CCISCLANG := $(shell echo `$(CC) --version` | grep clang)
+ifeq "$(CCISCLANG)" ""
+CXX=g++ -std=gnu++11
+else
+CXX=clang++ -std=gnu++11
+endif
+# if you want to override the compiler detection just carried out
+# uncomment one of the following pairs as desired.
+#CC= gcc
+#CXX= g++ -std-gnu++11
+#
+#CC= clang
+#CXX=clang++ -std=gnu++11
+
+#end of multiw-1.2020
+#------------------------------------------------------------------------------
--- /dev/null
+#------------------------------------------------------------------------------
+# NetHack 3.7 multiw-2.2020 $NHDT-Date: 1597332785 2020/08/13 15:33:05 $ $NHDT-Branch: NetHack-3.7 $
+#
+# Sorts out support for multiple window ports (interfaces) to included in the build.
+#
+# Included from:
+# hints/linux.2020
+# hints/macOS.2020
+#
+# 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:
+# WIN_WANT_TTY=1, WIN_WANT_CURSES=1, WIN_WANT_QT=1, WIN_WANT_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.
+#
+
+# Make sure that at least one interface is enabled.
+ifndef WANT_WIN_ALL
+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_WIN_ALL
+WANT_WIN_TTY=1
+WANT_WIN_CURSES=1
+WANT_WIN_X11=1
+WANT_WIN_QT=1
+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 =
+
+ifdef WANT_WIN_TTY
+WINSRC += $(WINTTYSRC)
+WINOBJ0 += $(WINTTYOBJ)
+else
+WINCFLAGS += -DNOTTYGRAPHICS
+endif
+
+ifdef WANT_WIN_CURSES
+WINCFLAGS += -DCURSES_GRAPHICS
+WINSRC += $(WINCURSESSRC)
+WINOBJ0 += $(WINCURSESOBJ)
+endif
+
+ifdef WANT_WIN_X11
+WINCFLAGS += -DX11_GRAPHICS
+WINSRC += $(WIINX11SRC)
+WINOBJ0 += $(WINX11OBJ)
+endif
+
+ifdef WANT_WIN_QT
+WINCFLAGS += -DQT_GRAPHICS
+WINSRC += $(WINQTSRC)
+WINOBJ0 += $(WINQTOBJ)
+endif
+
+#end of hints/include/multiw-2.2020
+#------------------------------------------------------------------------------
+
-#
-# NetHack 3.7 linux.2020 $NHDT-Date: 1597072358 2020/08/10 15:12:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.2 $
+# NetHack 3.7 linux.2020 $NHDT-Date: 1597332698 2020/08/13 15:31:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.5 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
# NetHack may be freely redistributed. See license for details.
#
-#-PRE
+#---------------------------------------------------------------------
# Linux hints file with support for multiple window ports (interfaces)
+# Tested on:
+# - Ubuntu focal
#
-# This hints file supports tty, curses, x11, and Qt in the same binary,
-# but:
-#
-# - For x11 support, you'll need to obtain and install x11 development libraries.
-# For example, on Ubuntu 20.04 (as of August 2020):
-# sudo apt-get install libx11-dev
-# sudo apt-get install libmotif-dev
-# sudo apt-get install libxaw7-dev
-# sudo apt install xfonts-utils
-# (That last one is for bdftopcf and mkfontdir utils)
-#
-# - For Qt support, you'll need to obtain and install Qt.
-# For example, on Ubuntu 20.04 (as of August 2020):
-# sudo apt-get install qtbase5-dev
-# sudo apt-get install qtmultimedia5-dev
-#
-# Another odd note about Qt on Linux is that if you find you are getting
-# the following error trying to run NetHack after you build it:
-# "error while loading shared libraries: libQt5Core.so.5:
-# cannot open shared object file: No such file or directory"
-# you may have to fix that (one-time only) by the following command:
-# sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
-#
-# - For curses support, you may need to obtain and install the
-# ncurses development libraries if they aren't already installed
-# with your distribution. They seem to be there already with Ubuntu 20.04, but
-# for example, if you needed to install ncurses:
-# sudo apt-get install libncurses-dev
-#
-# - tty support shouldn't require any prerequisite additional packages.
+# If this doesn't work for your distribution, consider making a new
+# hints file for it, rather than changing this one.
+# And let us know about it.
#
-# 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.
-#
-# 1. Which windowing interface(s) should be included in this binary?
-# One or more of these can be manually uncommented and/or can be specified
-# on the 'make' command line. If none are enabled, tty will be used.
-#WANT_WIN_TTY=1
-#WANT_WIN_CURSES=1
-#WANT_WIN_X11=1
-#WANT_WIN_QT=1
-
-# 1a. What is the default window system?
-# Exactly one of these can be manually uncommented and/or can be specified
-# on the 'make' command line. If none is enabled, the first among
-# WANT_WIN_{tty,curses,X11,Qt} that is enabled will become default.
-#WANT_DEFAULT=tty
-#WANT_DEFAULT=curses
-#WANT_DEFAULT=Qt
-#WANT_DEFAULT=X11
+#-PRE
+# linux.2020 hints file provides a single-user build for Linux (such
+# as Ubuntu focal).
+
+#-INCLUDE multiw-1.2020
+
+# 4. 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
+ifndef WANT_WIN_QT
+ifdef WANT_WIN_ALL
+WANT_WIN_QT=1
+endif
+endif
ifdef WANT_WIN_QT
QTDIR=/usr
-endif # WANT_WIN_QT
+endif # WANT_WIN_QT
ifndef LIBXPM
LIBXPM= -L/opt/X11/lib -lXpm
endif
-# 2. Not customizable in this linux.2020 hints file, which provides
-# a single-user build for Linux (such as Ubuntu focal).
+#5. Other
GAMEUID = $(USER)
GAMEGRP = games
-#
+#-----------------------------------------------------------------------------
# You shouldn't need to change anything below here (in the hints file; if
# you're reading this in Makefile augmented by hints, that may not be true).
#
-# 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
-
-# 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
-
-# compiler detection
-CCISCLANG := $(shell echo `$(CC) --version` | grep clang)
-ifeq "$(CCISCLANG)" ""
-CXX=g++ -std=gnu++11
-else
-CXX=clang++ -std=gnu++11
-endif
-
-ifdef WANT_WIN_QT
-# Qt5 requires C++11
-LINK = $(CXX)
-#MOC = moc
-else
-LINK = $(CC)
-endif
+#-INCLUDE multiw-2.2020
+# XXX -g vs -O should go here, -I../include goes in the makefile
CFLAGS=-g -O -I../include -DNOTPARMDECL
ifeq "$(CCISCLANG)" ""
# get the version of gcc
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
+
+# NetHack sources control
CFLAGS+=-DDLB
-CFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\"
+CFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
+CFLAGS+=-DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\"
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
CFLAGS+=-DTIMED_DELAY
-CFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
CFLAGS+=-DDUMPLOG
CFLAGS+=-DCONFIG_ERROR_SECURE=FALSE
+#CFLAGS+=-DGREPPATH=\"/usr/bin/grep\"
+CFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\"
+# older binaries use NOCLIPPING, but that disables SIGWINCH
+#CFLAGS+=-DNOCLIPPING
+#CFLAGS+=-DNOMAIL
#CFLAGS+=-DEXTRA_SANITY_CHECKS
#CFLAGS+=-DEDIT_GETLIN
#CFLAGS+=-DSCORE_ON_BOTL
#CFLAGS+=-DTTY_TILES_ESCCODES
#CFLAGS+=-DTTY_SOUND_ESCCODES
-WINSRC =
-WINOBJ0 =
-WINLIB =
+CFLAGS+= $(WINCFLAGS) #from multiwin.2020
+
VARDATND =
VARDATND0 =
CURSESLIB =
+#ifdef WANT_WIN_CHAIN
+#HINTSRC=$(CHAINSRC)
+#HINTOBJ=$(CHAINOBJ)
+#endif # WANT_WIN_CHAIN
+
ifdef WANT_WIN_TTY
-WINSRC += $(WINTTYSRC)
-WINOBJ0 += $(WINTTYOBJ)
CURSESLIB = -lncurses -ltinfo
-else # !WANT_WIN_TTY
-CFLAGS += -DNOTTYGRAPHICS
-endif # !WANT_WIN_TTY
+endif
ifdef WANT_WIN_CURSES
-CFLAGS += -DCURSES_GRAPHICS
-WINSRC += $(WINCURSESSRC)
-WINOBJ0 += $(WINCURSESOBJ)
CURSESLIB = -lncurses -ltinfo
endif
endif
ifdef WANT_WIN_X11
-CFLAGS += -DX11_GRAPHICS
USE_XPM=1
WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
VARDATND0 += x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
WINX11LIB += -lXpm
VARDATND0 += rip.xpm
endif
-WINSRC += $(WINX11SRC)
-WINOBJ0 += $(WINX11OBJ)
WINLIB += $(WINX11LIB)
LFLAGS=-L/opt/X11/lib
endif # WANT_WIN_X11
ifdef WANT_WIN_QT
-CFLAGS += -DQT_GRAPHICS
+# Qt5 requires C++11
+LINK = $(CXX)
QTCXXFLAGS += -Wno-deprecated-declarations
QTCXXFLAGS += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags)
QTCXXFLAGS += -fPIC
WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
-WINSRC += $(WINQTSRC)
-WINOBJ0 += $(WINQTOBJ)
VARDATND0 += nhtiles.bmp rip.xpm nhsplash.xpm pet_mark.xbm pilemark.xbm
# XXX if /Developer/qt exists and QTDIR not set, use that
ifndef QTDIR
$(error QTDIR not defined in the environment or Makefile)
endif # QTDIR
# XXX make sure QTDIR points to something reasonable
-POSTINSTALL+= cp -n sys/unix/sysconf $(INSTDIR)/sysconf; \
- $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; \
- $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; \
- chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; \
( cd $(INSTDIR); mkfontdir -x .lev );
+else
+LINK = $(CC)
endif # !WANT_WIN_QT
# prevent duplicate tile.o in WINOBJ
$(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; \
$(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; \
chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
+
+ifneq "$(CCISCLANG)" ""
# gdb may not be installed if clang is chosen compiler so the game
# won't start in that case due to a sysconf error. Comment out
# relevant lines in sysconf.
POSTINSTALL+= sed -i -e 's;^GDBPATH=/usr/bin/gdb;\#GDBPATH=/usr/bin/gdb;' \
-e 's;PANICTRACE_GDB=1;PANICTRACE_GDB=0;' $(INSTDIR)/sysconf;
+endif
# when building liblua.a, avoid warning that use of tmpnam() should be
# replaced by mkstemp(); the lua code doesn't use nethack's config.h so
# if TTY_TILES_ESCCODES
#WINSRC += tile.c
#WINOBJ += tile.o
+# endif
CHOWN=true
CHGRP=true
-# NetHack 3.7 macOS.2020 $NHDT-Date: 1596489016 2020/08/03 21:10:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.65 $
+# NetHack 3.7 macOS.2020 $NHDT-Date: 1597332721 2020/08/13 15:32:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.67 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015.
# NetHack may be freely redistributed. See license for details.
#
-#-PRE
-# macOS X hints file
+#---------------------------------------------------------------------
+# MacOS hints file with support for multiple window ports (interfaces)
# Tested on:
# - MacOS Catalina 10.15
#
-# If this doesn't work for some other version of Mac OS X, make a new file for
-# that OS, don't change this one. And let us know about it.
+# If this doesn't work for some other version of Mac OS X, consider
+# making a new hints file it, rather than changing this one.
+# And let us know about it.
# Useful info: http://www.opensource.apple.com/darwinsource/index.html
-#
-# This hints file supports tty, curses, x11, and Qt in the same binary,
-# but:
-# - You'll need to obtain and install XQuartz if you want X11 support.
-# (Attempting to run X11.app will describe where to get it.)
-# One possible way: brew install xquartz
-#
-# - You'll need to obtain and install Qt if you want Qt support
-# One possible way: brew install Qt
-#
-# - You'll need to obtain and install the ncurses development libraries
-# if you want curses window port support.
-#
-# Assuming you have the prerequisite packages, You can specify the
-# window ports to include on the make command line without requiring
-# you to edit the Makefile:
-# make WANT_WIN_QT=1 WANT_WIN_X11=1 WANT_WIN_CURSES=1 WANT_WIN_TTY=1 all
-# in the src/ directory prior to 'make install' in the top directory.
-# Add WANT_DEFAULT=Qt (or other interface) if you want nethack to use
-# something other than tty as the default interface.
+#-PRE xxxx
+# macOS X hints file
#
-# This hints file can build several different interfaces and several
-# types of installations (private, shared, source).
-# Edit the section (1.) to control which interface(s).
-# Edit the section (2.) to match the type of build you need.
-
-# 1. Which windowing interface(s) should be included in this binary?
-# One or more of these can be manually uncommented and/or can be specified
-# on the 'make' command line. If none are enabled, tty will be used.
-#WANT_WIN_TTY=1
-#WANT_WIN_CURSES=1
-#WANT_WIN_X11=1
-#WANT_WIN_QT=1
-
-# 1a. What is the default window system?
-# Exactly one of these can be manually uncommented and/or can be specified
-# on the 'make' command line. If none is enabled, the first among
-# WANT_WIN_{tty,curses,X11,Qt} that is enabled will become default.
-#WANT_DEFAULT=tty
-#WANT_DEFAULT=curses
-#WANT_DEFAULT=Qt
-#WANT_DEFAULT=X11
-
-# 1b. If you set WANT_WIN_QT, you need to
+#-INCLUDE multiw-1.2020
+
+# 4. 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. (Qt2, Qt3, Qt4 will not work)
# B) set XPMLIB to point to the Xpm library
+ifndef WANT_WIN_QT
+ifdef WANT_WIN_ALL
+WANT_WIN_QT=1
+endif
+endif
ifdef WANT_WIN_QT
#QTDIR=/Developer/Qt
# Qt installed via homebrew
LIBXPM= -L/opt/X11/lib -lXpm
endif
-# 2. Is this a build for a binary that will be shared among different users
-# or will it be private to you?
-# If it is shared:
-# - it will be owned by the user and group listed
-# - if the user does not exist, you MUST create it before installing
-# NetHack
-# - if the group does not exist, it will be created.
-# NB: if the group already exists and is being used for something
-# besides games, you probably want to specify a new group instead
-# NB: the group will be created locally; if your computer is centrally
-# administered this may not be what you (or your admin) want.
-# Consider a non-shared install (WANT_SHARE_INSTALL=0) instead.
-# - 'make install' must be run as "sudo make install"
-# Note: 'make install' starts out be removing all files and subdirectories
-# from the target destination. Use 'make update' instead if there is
-# anything there that you want to keep such as the high scores file from
-# a previous install.
-#WANT_SHARE_INSTALL=1
-GAMEUID = $(USER)
-GAMEGRP = games
-# build to run in the source tree - primarily for development. Build
-# with "make all"
-#WANT_SOURCE_INSTALL=1
-
-# 3. miscellaneous: compiler selection; Qt5 requires C++11
-ifdef WANT_WIN_QT
-CC=clang
-CXX=clang++ -std=gnu++11
-#CC=gcc
-#CXX=g++ -std=gnu++11
-LINK= $(CXX)
-else
-# compiling C code only; CC and CXX defaults can be used
-#CC=
-#CXX=
-LINK = $(CC)
-endif
-#MOC = moc
-
-# At the moment the 'chain' interface is just for debugging, but in the future
-# it could be useful for other things. Requires SYSCF and an ANSI compiler.
-#WANT_WIN_CHAIN=1
+# 5. Other
-#
+#-----------------------------------------------------------------------------
# You shouldn't need to change anything below here (in the hints file; if
# you're reading this in Makefile augmented by hints, that may not be true).
#
-# Make sure that at least one interface aside from 'chain' 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
-
-# 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
+#-INCLUDE multiw-2.2020
-CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit \
- -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings
-CFLAGS+=-DGCC_WARN
+# XXX -g vs -O should go here, -I../include goes in the makefile
+CFLAGS+=-g -I../include -DNOTPARMDECL
ifndef WANT_WIN_QT
# these are normally used when compiling nethack's core
CFLAGS+=-ansi -pedantic -Wno-long-long
# 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
-# XXX -g vs -O should go here, -I../include goes in the makefile
-CFLAGS+=-g -I../include
+# NetHack sources control
+CFLAGS+=-DDLB
+CFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
+CFLAGS+=-DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\" -DDLB
+CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
+#CFLAGS+=-DTIMED_DELAY
+#CFLAGS+=-DDUMPLOG
+#CFLAGS+=-DCONFIG_ERROR_SECURE=FALSE
+CFLAGS+=-DGREPPATH=\"/usr/bin/grep\"
+#CFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\"
# older binaries use NOCLIPPING, but that disables SIGWINCH
#CFLAGS+=-DNOCLIPPING
-CFLAGS+= -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\"
-CFLAGS+= -DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\" -DDLB
-CFLAGS+= -DGREPPATH=\"/usr/bin/grep\"
+CFLAGS+=-DNOMAIL
+#CFLAGS+=-DEXTRA_SANITY_CHECKS
+#CFLAGS+=-DEDIT_GETLIN
+#CFLAGS+=-DSCORE_ON_BOTL
+#CFLAGS+=-DMSGHANDLER
+#CFLAGS+=-DTTY_TILES_ESCCODES
+#CFLAGS+=-DTTY_SOUND_ESCCODES
+
+CFLAGS+= $(WINCFLAGS) #from multiwin.2020
+
+VARDATND =
+VARDATND0 =
+CURSESLIB =
ifdef WANT_WIN_CHAIN
-CFLAGS+= -DWINCHAIN
HINTSRC=$(CHAINSRC)
HINTOBJ=$(CHAINOBJ)
endif # WANT_WIN_CHAIN
-WINSRC =
-WINOBJ0 =
-WINLIB =
-VARDATND =
-VARDATND0 =
-WINCURSESLIB =
-
ifdef WANT_WIN_TTY
-WINSRC += $(WINTTYSRC)
-WINOBJ0 += $(WINTTYOBJ)
-WINCURSESLIB = -lncurses
-else # !WANT_WIN_TTY
-CFLAGS += -DNOTTYGRAPHICS
-endif # !WANT_WIN_TTY
+CURSESLIB = -lncurses
+endif
ifdef WANT_WIN_CURSES
-CFLAGS += -DCURSES_GRAPHICS
-WINSRC += $(WINCURSESSRC)
-WINOBJ0 += $(WINCURSESOBJ)
-WINCURSESLIB = -lncurses
+CURSESLIB = -lncurses
endif
-ifdef WINCURSESLIB
-WINLIB += $(WINCURSESLIB)
+ifdef CURSESLIB
+WINLIB += $(CURSESLIB)
endif
ifdef WANT_WIN_X11
VARDATND0 += x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
# -x: if built without dlb, some versions of mkfontdir think *.lev are fonts
POSTINSTALL += bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; ( cd $(HACKDIR); mkfontdir -x .lev );
-CFLAGS += -DX11_GRAPHICS
# separate from CFLAGS so that we don't pass it to every file
X11CFLAGS = -I/opt/X11/include
# avoid repeated complaints about _X_NONNULL(args...) in <X11/Xfuncproto.h>
WINX11LIB += -lXpm
VARDATND0 += rip.xpm
endif
-WINSRC += $(WINX11SRC)
-WINOBJ0 += $(WINX11OBJ)
WINLIB += $(WINX11LIB)
LFLAGS=-L/opt/X11/lib
endif # WANT_WIN_X11
ifdef WANT_WIN_QT
-CFLAGS += -DQT_GRAPHICS
+# Qt5 requires C++11
+LINK = $(CXX)
QTCXXFLAGS += -Wno-deprecated-declarations
QTCXXFLAGS += $(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)
# prevent duplicates in VARDATND if both X11 and Qt are being supported
VARDATND += $(sort $(VARDATND0))
+WANT_BUNDLE=1
ifdef WANT_SHARE_INSTALL
# if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
# we install into ~/nethackdir
ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
# XXX it's nice we don't write over sysconf, but we've already erased it
# make sure we have group GAMEUID and group GAMEGRP
-PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); . sys/unix/hints/macosx.sh group2 $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
-POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
-CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
+PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); \
+ . sys/unix/hints/macosx.sh group2 $(GAMEGRP); \
+ mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
+POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; \
+ $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; \
+ $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; \
+ chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
+
else ifdef WANT_SOURCE_INSTALL
+
PREFIX=$(abspath $(NHSROOT))
# suppress nethack.sh
#SHELLDIR=
# We can use "make all" to build the whole thing - but it misses some things:
MOREALL=$(MAKE) install
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
+
else # !WANT_SOURCE_INSTALL
+
PREFIX:=$(wildcard ~)
SHELLDIR=$(PREFIX)/bin
HACKDIR=$(PREFIX)/nethackdir
GAMEPERM = 0700
VARFILEPERM = 0600
VARDIRPERM = 0700
-ifdef WANT_WIN_X11
+ifdef ($(WANT_DEFAULT),X11)
# install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists
PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc || true
-endif # WANT_WIN_X11
-POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
-CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
-endif # !WANT_SOURCE_INSTALL
+endif # WANT_DEFAULT X11
+
+POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; \
+ $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; \
+ $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; \
+ chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
+ifdef WANT_BUNDLE
+#
+# Bundle
+#
+# $(HACKDIR)/$(GAME).app/
+# Contents/
+# Frameworks/
+# Info.plist
+# MacOS/
+# $(GAME)
+# PkgInfo/
+# PlugIns/
+# Resources/
+# SharedFrameWorks/
+#
+BUNDLE = mkdir -p $(HACKDIR)/nethack.app/Contents/MacOS; \
+ sys/unix/hints/macosx.sh infoplist > $(HACKDIR)/nethack.app/Contents/Info.plist; \
+ mv $(HACKDIR)/nethack $(HACKDIR)/nethack.app/Contents/MacOS/nethack;
+ifdef WANT_SHARE_INSTALL
+BUNDLE+= chmod $(GAMEPERM) $(HACKDIR)/nethack.app/Contents/MacOS/nethack;
+endif
+
+POSTINSTALL+= $(BUNDLE)
+POSTINSTALL+= if test -f $(SHELLDIR)/$(GAME); then \
+ sed -i '' 's;HACKDIR/$(GAME);HACKDIR/$(GAME).app/Contents/MacOS/$(GAME);' $(SHELLDIR)/$(GAME) ; fi;
+endif # WANT_BUNDLE
+endif # !WANT_SHARE_INSTALL
INSTDIR=$(HACKDIR)
VARDIR=$(HACKDIR)
-
# ~/Library/Preferences/NetHack Defaults
# OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp
# OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt
#!/bin/sh
-# NetHack 3.7 mkmkfile.sh $NHDT-Date: 1596498293 2020/08/03 23:44:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.14 $
+# NetHack 3.7 mkmkfile.sh $NHDT-Date: 1597332770 2020/08/13 15:32:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.15 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
# NetHack may be freely redistributed. See license for details.
echo "###" >> $3
awk '/^#-PRE/,/^#-POST/{ \
if(index($0, "#-PRE") == 1) print "# (new segment at source line",NR,")"; \
- if(index($0, "#-P") != 1) print}' $4 >> $3
+ if(index($0, "#-INCLUDE") == 1) system("cat hints/include/"$2); \
+ else if(index($0, "#-P") != 1) print}' $4 >> $3
echo "### End $5 PRE" >> $3
echo "" >> $3