make nethack.sh switchable from hints file

If SHELLDIR is null, don't install nethack.sh.  Also a tid in Porting
and add NHSROOT to the Makefiles which gives a path to the top of the
tree (so e.g. you can always find makedefs from a rule in a hints file).
This commit is contained in:
keni
2009-12-17 19:26:30 +00:00
parent 81e1ca40f1
commit e8fe9b4505
7 changed files with 61 additions and 24 deletions
+2 -1
View File
@@ -27,7 +27,8 @@ new machine. The basic steps in porting the program are:
If your machine uses a windowing system already supported, If your machine uses a windowing system already supported,
you need the win subdirectory for that system (or the you need the win subdirectory for that system (or the
appropriate sys subdirectory if the windowing system was appropriate sys subdirectory if the windowing system was
previously considered restricted to one OS). previously considered restricted to one OS) and possibly
win/share.
2. Modify the appropriate include files to customize NetHack to 2. Modify the appropriate include files to customize NetHack to
your system. You may need to add a new OS-specific "*conf.h" your system. You may need to add a new OS-specific "*conf.h"
+3
View File
@@ -2,6 +2,9 @@
# NetHack 3.5 Makefile.dat $Date$ $Revision$ # NetHack 3.5 Makefile.dat $Date$ $Revision$
# SCCS Id: @(#)Makefile.dat 3.5 1992/09/18 # SCCS Id: @(#)Makefile.dat 3.5 1992/09/18
# Root of source tree:
NHSROOT=..
# for Atari # for Atari
# SHELL=E:/GEMINI2/MUPFEL.TTP # SHELL=E:/GEMINI2/MUPFEL.TTP
# UUDECODE=uudecode # UUDECODE=uudecode
+3
View File
@@ -2,6 +2,9 @@
# NetHack 3.5 Makefile.doc $Date$ $Revision$ # NetHack 3.5 Makefile.doc $Date$ $Revision$
# SCCS Id: @(#)Makefile.doc 3.5 2007/05/25 # SCCS Id: @(#)Makefile.doc 3.5 2007/05/25
# Root of source tree:
NHSROOT=..
# for Atari # for Atari
# SHELL=E:/GEMINI2/MUPFEL.TTP # SHELL=E:/GEMINI2/MUPFEL.TTP
+3
View File
@@ -2,6 +2,9 @@
# NetHack 3.5 Makefile.src $Date$ $Revision$ # NetHack 3.5 Makefile.src $Date$ $Revision$
# SCCS Id: @(#)Makefile.src 3.5 2008/01/30 # SCCS Id: @(#)Makefile.src 3.5 2008/01/30
# Root of source tree:
NHSROOT=..
# newer makes predefine $(MAKE) to 'make' and do smarter processing of # newer makes predefine $(MAKE) to 'make' and do smarter processing of
# recursive make calls if $(MAKE) is used # recursive make calls if $(MAKE) is used
# these makes allow $(MAKE) to be overridden by the environment if someone # these makes allow $(MAKE) to be overridden by the environment if someone
+17 -8
View File
@@ -2,6 +2,9 @@
# NetHack 3.5 Makefile.top $Date$ $Revision$ # NetHack 3.5 Makefile.top $Date$ $Revision$
# SCCS Id: @(#)Makefile.top 3.5 2007/12/12 # SCCS Id: @(#)Makefile.top 3.5 2007/12/12
# Root of source tree:
NHSROOT=.
# newer makes predefine $(MAKE) to 'make' and do smarter processing of # newer makes predefine $(MAKE) to 'make' and do smarter processing of
# recursive make calls if $(MAKE) is used # recursive make calls if $(MAKE) is used
# these makes allow $(MAKE) to be overridden by the environment if someone # these makes allow $(MAKE) to be overridden by the environment if someone
@@ -39,6 +42,7 @@ DIRPERM = 0755
# instructions) # instructions)
#HACKDIR = $(PREFIX)/games/lib/$(GAME)dir #HACKDIR = $(PREFIX)/games/lib/$(GAME)dir
VARDIR = $(HACKDIR) VARDIR = $(HACKDIR)
# Where nethack.sh in installed. If this is not defined, the wrapper is not used.
#SHELLDIR = $(PREFIX)/games #SHELLDIR = $(PREFIX)/games
# per discussion in Install.X11 and Install.Qt # per discussion in Install.X11 and Install.Qt
@@ -90,6 +94,7 @@ $(GAME):
( cd src ; $(MAKE) ) ( cd src ; $(MAKE) )
all: $(GAME) recover Guidebook $(VARDAT) dungeon spec_levs check-dlb all: $(GAME) recover Guidebook $(VARDAT) dungeon spec_levs check-dlb
true; $(MOREALL)
@echo "Done." @echo "Done."
# Note: many of the dependencies below are here to allow parallel make # Note: many of the dependencies below are here to allow parallel make
@@ -188,19 +193,22 @@ dofiles:
(cd dat ; cp symbols $(HACKDIR) ) (cd dat ; cp symbols $(HACKDIR) )
cp src/$(GAME) $(HACKDIR) cp src/$(GAME) $(HACKDIR)
cp util/recover $(HACKDIR) cp util/recover $(HACKDIR)
-rm -f $(SHELLDIR)/$(GAME) -if test -n '$(SHELLDIR)'; then rm -f $(SHELLDIR)/$(GAME); fi
sed -e 's;/usr/games/lib/nethackdir;$(HACKDIR);' \ if test -n '$(SHELLDIR)'; then \
sed -e 's;/usr/games/lib/nethackdir;$(HACKDIR);' \
-e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \ -e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
< sys/unix/nethack.sh \ < sys/unix/nethack.sh \
> $(SHELLDIR)/$(GAME) > $(SHELLDIR)/$(GAME) ; fi
# set up their permissions # set up their permissions
-( cd $(HACKDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \ -( cd $(HACKDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \
$(CHGRP) $(GAMEGRP) $(GAME) recover ) $(CHGRP) $(GAMEGRP) $(GAME) recover )
chmod $(GAMEPERM) $(HACKDIR)/$(GAME) chmod $(GAMEPERM) $(HACKDIR)/$(GAME)
chmod $(EXEPERM) $(HACKDIR)/recover chmod $(EXEPERM) $(HACKDIR)/recover
-$(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME) -if test -n '$(SHELLDIR)'; then \
$(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME) $(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME); fi
chmod $(EXEPERM) $(SHELLDIR)/$(GAME) if test -n '$(SHELLDIR)'; then \
$(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME); \
chmod $(EXEPERM) $(SHELLDIR)/$(GAME); fi
-( cd $(HACKDIR) ; $(CHOWN) $(GAMEUID) symbols ; \ -( cd $(HACKDIR) ; $(CHOWN) $(GAMEUID) symbols ; \
$(CHGRP) $(GAMEGRP) symbols ; \ $(CHGRP) $(GAMEGRP) symbols ; \
chmod $(FILEPERM) symbols ) chmod $(FILEPERM) symbols )
@@ -243,8 +251,9 @@ install: rootcheck $(GAME) recover $(VARDAT) dungeon spec_levs
true; $(PREINSTALL) true; $(PREINSTALL)
# set up the directories # set up the directories
# not all mkdirs have -p; those that don't will create a -p directory # not all mkdirs have -p; those that don't will create a -p directory
-mkdir -p $(SHELLDIR) -if test -n '$(SHELLDIR)'; then \
-rm -rf $(HACKDIR) $(VARDIR) mkdir -p $(SHELLDIR); fi
rm -rf $(HACKDIR) $(VARDIR)
-mkdir -p $(HACKDIR) $(VARDIR) $(VARDIR)/save -mkdir -p $(HACKDIR) $(VARDIR) $(VARDIR)/save
if test -d ./-p; then rmdir ./-p; fi if test -d ./-p; then rmdir ./-p; fi
-$(CHOWN) $(GAMEUID) $(HACKDIR) $(VARDIR) $(VARDIR)/save -$(CHOWN) $(GAMEUID) $(HACKDIR) $(VARDIR) $(VARDIR)/save
+3
View File
@@ -2,6 +2,9 @@
# NetHack 3.5 Makefile.utl $Date$ $Revision$ # NetHack 3.5 Makefile.utl $Date$ $Revision$
# SCCS Id: @(#)Makefile.utl 3.5 2007/12/12 # SCCS Id: @(#)Makefile.utl 3.5 2007/12/12
# Root of source tree:
NHSROOT=..
# newer makes predefine $(MAKE) to 'make' and do smarter processing of # newer makes predefine $(MAKE) to 'make' and do smarter processing of
# recursive make calls if $(MAKE) is used # recursive make calls if $(MAKE) is used
# these makes allow $(MAKE) to be overridden by the environment if someone # these makes allow $(MAKE) to be overridden by the environment if someone
+30 -15
View File
@@ -30,7 +30,7 @@ WANT_DEFAULT=tty
ifdef WANT_WIN_QT ifdef WANT_WIN_QT
QTDIR=/Developer/Qt QTDIR=/Developer/Qt
LIBXPM= -L/Developer/SDKs/MacOSX10.3.9.sdk/usr/X11R6/lib -lXpm LIBXPM= -L/Developer/SDKs/MacOSX10.3.9.sdk/usr/X11R6/lib -lXpm
endif endif # WANT_WIN_QT
# 2. Is this a build for a binary that will be shared among different users # 2. Is this a build for a binary that will be shared among different users
# or will it be private to you? # or will it be private to you?
@@ -48,6 +48,8 @@ endif
#WANT_SHARE_INSTALL=1 #WANT_SHARE_INSTALL=1
GAMEUID = $(USER) GAMEUID = $(USER)
GAMEGRP = games GAMEGRP = games
# build to run in the source tree - primarily for development. Build with "make all"
#WANT_SOURCE_INSTALL=1
#CC=gcc -W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN #CC=gcc -W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN
CC=gcc -Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN -ansi -pedantic CC=gcc -Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN -ansi -pedantic
@@ -66,9 +68,9 @@ WINSRC = $(WINTTYSRC)
WINOBJ = $(WINTTYOBJ) WINOBJ = $(WINTTYOBJ)
WINLIB = $(WINTTYLIB) WINLIB = $(WINTTYLIB)
WINTTYLIB=-lncurses WINTTYLIB=-lncurses
else else # !WANT_WIN_TTY
CFLAGS += -DNOTTYGRAPHICS CFLAGS += -DNOTTYGRAPHICS
endif endif # !WANT_WIN_TTY
ifdef WANT_WIN_X11 ifdef WANT_WIN_X11
WINSRC += $(WINX11SRC) WINSRC += $(WINX11SRC)
@@ -78,7 +80,7 @@ LFLAGS=-L/usr/X11R6/lib
VARDATND = x11tiles NetHack.ad pet_mark.xbm VARDATND = x11tiles NetHack.ad pet_mark.xbm
POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; (cd $(HACKDIR); mkfontdir); POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; (cd $(HACKDIR); mkfontdir);
CFLAGS += -DX11_GRAPHICS CFLAGS += -DX11_GRAPHICS
endif endif # WANT_WIN_X11
ifdef WANT_WIN_QT ifdef WANT_WIN_QT
CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS
@@ -93,18 +95,19 @@ ifdef WANT_WIN_X11
WINOBJ = $(sort $(WINQTOBJ) $(WINX11OBJ)) WINOBJ = $(sort $(WINQTOBJ) $(WINX11OBJ))
ifdef WANT_WIN_TTY ifdef WANT_WIN_TTY
WINOBJ += $(WINTTYOBJ) WINOBJ += $(WINTTYOBJ)
endif endif # WANT_WIN_TTY
else else # !WANT_WIN_X11
WINOBJ += $(WINQTOBJ) WINOBJ += $(WINQTOBJ)
endif endif # !WANT_WIN_X11
# XXX if /Developer/qt exists and QTDIR not set, use that # XXX if /Developer/qt exists and QTDIR not set, use that
ifndef QTDIR ifndef QTDIR
$(error QTDIR not defined in the environment or Makefile) $(error QTDIR not defined in the environment or Makefile)
endif endif # QTDIR
# XXX make sure QTDIR points to something reasonable # XXX make sure QTDIR points to something reasonable
else else # !WANT_WIN_QT
LINK=$(CC) LINK=$(CC)
endif endif # !WANT_WIN_QT
ifdef WANT_SHARE_INSTALL ifdef WANT_SHARE_INSTALL
# if $GAMEUID is root, we install into roughly proper Mac locations, otherwise # if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
@@ -117,14 +120,14 @@ CHOWN=chown
CHGRP=chgrp CHGRP=chgrp
# We run sgid so the game has access to both HACKDIR and user preferences. # We run sgid so the game has access to both HACKDIR and user preferences.
GAMEPERM = 02755 GAMEPERM = 02755
else else # ! root
PREFIX:=/Users/$(GAMEUID) PREFIX:=/Users/$(GAMEUID)
SHELLDIR=$(PREFIX)/bin SHELLDIR=$(PREFIX)/bin
HACKDIR=$(PREFIX)/nethackdir HACKDIR=$(PREFIX)/nethackdir
CHOWN=touch CHOWN=touch
CHGRP=touch CHGRP=touch
GAMEPERM = 0500 GAMEPERM = 0500
endif endif # ! root
VARFILEPERM = 0664 VARFILEPERM = 0664
VARDIRPERM = 0775 VARDIRPERM = 0775
ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1) ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
@@ -133,7 +136,19 @@ ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); . sys/unix/hints/macosx.sh group2 $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR) PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); . sys/unix/hints/macosx.sh group2 $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
POSTINSTALL+= cp -n sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf; POSTINSTALL+= cp -n sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
else else ifdef WANT_SOURCE_INSTALL
PREFIX=$(abspath $(NHSROOT))
# suppress nethack.sh"
#SHELLDIR=
HACKDIR=$(PREFIX)/playground
CHOWN=touch
CHGRP=touch
GAMEPERM = 0700
VARFILEPERM = 0600
VARDIRPERM = 0700
# We can use "make all" to build the whole thing - but it misses some things:
MOREALL=$(MAKE) install
else # !WANT_SOURCE_INSTALL
PREFIX:=$(wildcard ~) PREFIX:=$(wildcard ~)
SHELLDIR=$(PREFIX)/bin SHELLDIR=$(PREFIX)/bin
HACKDIR=$(PREFIX)/nethackdir HACKDIR=$(PREFIX)/nethackdir
@@ -145,10 +160,10 @@ VARDIRPERM = 0700
ifdef WANT_WIN_X11 ifdef WANT_WIN_X11
# install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists # install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists
PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc
endif endif # WANT_WIN_X11
POSTINSTALL+= cp -n sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf; POSTINSTALL+= cp -n sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
endif endif # !WANT_SOURCE_INSTALL
# ~/Library/Preferences/NetHack Defaults # ~/Library/Preferences/NetHack Defaults