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

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,
you need the win subdirectory for that system (or the
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
your system. You may need to add a new OS-specific "*conf.h"

View File

@@ -2,6 +2,9 @@
# NetHack 3.5 Makefile.dat $Date$ $Revision$
# SCCS Id: @(#)Makefile.dat 3.5 1992/09/18
# Root of source tree:
NHSROOT=..
# for Atari
# SHELL=E:/GEMINI2/MUPFEL.TTP
# UUDECODE=uudecode

View File

@@ -2,6 +2,9 @@
# NetHack 3.5 Makefile.doc $Date$ $Revision$
# SCCS Id: @(#)Makefile.doc 3.5 2007/05/25
# Root of source tree:
NHSROOT=..
# for Atari
# SHELL=E:/GEMINI2/MUPFEL.TTP

View File

@@ -2,6 +2,9 @@
# NetHack 3.5 Makefile.src $Date$ $Revision$
# 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
# recursive make calls if $(MAKE) is used
# these makes allow $(MAKE) to be overridden by the environment if someone

View File

@@ -2,6 +2,9 @@
# NetHack 3.5 Makefile.top $Date$ $Revision$
# 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
# recursive make calls if $(MAKE) is used
# these makes allow $(MAKE) to be overridden by the environment if someone
@@ -39,6 +42,7 @@ DIRPERM = 0755
# instructions)
#HACKDIR = $(PREFIX)/games/lib/$(GAME)dir
VARDIR = $(HACKDIR)
# Where nethack.sh in installed. If this is not defined, the wrapper is not used.
#SHELLDIR = $(PREFIX)/games
# per discussion in Install.X11 and Install.Qt
@@ -90,6 +94,7 @@ $(GAME):
( cd src ; $(MAKE) )
all: $(GAME) recover Guidebook $(VARDAT) dungeon spec_levs check-dlb
true; $(MOREALL)
@echo "Done."
# Note: many of the dependencies below are here to allow parallel make
@@ -188,19 +193,22 @@ dofiles:
(cd dat ; cp symbols $(HACKDIR) )
cp src/$(GAME) $(HACKDIR)
cp util/recover $(HACKDIR)
-rm -f $(SHELLDIR)/$(GAME)
sed -e 's;/usr/games/lib/nethackdir;$(HACKDIR);' \
-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)
> $(SHELLDIR)/$(GAME) ; fi
# set up their permissions
-( cd $(HACKDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \
$(CHGRP) $(GAMEGRP) $(GAME) recover )
chmod $(GAMEPERM) $(HACKDIR)/$(GAME)
chmod $(EXEPERM) $(HACKDIR)/recover
-$(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME)
$(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME)
chmod $(EXEPERM) $(SHELLDIR)/$(GAME)
-if test -n '$(SHELLDIR)'; then \
$(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME); fi
if test -n '$(SHELLDIR)'; then \
$(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME); \
chmod $(EXEPERM) $(SHELLDIR)/$(GAME); fi
-( cd $(HACKDIR) ; $(CHOWN) $(GAMEUID) symbols ; \
$(CHGRP) $(GAMEGRP) symbols ; \
chmod $(FILEPERM) symbols )
@@ -243,8 +251,9 @@ install: rootcheck $(GAME) recover $(VARDAT) dungeon spec_levs
true; $(PREINSTALL)
# set up the directories
# not all mkdirs have -p; those that don't will create a -p directory
-mkdir -p $(SHELLDIR)
-rm -rf $(HACKDIR) $(VARDIR)
-if test -n '$(SHELLDIR)'; then \
mkdir -p $(SHELLDIR); fi
rm -rf $(HACKDIR) $(VARDIR)
-mkdir -p $(HACKDIR) $(VARDIR) $(VARDIR)/save
if test -d ./-p; then rmdir ./-p; fi
-$(CHOWN) $(GAMEUID) $(HACKDIR) $(VARDIR) $(VARDIR)/save

View File

@@ -2,6 +2,9 @@
# NetHack 3.5 Makefile.utl $Date$ $Revision$
# 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
# recursive make calls if $(MAKE) is used
# these makes allow $(MAKE) to be overridden by the environment if someone

View File

@@ -30,7 +30,7 @@ WANT_DEFAULT=tty
ifdef WANT_WIN_QT
QTDIR=/Developer/Qt
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
# or will it be private to you?
@@ -48,6 +48,8 @@ endif
#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
#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
@@ -66,9 +68,9 @@ WINSRC = $(WINTTYSRC)
WINOBJ = $(WINTTYOBJ)
WINLIB = $(WINTTYLIB)
WINTTYLIB=-lncurses
else
else # !WANT_WIN_TTY
CFLAGS += -DNOTTYGRAPHICS
endif
endif # !WANT_WIN_TTY
ifdef WANT_WIN_X11
WINSRC += $(WINX11SRC)
@@ -78,7 +80,7 @@ LFLAGS=-L/usr/X11R6/lib
VARDATND = x11tiles NetHack.ad pet_mark.xbm
POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; (cd $(HACKDIR); mkfontdir);
CFLAGS += -DX11_GRAPHICS
endif
endif # WANT_WIN_X11
ifdef WANT_WIN_QT
CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS
@@ -93,18 +95,19 @@ ifdef WANT_WIN_X11
WINOBJ = $(sort $(WINQTOBJ) $(WINX11OBJ))
ifdef WANT_WIN_TTY
WINOBJ += $(WINTTYOBJ)
endif
else
endif # WANT_WIN_TTY
else # !WANT_WIN_X11
WINOBJ += $(WINQTOBJ)
endif
endif # !WANT_WIN_X11
# XXX if /Developer/qt exists and QTDIR not set, use that
ifndef QTDIR
$(error QTDIR not defined in the environment or Makefile)
endif
endif # QTDIR
# XXX make sure QTDIR points to something reasonable
else
else # !WANT_WIN_QT
LINK=$(CC)
endif
endif # !WANT_WIN_QT
ifdef WANT_SHARE_INSTALL
# if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
@@ -117,14 +120,14 @@ CHOWN=chown
CHGRP=chgrp
# We run sgid so the game has access to both HACKDIR and user preferences.
GAMEPERM = 02755
else
else # ! root
PREFIX:=/Users/$(GAMEUID)
SHELLDIR=$(PREFIX)/bin
HACKDIR=$(PREFIX)/nethackdir
CHOWN=touch
CHGRP=touch
GAMEPERM = 0500
endif
endif # ! root
VARFILEPERM = 0664
VARDIRPERM = 0775
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)
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
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 ~)
SHELLDIR=$(PREFIX)/bin
HACKDIR=$(PREFIX)/nethackdir
@@ -145,10 +160,10 @@ VARDIRPERM = 0700
ifdef WANT_WIN_X11
# install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists
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;
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
endif
endif # !WANT_SOURCE_INSTALL
# ~/Library/Preferences/NetHack Defaults