When calling panic() or impossible(), create the option of opening a browser window with most of the fields already populated. Code for MacOS and linux is included; other ports are affected by argument change to early_init which are done but not tested. To enable, define CRASHREPORT in config.h and set CRASHREPORTURL in sysconf to (for the moment at least) http[s]://www.nethack.org/common/contactcr.html Adds --grep-defined option to makedefs for Makefiles. Adds "bid" (binary identifier), an MD4 of the main nethack binary. This is ONLY for helping (in the future) contact.html to set the "NetHack from" field automatically for our own binaries. This can be faked, but the user can lie so nothing lost. There's nothing magic about MD4; other ports can use anything that prodcues a long apparently random string we can match against. - new option --bidshow for us to get the MD4 of a released binary so I can add it to the website. Only available in wizard mode and not in nethack.6. - typo macos -> macosx in hints file No support for packaging builds as I'm not sure what that would look like. Adds a javascript helper for MacOS. Adds a lua helper for linux (and builds and installs nhlua).
403 lines
12 KiB
Makefile
403 lines
12 KiB
Makefile
# NetHack Top-level Makefile.
|
|
# NetHack 3.7 Makefile.top $NHDT-Date: 1693519381 2023/08/31 22:03:01 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.91 $
|
|
# Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland
|
|
# NetHack may be freely redistributed. See license for details.
|
|
|
|
# Root of source tree: (Note: dot is after setup.sh has been used
|
|
# to create the active Makefiles from sys/unix/Makefile.*.
|
|
# It isn't sys/unix/ where you might happen to be reading this.)
|
|
NHSROOT=.
|
|
|
|
# Newer makes predefine $(MAKE) to 'make' and do smarter processing
|
|
# of recursive make calls if $(MAKE) is used.
|
|
# These makes allow $(MAKE) to be overridden by the environment if
|
|
# someone wants to (or has to) use something other than the standard
|
|
# make, so we do not want to unconditionally set $(MAKE) here.
|
|
#
|
|
# Unfortunately, some older makes do not predefine $(MAKE); if you
|
|
# have one of these, uncomment the following line.
|
|
# (You will know that you have one if you get complaints about unable
|
|
# to execute things like 'data' and 'rumors'.)
|
|
# MAKE = make
|
|
|
|
# make NetHack (as opposite to variants or such)
|
|
#PREFIX = /usr
|
|
GAME = nethack
|
|
# GAME = nethack.exe
|
|
# GAME = nethack.prg
|
|
#GAMEUID = games
|
|
#GAMEGRP = bin
|
|
|
|
# Permissions - some places use setgid instead of setuid, for instance.
|
|
# See also the option "SECURE" in include/config.h.
|
|
#GAMEPERM = 04755
|
|
FILEPERM = 0644
|
|
# VARFILEPERM = 0644
|
|
EXEPERM = 0755
|
|
DIRPERM = 0755
|
|
# VARDIRPERM = 0755
|
|
|
|
# VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else HACKDIR
|
|
#
|
|
# Note well! 'make install' believes in creating a nice tidy HACKDIR
|
|
# for installation, free of debris from previous NetHack versions --
|
|
# therefore there should not be anything in HACKDIR that you want to
|
|
# keep (if there is, you'll have to do the installation by hand or
|
|
# modify the install commands below).
|
|
#HACKDIR = $(PREFIX)/games/lib/$(GAME)dir
|
|
#VARDIR = $(HACKDIR)
|
|
# Where nethack.sh is installed (as 'nethack').
|
|
# If this is not defined, the shell wrapper script is not used.
|
|
#SHELLDIR = $(PREFIX)/games
|
|
|
|
# Extra data files depending upon the interface(s) built into nethack.
|
|
# per discussion in Install.X11 and Install.Qt
|
|
# Qt prefers nhtiles.bmp but can use x11tiles, and it ignores NetHack.ad.
|
|
# X11 uses those last two.
|
|
# Both can display a convential text map instead of tiles.
|
|
# tty and/or curses (no extra data files outside of the dlb container):
|
|
#VARDATND =
|
|
# All X11 and/or Qt variations may also include tty or curses or both):
|
|
# X11 without Qt:
|
|
# VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
|
|
# X11 with GRAPHIC_TOMBSTONE (requires 'xpm'):
|
|
# VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm rip.xpm
|
|
# both X11 and Qt:
|
|
# VARDATND = x11tiles nhtiles.bmp NetHack.ad pet_mark.xbm pilemark.xbm rip.xpm
|
|
# Qt without X11; assumes GRAPHIC_TOMBSTONE:
|
|
# VARDATND = nhtiles.bmp pet_mark.xbm pilemark.xbm rip.xpm
|
|
|
|
VARDATD = bogusmon data engrave epitaph oracles options quest.lua rumors
|
|
VARDAT = $(VARDATD) $(VARDATND)
|
|
|
|
# Some versions of make use the SHELL environment variable as the
|
|
# shell for running commands. We need this to be a Bourne shell.
|
|
# SHELL = /bin/sh
|
|
# for Atari (obsolete)
|
|
# SHELL=E:/GEMINI2/MUPFEL.TTP
|
|
|
|
# Commands for setting the owner and group on files during installation.
|
|
# Some systems fail with one or the other when installing over NFS or for
|
|
# other permission-related reasons. If that happens, you may want to set the
|
|
# command to "true", which is a no-op. Note that disabling chown or chgrp
|
|
# will only work if setuid (or setgid) behavior is not desired or required.
|
|
#CHOWN = chown
|
|
#CHGRP = chgrp
|
|
|
|
# Lua version
|
|
LUA_VERSION = 5.4.6
|
|
|
|
#
|
|
# end of configuration
|
|
#
|
|
|
|
DATHELP = help hh cmdhelp keyhelp history opthelp optmenu usagehlp wizhelp
|
|
|
|
SPEC_LEVS = asmodeus.lua baalz.lua bigrm-*.lua castle.lua fakewiz?.lua \
|
|
juiblex.lua knox.lua medusa-?.lua minend-?.lua minefill.lua \
|
|
minetn-?.lua oracle.lua orcus.lua sanctum.lua soko?-?.lua \
|
|
tower?.lua valley.lua wizard?.lua nhcore.lua nhlib.lua themerms.lua \
|
|
astral.lua air.lua earth.lua fire.lua water.lua hellfill.lua tut-?.lua
|
|
QUEST_LEVS = ???-goal.lua ???-fil?.lua ???-loca.lua ???-strt.lua
|
|
|
|
DATNODLB = $(VARDATND) license symbols
|
|
DATDLB = $(DATHELP) dungeon.lua tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD)
|
|
DAT = $(DATNODLB) $(DATDLB)
|
|
|
|
LUAHEADERS = lib/lua-$(LUA_VERSION)/src
|
|
LUATESTTARGET = $(LUAHEADERS)/lua.h
|
|
LUATOP = $(LUAHEADERS)
|
|
LUAMAKEFLAGS = CC='$(CC)' SYSCFLAGS='$(SYSCFLAGS)'
|
|
LUA2NHTOP = ../../..
|
|
LUABASELIB = liblua-$(LUA_VERSION).a
|
|
TOPLUALIB = lib/lua/$(LUABASELIB)
|
|
|
|
ALLDEP = $(GAME) recover Guidebook $(VARDAT) spec_levs check-dlb check-nhlua
|
|
|
|
# first target is also the default target for 'make' without any arguments
|
|
all: $(ALLDEP)
|
|
true; $(MOREALL)
|
|
@echo "Done."
|
|
|
|
$(GAME): lua_support
|
|
( cd src ; $(MAKE) LUA_VERSION=$(LUA_VERSION) $(GAME) )
|
|
|
|
lua_support: include/nhlua.h
|
|
@true
|
|
$(LUATOP)/liblua.a: $(LUAHEADERS)/lua.h
|
|
( cd $(LUATOP) && make $(LUAMAKEFLAGS) a ) && \
|
|
( util/makedefs --grep-defined CRASHREPORT && ( \
|
|
cd $(LUATOP) && make $(LUAMAKEFLAGS) ); true )
|
|
$(TOPLUALIB): $(LUATOP)/liblua.a
|
|
@( if test -d lib/lua ; then true ; else mkdir -p lib/lua ; fi )
|
|
cp $(LUATOP)/liblua.a $@
|
|
|
|
include/nhlua.h: $(TOPLUALIB)
|
|
echo '/* nhlua.h - generated by top Makefile */' > $@
|
|
@echo '#include "../$(LUAHEADERS)/lua.h"' >> $@
|
|
@sed -e '/(lua_error)/!d' -e '/(lua_error)/s/;/ NORETURN;/1' \
|
|
< $(LUAHEADERS)/lua.h >> $@
|
|
@echo '#include "../$(LUAHEADERS)/lualib.h"' >> $@
|
|
@echo '#include "../$(LUAHEADERS)/lauxlib.h"' >> $@
|
|
@echo '/*nhlua.h*/' >> $@
|
|
# LUATESTTARGET is this by default
|
|
lib/lua-$(LUA_VERSION)/src/lua.h:
|
|
@echo "Please do 'make fetch-lua' to obtain lua-$(LUA_VERSION)"
|
|
@false
|
|
luabin:
|
|
( cd $(LUATOP) \
|
|
&& make $(LUAMAKEFILES) all && cd $(LUA2NHTOP) )
|
|
|
|
check-nhlua:
|
|
( util/makedefs --grep-defined CRASHREPORT && ( \
|
|
cd $(LUATOP) && make $(LUAMAKEFLAGS) ); true )
|
|
|
|
# hints file could set LUATESTTARGET to this if GITSUBMODULES is defined
|
|
submodules/lua/lua.h:
|
|
git submodule init submodules/lua
|
|
git submodule update submodules/lua
|
|
# git submodule update --remote submodules/lua
|
|
|
|
# Note: many of the dependencies below are here to allow parallel make
|
|
# to generate valid output
|
|
|
|
Guidebook:
|
|
( cd doc ; $(MAKE) Guidebook )
|
|
|
|
Guidebook.txt:
|
|
( cd doc ; $(MAKE) Guidebook.txt )
|
|
|
|
Guidebook.pdf:
|
|
( cd doc ; $(MAKE) Guidebook.pdf )
|
|
|
|
manpages:
|
|
( cd doc ; $(MAKE) manpages )
|
|
|
|
data: $(GAME)
|
|
( cd dat ; $(MAKE) data )
|
|
|
|
engrave: $(GAME)
|
|
( cd dat ; $(MAKE) engrave )
|
|
|
|
bogusmon: $(GAME)
|
|
( cd dat ; $(MAKE) bogusmon )
|
|
|
|
epitaph: $(GAME)
|
|
( cd dat ; $(MAKE) epitaph )
|
|
|
|
rumors: $(GAME)
|
|
( cd dat ; $(MAKE) rumors )
|
|
|
|
oracles: $(GAME)
|
|
( cd dat ; $(MAKE) oracles )
|
|
|
|
# Note: options should have already been made with make, but...
|
|
options: $(GAME)
|
|
( cd dat ; $(MAKE) options )
|
|
|
|
quest.lua: $(GAME)
|
|
|
|
spec_levs:
|
|
( cd dat ; $(MAKE) spec_levs )
|
|
( cd dat ; $(MAKE) quest_levs )
|
|
|
|
nhtiles.bmp: $(GAME)
|
|
( cd util ; $(MAKE) tile2bmp )
|
|
( cd dat ; $(MAKE) nhtiles.bmp )
|
|
|
|
x11tiles: $(GAME)
|
|
( cd util ; $(MAKE) tile2x11 )
|
|
( cd dat ; $(MAKE) x11tiles )
|
|
|
|
# obsolete
|
|
beostiles: $(GAME)
|
|
( cd util ; $(MAKE) tile2beos )
|
|
( cd dat ; $(MAKE) beostiles )
|
|
|
|
NetHack.ad: $(GAME)
|
|
( cd dat ; $(MAKE) NetHack.ad )
|
|
|
|
pet_mark.xbm:
|
|
( cd dat ; $(MAKE) pet_mark.xbm )
|
|
|
|
pilemark.xbm:
|
|
( cd dat ; $(MAKE) pilemark.xbm )
|
|
|
|
rip.xpm:
|
|
( cd dat ; $(MAKE) rip.xpm )
|
|
|
|
mapbg.xpm:
|
|
(cd dat ; $(MAKE) mapbg.xpm )
|
|
|
|
nhsplash.xpm:
|
|
( cd dat ; $(MAKE) nhsplash.xpm )
|
|
|
|
nh16.img: $(GAME)
|
|
( cd util ; $(MAKE) tile2img.ttp )
|
|
( cd dat ; $(MAKE) nh16.img )
|
|
|
|
rip.img:
|
|
( cd util ; $(MAKE) xpm2img.ttp )
|
|
( cd dat ; $(MAKE) rip.img )
|
|
GEM_RSC.RSC:
|
|
( cd dat ; $(MAKE) GEM_RSC.RSC )
|
|
|
|
title.img:
|
|
( cd dat ; $(MAKE) title.img )
|
|
|
|
check-dlb: options
|
|
@if egrep -s librarian dat/options ; then $(MAKE) dlb ; else true ; fi
|
|
|
|
dlb:
|
|
( cd util ; $(MAKE) dlb )
|
|
( cd dat ; LC_ALL=C ; ../util/dlb cf nhdat $(DATDLB) )
|
|
|
|
wasm:
|
|
( cd src ; $(MAKE) CROSS_TO_WASM=1 ../targets/wasm/nethack.js )
|
|
|
|
package: $(GAME) recover $(VARDAT) spec_levs
|
|
( cd src ; $(MAKE) $(PACKAGE) )
|
|
|
|
# recover can be used when INSURANCE is defined in include/config.h
|
|
# and the checkpoint option is true
|
|
recover: $(GAME)
|
|
( cd util ; $(MAKE) recover )
|
|
|
|
dofiles:
|
|
target=`sed -n \
|
|
-e '/librarian/{' \
|
|
-e 's/.*/dlb/p' \
|
|
-e 'q' \
|
|
-e '}' \
|
|
-e '$$s/.*/nodlb/p' < dat/options` ; \
|
|
$(MAKE) dofiles-$${target-nodlb}
|
|
cp src/$(GAME) $(INSTDIR)
|
|
cp util/recover $(INSTDIR)
|
|
-if test -n '$(SHELLDIR)'; then rm -f $(SHELLDIR)/$(GAME); fi
|
|
if test -n '$(SHELLDIR)'; then \
|
|
sed -e 's;/usr/games/lib/nethackdir;$(HACKDIR);' \
|
|
-e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
|
|
< sys/unix/nethack.sh \
|
|
> $(SHELLDIR)/$(GAME) ; fi
|
|
# set up their permissions
|
|
-( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \
|
|
$(CHGRP) $(GAMEGRP) $(GAME) recover )
|
|
chmod $(GAMEPERM) $(INSTDIR)/$(GAME)
|
|
chmod $(EXEPERM) $(INSTDIR)/recover
|
|
-if test -n '$(SHELLDIR)'; then \
|
|
$(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME); fi
|
|
if test -n '$(SHELLDIR)'; then \
|
|
$(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME); \
|
|
chmod $(EXEPERM) $(SHELLDIR)/$(GAME); fi
|
|
|
|
dofiles-dlb: check-dlb
|
|
( cd dat ; cp nhdat $(DATNODLB) $(INSTDIR) )
|
|
# set up their permissions
|
|
-( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) nhdat $(DATNODLB) ; \
|
|
$(CHGRP) $(GAMEGRP) nhdat $(DATNODLB) ; \
|
|
chmod $(FILEPERM) nhdat $(DATNODLB) )
|
|
|
|
dofiles-nodlb:
|
|
# copy over the game files
|
|
( cd dat ; cp $(DAT) $(INSTDIR) )
|
|
# set up their permissions
|
|
-( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(DAT) ; \
|
|
$(CHGRP) $(GAMEGRP) $(DAT) ; \
|
|
chmod $(FILEPERM) $(DAT) )
|
|
#
|
|
# This is not part of the dependency build hierarchy.
|
|
# It requires an explicit "make fetch-Lua".
|
|
fetch-lua: fetch-Lua
|
|
@true
|
|
|
|
fetch-Lua:
|
|
( mkdir -p lib && cd lib && \
|
|
curl -R -O https://www.lua.org/ftp/lua-$(LUA_VERSION).tar.gz && \
|
|
tar zxf lua-$(LUA_VERSION).tar.gz && \
|
|
rm -f lua-$(LUA_VERSION).tar.gz )
|
|
# remove include/nhlua.h in case it was created for some other Lua version
|
|
@( if test -f include/nhlua.h ; then \
|
|
rm -f include/nhlua.h && echo 'rm include/nhlua.h' ; fi )
|
|
|
|
fetch-lua-http:
|
|
( mkdir -p lib && cd lib && \
|
|
curl -R -O http://www.lua.org/ftp/lua-$(LUA_VERSION).tar.gz && \
|
|
tar zxf lua-$(LUA_VERSION).tar.gz && \
|
|
rm -f lua-$(LUA_VERSION).tar.gz )
|
|
|
|
# 'make update' can be used to install a revised version after making
|
|
# customizations or such. Unlike 'make install', it doesn't delete everything
|
|
# from the target directory to have a clean start.
|
|
update: $(GAME) recover $(VARDAT) spec_levs
|
|
# (don't yank the old version out from under people who're playing it)
|
|
-mv $(INSTDIR)/$(GAME) $(INSTDIR)/$(GAME).old
|
|
-mv $(INSTDIR)/nhdat $(INSTDIR)/nhdat.old
|
|
# set up new versions of the game files
|
|
( $(MAKE) dofiles )
|
|
# should already be present, but make sure
|
|
touch $(VARDIR)/perm $(VARDIR)/record
|
|
# and a reminder
|
|
@echo You may also want to install the man pages via the doc Makefile.
|
|
|
|
rootcheck:
|
|
@true; $(ROOTCHECK)
|
|
|
|
install: rootcheck $(GAME) recover $(VARDAT) spec_levs
|
|
true; $(PREINSTALL)
|
|
# set up the directories
|
|
# not all mkdirs have -p; those that don't will create a -p directory
|
|
-if test -n '$(SHELLDIR)'; then \
|
|
mkdir -p $(SHELLDIR); fi
|
|
rm -rf $(INSTDIR) $(VARDIR)
|
|
-mkdir -p $(INSTDIR) $(VARDIR) $(VARDIR)/save
|
|
if test -d ./-p; then rmdir ./-p; fi
|
|
-$(CHOWN) $(GAMEUID) $(INSTDIR) $(VARDIR) $(VARDIR)/save
|
|
$(CHGRP) $(GAMEGRP) $(INSTDIR) $(VARDIR) $(VARDIR)/save
|
|
# order counts here:
|
|
chmod $(DIRPERM) $(INSTDIR)
|
|
chmod $(VARDIRPERM) $(VARDIR) $(VARDIR)/save
|
|
# set up the game files
|
|
( $(MAKE) dofiles )
|
|
# set up some additional files
|
|
touch $(VARDIR)/perm $(VARDIR)/record $(VARDIR)/logfile $(VARDIR)/xlogfile \
|
|
$(VARDIR)/livelog
|
|
-( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) perm record logfile xlogfile livelog ; \
|
|
$(CHGRP) $(GAMEGRP) perm record logfile xlogfile livelog ; \
|
|
chmod $(VARFILEPERM) perm record logfile xlogfile livelog )
|
|
true; $(POSTINSTALL)
|
|
# and a reminder
|
|
@echo You may also want to reinstall the man pages via the doc Makefile.
|
|
|
|
|
|
# 'make clean' removes all the .o files, but leaves around all the executables
|
|
# and compiled data files
|
|
clean: clean-lib clean-keep-lib
|
|
@true
|
|
|
|
clean-lib:
|
|
-( cd $(LUATOP) && $(MAKE) clean )
|
|
|
|
clean-keep-lib:
|
|
( cd src ; $(MAKE) clean )
|
|
( cd util ; $(MAKE) clean )
|
|
( cd dat ; $(MAKE) clean )
|
|
( cd doc ; $(MAKE) clean )
|
|
|
|
# 'make spotless' returns the source tree to near-distribution condition.
|
|
# it removes .o files, executables, and compiled data files
|
|
spotless:: spotless-lib spotless-keep-lib
|
|
@true
|
|
|
|
spotless-lib:: clean-lib
|
|
-( cd lib/lua && rm $(LUABASELIB) )
|
|
|
|
spotless-keep-lib: clean-keep-lib
|
|
( cd src ; $(MAKE) spotless )
|
|
( cd util ; $(MAKE) spotless )
|
|
( cd dat ; $(MAKE) spotless )
|
|
( cd doc ; $(MAKE) spotless )
|
|
spotless-clean-submodule:
|
|
@( if test -f submodules/lua/lua.h ; then \
|
|
git submodule deinit submodules/lua ; fi )
|
|
|