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 ---
This commit is contained in:
nhmall
2026-05-18 13:03:31 -04:00
parent d9bc6d7b8a
commit 29951cccd1
8 changed files with 145 additions and 104 deletions
+1
View File
@@ -49,6 +49,7 @@ Makefile.gcc
Makefile-orig
Makefile.bcc-orig
Makefile.gcc-orig
make.prefs
*.suo
*.pdb
*.ilk
+95 -93
View File
@@ -4,7 +4,8 @@
# NetHack may be freely redistributed. See license for details.
# Root of source tree:
NHSROOT=..
NHSROOT ?=..
SRCDIR = $(NHSROOT)/src
# newer makes predefine $(MAKE) to 'make' and do smarter processing of
# recursive make calls if $(MAKE) is used
@@ -41,37 +42,37 @@ SHELL=/bin/sh
# SHELL=E:/GEMINI2/MUPFEL.TTP
# Usually, the C compiler driver is used for linking:
#LINK=$(CC)
#LINK ?=$(CC)
# If we're cross-compiling, a hints file will override this
# to a unique target directory, but otherwise it just goes in
# ../src
TARGETPFX=
TARGETPFX ?=
# Pick the SYSSRC and SYSOBJ lines corresponding to your desired operating
# system.
#
# for UNIX systems
SYSSRC = ../sys/share/ioctl.c ../sys/share/unixtty.c ../sys/unix/unixmain.c \
SYSSRC ?= ../sys/share/ioctl.c ../sys/share/unixtty.c ../sys/unix/unixmain.c \
../sys/unix/unixunix.c ../sys/unix/unixres.c
SYSOBJ = $(TARGETPFX)ioctl.o $(TARGETPFX)unixmain.o $(TARGETPFX)unixtty.o \
SYSOBJ ?= $(TARGETPFX)ioctl.o $(TARGETPFX)unixmain.o $(TARGETPFX)unixtty.o \
$(TARGETPFX)unixunix.o $(TARGETPFX)unixres.o
#
# for Systos
# SYSSRC = ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \
# SYSSRC ?= ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \
# ../sys/share/pctty.c ../sys/share/pcunix.c
# SYSOBJ = $(TARGETPFX)tos.o $(TARGETPFX)pcmain.o $(TARGETPFX)pcsys.o \
# SYSOBJ ?= $(TARGETPFX)tos.o $(TARGETPFX)pcmain.o $(TARGETPFX)pcsys.o \
# $(TARGETPFX)pctty.o $(TARGETPFX)pcunix.o
#
# for BeOS
#SYSSRC = ../sys/be/bemain.c ../sys/share/unixtty.c ../sys/share/ioctl.c
#SYSOBJ = $(TARGETPFX)bemain.o $(TARGETPFX)unixtty.o $(TARGETPFX)ioctl.o
#SYSSRC ?= ../sys/be/bemain.c ../sys/share/unixtty.c ../sys/share/ioctl.c
#SYSOBJ ?= $(TARGETPFX)bemain.o $(TARGETPFX)unixtty.o $(TARGETPFX)ioctl.o
# NetHack 5.0 began introducing C99 code.
#
# If your compiler needs an appropriate switch to accept C99 code.
# CSTD = -std=c99
# CSTD ?= -std=c99
# if you are using gcc as your compiler:
# uncomment the CC definition below if it's not in your environment
@@ -192,8 +193,8 @@ SYSOBJ = $(TARGETPFX)ioctl.o $(TARGETPFX)unixmain.o $(TARGETPFX)unixtty.o \
CFLAGS ?= -I../include
LINK ?= $(CC)
AR = ar
ARFLAGS = rcs
AR ?= ar
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
@@ -210,15 +211,15 @@ MOCPATH ?= $(QTDIR)/bin/$(MOC)
# The default is for the TARGET_* variables to match the defaults.
# If we're cross-compiling these will get overridden elsewhere, likely via
# a hints file. TARGETPFX was set above earlier.
TARGET_CC = $(CC)
TARGET_CFLAGS = $(CFLAGS) $(CSTD)
TARGET_LINK = $(LINK)
TARGET_LFLAGS = $(LFLAGS)
TARGET_CXX = $(CXX)
TARGET_CXXFLAGS = $(CXXFLAGS)
TARGET_LIBS = $(LIBS)
TARGET_AR = $(AR)
TARGET_ARFLAGS = $(ARFLAGS)
TARGET_CC ?= $(CC)
TARGET_CFLAGS ?= $(CFLAGS) $(CSTD)
TARGET_LINK ?= $(LINK)
TARGET_LFLAGS ?= $(LFLAGS)
TARGET_CXX ?= $(CXX)
TARGET_CXXFLAGS ?= $(CXXFLAGS)
TARGET_LIBS ?= $(LIBS)
TARGET_AR ?= $(AR)
TARGET_ARFLAGS ?= $(ARFLAGS)
# we specify C preprocessor flags via CFLAGS; files built with default rules
# might include $(CPPFLAGS) which could get a value from user's environment;
@@ -227,42 +228,38 @@ CPPFLAGS =
# file for regular expression matching
REGEXOBJ ?= $(TARGETPFX)posixregex.o
#REGEXOBJ = $(TARGETPFX)pmatchregex.o
#REGEXOBJ = $(TARGETPFX)cppregex.o
#REGEXOBJ ?= $(TARGETPFX)pmatchregex.o
#REGEXOBJ ?= $(TARGETPFX)cppregex.o
TILECFILE ?= tile.c
TILEOFILE ?=
GENTILECFILE = tile.c
GENTILEOFILE = $(TARGETPFX)tile.o
# Set the WINSRC, WINOBJ, and WINLIB lines to correspond to your desired
# combination of windowing systems. Also set matching USE_x_GRAPHICS in
# config.h. Note that if you are building for any window system which
# uses tiles, uncomment '#$(TARGETPFX)tile.o' (by removing the '#') in that
# system's WINxOBJ (WINX11OBJ or WINQTOBJ or WINQT3OBJ). If you are building
# nethack with support for multiple window systems, only uncomment that for
# one of them to avoid duplicate tile.o.
# config.h.
#
# files for a straight tty port using no native windowing system
WINTTYSRC = ../win/tty/getline.c ../win/tty/termcap.c ../win/tty/topl.c \
WINTTYSRC ?= ../win/tty/getline.c ../win/tty/termcap.c ../win/tty/topl.c \
../win/tty/wintty.c
WINTTYOBJ = $(TARGETPFX)getline.o $(TARGETPFX)termcap.o $(TARGETPFX)topl.o \
WINTTYOBJ ?= $(TARGETPFX)getline.o $(TARGETPFX)termcap.o $(TARGETPFX)topl.o \
$(TARGETPFX)wintty.o
#
# Files for curses interface
WINCURSESSRC = ../win/curses/cursmain.c ../win/curses/curswins.c \
WINCURSESSRC ?= ../win/curses/cursmain.c ../win/curses/curswins.c \
../win/curses/cursmisc.c ../win/curses/cursdial.c \
../win/curses/cursstat.c ../win/curses/cursinit.c \
../win/curses/cursmesg.c ../win/curses/cursinvt.c
WINCURSESOBJ = $(TARGETPFX)cursmain.o $(TARGETPFX)curswins.o \
WINCURSESOBJ ?= $(TARGETPFX)cursmain.o $(TARGETPFX)curswins.o \
$(TARGETPFX)cursmisc.o $(TARGETPFX)cursdial.o \
$(TARGETPFX)cursstat.o $(TARGETPFX)cursinit.o \
$(TARGETPFX)cursmesg.o $(TARGETPFX)cursinvt.o
#
# files for an X11 port
# (tile.c is a generated source file)
WINX11SRC = ../win/X11/Window.c ../win/X11/dialogs.c ../win/X11/winX.c \
WINX11SRC ?= ../win/X11/Window.c ../win/X11/dialogs.c ../win/X11/winX.c \
../win/X11/winmap.c ../win/X11/winmenu.c ../win/X11/winmesg.c \
../win/X11/winmisc.c ../win/X11/winstat.c ../win/X11/wintext.c \
../win/X11/winval.c tile.c
../win/X11/winval.c $(GENTILECFILE)
WINX11OBJ ?= $(TARGETPFX)Window.o $(TARGETPFX)dialogs.o $(TARGETPFX)winX.o \
$(TARGETPFX)winmap.o $(TARGETPFX)winmenu.o $(TARGETPFX)winmesg.o \
$(TARGETPFX)winmisc.o $(TARGETPFX)winstat.o $(TARGETPFX)wintext.o \
@@ -273,7 +270,7 @@ WINX11OBJ ?= $(TARGETPFX)Window.o $(TARGETPFX)dialogs.o $(TARGETPFX)winX.o \
#WINQT3SRC = ../win/Qt3/qt3_win.cpp ../win/Qt3/qt3_clust.cpp \
# ../win/Qt3/qt3tableview.cpp
#WINQT3OBJ = $(TARGETPFX)qt3_win.o $(TARGETPFX)qt3_clust.o \
# $(TARGETPFX)qt3tableview.o #$(TARGETPFX)tile.o
# $(TARGETPFX)qt3tableview.o $(GENTILEOFILE)
# empty values for 'make depend'
WINQT3SRC =
WINQT3OBJ =
@@ -283,9 +280,9 @@ WINQT3OBJ =
#
# generated source files made by Qt's 'moc' program from ../win/Qt/qt_*.h;
# appended to WINQTSRC for use by 'make depend'
WINQTMOC = qt_kde0.moc qt_main.moc qt_map.moc qt_menu.moc qt_msg.moc \
WINQTMOC ?= qt_kde0.moc qt_main.moc qt_map.moc qt_menu.moc qt_msg.moc \
qt_plsel.moc qt_set.moc qt_stat.moc qt_xcmd.moc qt_yndlg.moc
WINQTSRC = ../win/Qt/qt_bind.cpp ../win/Qt/qt_click.cpp \
WINQTSRC ?= ../win/Qt/qt_bind.cpp ../win/Qt/qt_click.cpp \
../win/Qt/qt_clust.cpp ../win/Qt/qt_delay.cpp \
../win/Qt/qt_glyph.cpp ../win/Qt/qt_icon.cpp ../win/Qt/qt_inv.cpp \
../win/Qt/qt_key.cpp ../win/Qt/qt_line.cpp ../win/Qt/qt_main.cpp \
@@ -293,7 +290,7 @@ WINQTSRC = ../win/Qt/qt_bind.cpp ../win/Qt/qt_click.cpp \
../win/Qt/qt_plsel.cpp ../win/Qt/qt_rip.cpp ../win/Qt/qt_set.cpp \
../win/Qt/qt_stat.cpp ../win/Qt/qt_str.cpp ../win/Qt/qt_streq.cpp \
../win/Qt/qt_svsel.cpp ../win/Qt/qt_win.cpp ../win/Qt/qt_xcmd.cpp \
../win/Qt/qt_yndlg.cpp $(WINQTMOC) tile.c
../win/Qt/qt_yndlg.cpp $(WINQTMOC) $(GENTILECFILE)
WINQTOBJ ?= $(TARGETPFX)qt_bind.o $(TARGETPFX)qt_click.o \
$(TARGETPFX)qt_clust.o $(TARGETPFX)qt_delay.o \
$(TARGETPFX)qt_glyph.o $(TARGETPFX)qt_icon.o \
@@ -302,23 +299,22 @@ WINQTOBJ ?= $(TARGETPFX)qt_bind.o $(TARGETPFX)qt_click.o \
$(TARGETPFX)qt_msg.o $(TARGETPFX)qt_plsel.o $(TARGETPFX)qt_rip.o \
$(TARGETPFX)qt_set.o $(TARGETPFX)qt_stat.o $(TARGETPFX)qt_str.o \
$(TARGETPFX)qt_streq.o $(TARGETPFX)qt_svsel.o $(TARGETPFX)qt_win.o \
$(TARGETPFX)qt_xcmd.o $(TARGETPFX)qt_yndlg.o #$(TARGETPFX)tile.o
$(TARGETPFX)qt_xcmd.o $(TARGETPFX)qt_yndlg.o $(GENTILEOFILE)
# Files for Shim windowing interface for libnh -- doesn't do anything,
# just passes along the API calls to the library
#
WINSHIMSRC = ../win/shim/winshim.c
WINSHIMOBJ = winshim.o
WINSHIMSRC ?= ../win/shim/winshim.c
WINSHIMOBJ ?= winshim.o
#
# Files for a BeOS InterfaceKit port -- not ready for prime time
WINBESRC =
WINBEOBJ =
WINBESRC ?=
WINBEOBJ ?=
#WINBESRC = ../win/BeOS/winbe.cpp ../win/BeOS/NHWindow.cpp \
# ../win/BeOS/NHMenuWindow.cpp ../win/BeOS/NHMapWindow.cpp tile.c
# ../win/BeOS/NHMenuWindow.cpp ../win/BeOS/NHMapWindow.cpp $(GENTILECFILE)
#WINBEOBJ = $(TARGETPFX)winbe.o $(TARGETPFX)NHWindow.o \
# $(TARGETPFX)NHMenuWindow.o $(TARGETPFX)NHMapWindow.o \
# $(TARGETPFX)tile.o
# $(TARGETPFX)NHMenuWindow.o $(TARGETPFX)NHMapWindow.o $(GENTILEOFILE)
#
#
#WINSRC = $(WINTTYSRC)
@@ -356,16 +352,16 @@ WINBEOBJ =
WINQT3LIB = -L$(QTDIR)/lib -lqt
#
# libraries for Qt 4
WINQT4LIB = `pkg-config QtGui --libs`
WINQT4LIB ?= `pkg-config QtGui --libs`
#
# libraries for Qt 5 (use with WINQTSRC and WINQTOBJ)
WINQT5LIB = `pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs`
WINQT5LIB ?= `pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs`
#
# libraries for KDE (with Qt)
WINKDELIB = -lkdecore -lkdeui -lXext
WINKDELIB ?= -lkdecore -lkdeui -lXext
#
# libraries for BeOS
WINBELIB = -lbe
WINBELIB ?= -lbe
#
# libraries for curses port
# link with ncurses
@@ -418,14 +414,14 @@ WINOBJ ?= $(WINTTYOBJ)
WINLIB ?= $(WINTTYLIB) -lncurses
# make NetHack
GAME = nethack
GAME ?= nethack
# GAME = nethack.prg
GAMEBIN = $(GAME)
GAMEBIN ?= $(GAME)
# if you defined RANDOM in unixconf.h since your system did not come
# with a reasonable random number generator
# RANDOBJ = $(TARGETPFX)random.o
RANDOBJ =
RANDOBJ ?=
# used by `make depend' to reconstruct this Makefile; you shouldn't need this
# at all but can override with 'make AWK=nawk' or 'make AWK=gawk' if necessary
@@ -494,22 +490,22 @@ AT = $(AT_V$(QUIETCC))
# verbosity-adjacent; these will already have 'real' values if hints have
# set up cross-compiling, in which case these assignments will be no-ops
PREGAME=@true
PACKAGE=@true
PREGAME ?=@true
PACKAGE ?=@true
HACKLIBSRC = hacklib.c
HACKLIBOBJS = hacklib.o
HACKLIB = hacklib.a
TARGET_HACKLIB = $(TARGETPFX)hacklib.a
HACKLIBSRC ?= hacklib.c
HACKLIBOBJS ?= hacklib.o
HACKLIB ?= hacklib.a
TARGET_HACKLIB ?= $(TARGETPFX)hacklib.a
MAKEDEFS = ../util/makedefs
MAKEDEFS ?= ../util/makedefs
# -lm required by lua
LUA_VERSION ?=5.4.8
LUABASE = liblua-$(LUA_VERSION).a
LUALIB = ../lib/lua/$(LUABASE)
LUALIBS = $(LUALIB) -lm $(DLLIB)
LUAHEADERS = lib/lua-$(LUA_VERSION)/src
LUABASE ?= liblua-$(LUA_VERSION).a
LUALIB ?= ../lib/lua/$(LUABASE)
LUALIBS ?= $(LUALIB) -lm $(DLLIB)
LUAHEADERS ?= lib/lua-$(LUA_VERSION)/src
# timestamp files to reduce `make' overhead and shorten .o dependency lists
CONFIG_H = ../src/config.h-t
@@ -517,7 +513,7 @@ HACK_H = ../src/hack.h-t
# all .c that are part of the main NetHack program and are not operating- or
# windowing-system specific. Do not include date.c in this list.
HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \
HACKCSRC ?= allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \
botl.c calendar.c cmd.c coloratt.c dbridge.c decl.c detect.c dig.c display.c \
dlb.c do.c do_name.c do_wear.c dog.c dogmove.c dokick.c dothrow.c \
drawing.c dungeon.c earlyarg.c eat.c end.c engrave.c exper.c explode.c \
@@ -537,40 +533,40 @@ HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \
windows.c wizard.c wizcmds.c worm.c worn.c write.c zap.c
# all operating-system-dependent .c (for dependencies and such)
SYSCSRC = ../sys/share/pcmain.c ../sys/share/pcsys.c \
SYSCSRC ?= ../sys/share/pcmain.c ../sys/share/pcsys.c \
../sys/share/pctty.c ../sys/share/pcunix.c \
../sys/share/pmatchregex.c ../sys/share/posixregex.c \
../sys/share/random.c \
../sys/share/ioctl.c ../sys/share/unixtty.c ../sys/unix/unixmain.c \
../sys/unix/unixunix.c ../sys/unix/unixres.c
SYSCXXSRC = ../sys/share/cppregex.cpp
SYSCXXSRC ?= ../sys/share/cppregex.cpp
# generated source files (tile.c is handled separately via WINxxxSRC)
GENCSRC = #tile.c
GENCSRC ?= #tile.c
# all windowing-system-dependent .c (for dependencies and such)
WINCSRC = $(WINTTYSRC) $(WINCURSESSRC) $(WINX11SRC) $(WINSHIMSRC)
WINCSRC ?= $(WINTTYSRC) $(WINCURSESSRC) $(WINX11SRC) $(WINSHIMSRC)
# all windowing-system-dependent .cpp (for dependencies and such)
WINCXXSRC = $(WINQTSRC) $(WINQT3SRC) $(WINBESRC)
WINCXXSRC ?= $(WINQTSRC) $(WINQT3SRC) $(WINBESRC)
# Files for window system chaining. Requires SYSCF; include via HINTSRC/HINTOBJ
CHAINSRC = ../win/chain/wc_chainin.c ../win/chain/wc_chainout.c \
CHAINSRC ?= ../win/chain/wc_chainin.c ../win/chain/wc_chainout.c \
../win/chain/wc_trace.c
CHAINOBJ = $(TARGETPFX)wc_chainin.o $(TARGETPFX)wc_chainout.o \
CHAINOBJ ?= $(TARGETPFX)wc_chainin.o $(TARGETPFX)wc_chainout.o \
$(TARGETPFX)wc_trace.o
# .c files for this version (for date.h)
VERSOURCES = $(HACKCSRC) $(HACKLIBSRC) $(SYSSRC) $(WINSRC) $(CHAINSRC) $(GENCSRC)
VERSOURCES ?= $(HACKCSRC) $(HACKLIBSRC) $(SYSSRC) $(WINSRC) $(CHAINSRC) $(GENCSRC)
# .c files for all versions using this Makefile (for lint and tags)
CSOURCES = $(HACKCSRC) $(HACKLIBSRC) $(SYSCSRC) $(WINCSRC) $(CHAINSRC) $(GENCSRC)
CSOURCES ?= $(HACKCSRC) $(HACKLIBSRC) $(SYSCSRC) $(WINCSRC) $(CHAINSRC) $(GENCSRC)
# all .h files except date.h, which would
# cause dependency loops if run through "make depend"
# and dgn_file.h, special level & dungeon files.
#
HACKINCL = align.h artifact.h artilist.h attrib.h botl.h \
HACKINCL ?= align.h artifact.h artilist.h attrib.h botl.h \
color.h config.h config1.h context.h coord.h cstd.h decl.h \
defsym.h display.h dlb.h dungeon.h engrave.h extern.h flag.h \
fnamesiz.h func_tab.h global.h warnings.h hack.h lint.h mextra.h \
@@ -583,16 +579,16 @@ HACKINCL = align.h artifact.h artilist.h attrib.h botl.h \
wintty.h wincurs.h winX.h winprocs.h wintype.h you.h youprop.h \
weight.h
HSOURCES = $(HACKINCL) dgn_file.h
HSOURCES ?= $(HACKINCL) dgn_file.h
# the following .o's _must_ be made before any others (for makedefs)
FIRSTOBJ = monst.o objects.o
HOSTOBJ = $(FIRSTOBJ) alloc.o drawing.o
FIRSTOBJ ?= monst.o objects.o
HOSTOBJ ?= $(FIRSTOBJ) alloc.o drawing.o
#
# $(TARGETPFX)date.o is not included in this list
#
HOBJ = $(TARGETPFX)allmain.o $(TARGETPFX)alloc.o \
HOBJ ?= $(TARGETPFX)allmain.o $(TARGETPFX)alloc.o \
$(TARGETPFX)apply.o $(TARGETPFX)artifact.o $(TARGETPFX)attrib.o \
$(TARGETPFX)ball.o $(TARGETPFX)bones.o $(TARGETPFX)botl.o \
$(TARGETPFX)calendar.o $(TARGETPFX)cfgfiles.o $(TARGETPFX)cmd.o \
@@ -636,10 +632,10 @@ HOBJ = $(TARGETPFX)allmain.o $(TARGETPFX)alloc.o \
$(TARGETPFX)wizcmds.o $(TARGETPFX)worm.o $(TARGETPFX)worn.o \
$(TARGETPFX)write.o $(TARGETPFX)zap.o \
$(REGEXOBJ) $(RANDOBJ) $(SYSOBJ) $(WINOBJ) \
$(HINTOBJ) $(SNDLIBOBJ) $(UUIDOBJ) \
$(HINTOBJ) $(SNDLIBOBJ) $(UUIDOBJ) $(GENTILEOFILE) \
$(TARGETPFX)version.o
DATE_O = $(TARGETPFX)date.o
DATE_O ?= $(TARGETPFX)date.o
# the .o files from the HACKCSRC, SYSSRC, and WINSRC lists
@@ -657,42 +653,48 @@ pregame: $(RESPONSEFILES)
$(GAME): pregame $(MAKEDEFS) $(LUALIB) $(WAVS) $(SYSTEM)
@echo "$(GAME) is up to date."
Sysunix: $(HOSTOBJ) $(HOBJ) $(TARGET_HACKLIB) $(DATE_O) $(BUILDMORE) Makefile
Sysunix: $(HOSTOBJ) $(HOBJ) $(TARGET_HACKLIB) $(GENTILEOFILE) \
$(DATE_O) $(BUILDMORE) Makefile
@echo "Linking $(GAME)."
$(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
$(HOBJ) $(DATE_O) $(TARGET_HACKLIB) $(WINLIB) \
$(TARGET_LIBS) $(LUALIBS) $(AUTOLIBS)
@touch Sysunix
Sys3B2: $(HOSTOBJ) $(HOBJ) $(TARGET_HACKLIB) $(DATE_O) $(BUILDMORE) Makefile
Sys3B2: $(HOSTOBJ) $(HOBJ) $(TARGET_HACKLIB) $(GENTILEOFILE) \
$(DATE_O) $(BUILDMORE) Makefile
@echo "Linking $(GAME)."
$(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
$(HOBJ) $(DATE_O) $(TARGET_HACKLIB) $(WINLIB) \
$(LUALIBS) -lmalloc
@touch Sys3B2
Sysatt: $(HOSTOBJ) $(HOBJ) $(TARGET_HACKLIB) $(DATE_O) $(BUILDMORE) Makefile
Sysatt: $(HOSTOBJ) $(HOBJ) $(TARGET_HACKLIB) $(GENTILEOFILE) \
$(DATE_O) $(BUILDMORE) Makefile
@echo "Loading $(GAME)."
$(AT)$(LD) $(TARGET_LFLAGS) /lib/crt0s.o /lib/shlib.ifile \
-o $(GAMEBIN) $(HOSTOBJ) $(HOBJ) $(DATE_O) $(TARGET_HACKLIB) \
$(LUALIBS)
@touch Sysatt
Systos: $(HOSTOBJ) $(HOBJ) $(TARGET_HACKLIB) $(DATE_O) $(BUILDMORE) Makefile
Systos: $(HOSTOBJ) $(HOBJ) $(TARGET_HACKLIB) $(GENTILEOFILE) \
$(DATE_O) $(BUILDMORE) Makefile
@echo "Linking $(GAME)."
$(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
$(HOBJ) $(DATE_O) $(TARGET_HACKLIB) \
$(WINLIB) $(LUALIBS)
@touch Systos
SysV-AT: DUMB.Setup $(HOSTOBJ) $(HOBJ) $(TARGET_HACKLIB) $(DATE_O) $(BUILDMORE) Makefile
SysV-AT: DUMB.Setup $(HOSTOBJ) $(HOBJ) $(TARGET_HACKLIB) $(GENTILEOFILE) \
$(DATE_O) $(BUILDMORE) Makefile
@echo "Linking $(GAME)."
$(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
$(HOBJ) $(DATE_O) $(TARGET_HACKLIB) \
$(WINLIB) $(LUALIBS)
@touch SysV-AT
SysBe: $(HOSTOBJ) $(HOBJ) $(TARGET_HACKLIB) $(DATE_O) $(BUILDMORE) Makefile
SysBe: $(HOSTOBJ) $(HOBJ) $(TARGET_HACKLIB) $(GENTILEOFILE) \
$(DATE_O) $(BUILDMORE) Makefile
@echo "Linking $(GAME)."
$(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAME) \
$(HOBJ) $(DATE_O) $(TARGET_HACKLIB) \
@@ -766,7 +768,7 @@ $(MAKEDEFS): $(FIRSTOBJ) \
# Created at build time for configurations which support tiles,
# but not by makedefs so not connected to the others.
tile.c: ../win/share/tilemap.c $(HACK_H)
@( cd ../util ; $(MAKE) ../src/tile.c )
@( cd ../util ; $(MAKE) $(SRCDIR)/tile.c )
#
# hacklib (a library of utility routines)
@@ -824,7 +826,7 @@ spotless: clean
-rm -f ../include/nhlua.h
-rm -f ../include/date.h #created but no longer used, at least by core
-rm -f ../include/onames.h ../include/pm.h #obsolete generated files
-rm -f tile.c *.moc Qt*.h-t
-rm -f $(GENTILECFILE) *.moc Qt*.h-t
-rm -f ../win/gnome/gn_rip.h
package:
@@ -856,7 +858,7 @@ updatedepend-setup:
echo '#include "../$(LUAHEADERS)/lualib.h"' >> $$HFILE && \
echo '#include "../$(LUAHEADERS)/lauxlib.h"' >> $$HFILE && \
echo '/*nhlua.h*/' >> $$HFILE )
@echo "Generating bogus src/tile.c"
@echo "Generating bogus $(GENTILECFILE)"
@echo '#error bogus include/nhlua.h' > ../../src/tile.c
@echo "#include \"hack.h\"" >> ../../src/tile.c
@@ -881,7 +883,7 @@ depend2: $(WINQTMOC)
@echo '# see make depend above' >> $(MAKEFILE_NAME)
- diff Makefile.bak $(MAKEFILE_NAME)
@rm -f Makefile.bak
@rm -f ../include/nhlua.h tile.c
@rm -f ../include/nhlua.h $(GENTILECFILE)
# DO NOT DELETE THIS LINE OR CHANGE ANYTHING BEYOND IT
+2 -1
View File
@@ -10,6 +10,7 @@
# Root of source tree:
NHSROOT=..
SRCDIR = $(NHSROOT)/src
# newer makes predefine $(MAKE) to 'make' and do smarter processing of
# recursive make calls if $(MAKE) is used
@@ -517,7 +518,7 @@ tilemap: tilemap.o $(OBJDIR)/objects.o $(OBJDIR)/monst.o $(OBJDIR)/drawing.o \
$(CLINK) $(LFLAGS) -o tilemap tilemap.o $(OBJDIR)/objects.o \
$(OBJDIR)/monst.o $(OBJDIR)/drawing.o $(HACKLIB) \
$(LIBS)
../src/tile.c: tilemap
$(SRCDIR)/tile.c: tilemap
./tilemap
tiletext.o: ../win/share/tiletext.c $(CONFIG_H) ../win/share/tile.h
-3
View File
@@ -80,7 +80,6 @@ WINSRC =
WINOBJ0 =
SND_CFLAGS=
XTRASRC =
XTRAOBJ =
ifdef WANT_WIN_TTY
WINSRC += $(WINTTYSRC)
@@ -105,7 +104,6 @@ WINCFLAGS += -DX11_GRAPHICS
WINSRC += $(WIINX11SRC)
WINOBJ0 += $(WINX11OBJ)
XTRASRC += tile.c
XTRAOBJ += $(TARGETPFX)tile.o
endif
ifndef WANT_WIN_QT
@@ -157,7 +155,6 @@ HAVE_SNDLIB = 1
NEEDS_SND_USERSOUNDS = 1
NEEDS_SND_SEAUTOMAP = 1
XTRASRC += tile.c
XTRAOBJ += $(TARGETPFX)tile.o
#
ifndef CPLUSPLUS_NEEDED
CPLUSPLUS_NEEDED = 1
+2 -1
View File
@@ -275,6 +275,7 @@ ifdef WANT_WIN_X11
USE_XPM=1
WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
VARDATND0 += x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
GENTILEOFILE = $(SRCDIR)/tile.o
# -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 );
# separate from CFLAGS so that we don't pass it to every file
@@ -365,7 +366,7 @@ LINK = $(CC)
endif # !WANT_WIN_QT
# prevent duplicate tile.o in WINOBJ
WINOBJ = $(WINOBJ0) $(sort $(XTRAOBJ))
WINOBJ = $(WINOBJ0)
# prevent duplicates in VARDATND if both X11 and Qt are being supported
VARDATND += $(sort $(VARDATND0))
+1 -1
View File
@@ -314,7 +314,7 @@ LINK=$(CC)
endif # !WANT_WIN_QT
# prevent duplicate tile.o in WINOBJ
WINOBJ = $(WINOBJ0) $(sort $(XTRAOBJ))
WINOBJ = $(WINOBJ0)
# prevent duplicates in VARDATND if both X11 and Qt are being supported
VARDATND += $(sort $(VARDATND0))
+32
View File
@@ -10,6 +10,7 @@
# $3 install path
# $4 hints file (path)
# $5 hints file (as given by user)
# $6 gnu or bsd
echo "#" > $3
echo "# This file is generated automatically. Do not edit." >> $3
@@ -20,6 +21,37 @@ echo "" >> $3
echo "HINTSFILE=$5" >> $3
echo "" >> $3
echo "###" >> $3
echo "### add check for builder include file $6-style" >> $3
echo "###" >> $3
echo "" >> $3
BUILDERINCL=make.prefs
echo "" >> $3
case "$6" in
"gnu")
echo "ifdef MAKEFILE_TOP" >> $3
echo "NHSROOT=." >> $3
echo "else" >> $3
echo "NHSROOT=.." >> $3
echo "endif" >> $3
echo "ifneq (\"\$(wildcard \$(NHSROOT)/$BUILDERINCL))\",\"\")" >> $3
echo "-include \$(NHSROOT)/$BUILDERINCL" >> $3
echo "endif" >> $3
;;
"bsd")
echo ".ifdef MAKEFILE_TOP" >> $3
echo "NHSROOT=." >> $3
echo ".else" >> $3
echo "NHSROOT=.." >> $3
echo ".endif" >> $3
echo ".if exists(\$(NHSROOT)/$BUILDERINCL)" >> $3
echo ".include \"\$(NHSROOT)/$BUILDERINCL\"" >> $3
echo ".endif" >> $3
;;
*)
esac
echo "" >> $3
echo "###" >> $3
echo "### Start $5 PRE" >> $3
echo "###" >> $3
+12 -5
View File
@@ -31,8 +31,15 @@ x) hints=/dev/null
;;
esac
/bin/sh ./mkmkfile.sh Makefile.top TOP ../../Makefile $hints $hfile
/bin/sh ./mkmkfile.sh Makefile.dat DAT ../../dat/Makefile $hints $hfile
/bin/sh ./mkmkfile.sh Makefile.doc DOC ../../doc/Makefile $hints $hfile
/bin/sh ./mkmkfile.sh Makefile.src SRC ../../src/Makefile $hints $hfile
/bin/sh ./mkmkfile.sh Makefile.utl UTL ../../util/Makefile $hints $hfile
# is make gnu or bsd?
if make --version 2>/dev/null | grep -q "GNU"; then
whichmake=gnu
else
whichmake=bsd
fi
/bin/sh ./mkmkfile.sh Makefile.top TOP ../../Makefile $hints $hfile $whichmake
/bin/sh ./mkmkfile.sh Makefile.dat DAT ../../dat/Makefile $hints $hfile $whichmake
/bin/sh ./mkmkfile.sh Makefile.doc DOC ../../doc/Makefile $hints $hfile $whichmake
/bin/sh ./mkmkfile.sh Makefile.src SRC ../../src/Makefile $hints $hfile $whichmake
/bin/sh ./mkmkfile.sh Makefile.utl UTL ../../util/Makefile $hints $hfile $whichmake