# for Atari
# SHELL=E:/GEMINI2/MUPFEL.TTP
+MAKEDEFS = ../util/makedefs
+
+# Which version do we want to build? (XXX These are not used anywhere.)
GUIDEBOOK = Guidebook # regular ASCII file
#GUIDEBOOK = Guidebook.ps # PostScript file
#GUIDEBOOK = Guidebook.dvi # TeX device-independent file
# Not appropriate for creating Guidebook.txt.
# GUIDECMD = cat Guidebook.txt
# The following works better with groff-1.18, eg on Linux
-# GUIDECMD = tbl tmac.n Guidebook.mn | nroff -c -Tascii | $(COLCMD)
-GUIDECMD = tbl tmac.n Guidebook.mn | nroff | $(COLCMD)
+# GUIDECMD = $(GUIDE_PREFORMAT) | nroff -c -Tascii | $(COLCMD)
+GUIDECMD = $(GUIDE_PREFORMAT) | nroff | $(COLCMD)
+
+# Only generate output for the current configuration:
+NHGREP = $(MAKEDEFS) --grep --input - --output -
+# Generate output for all configurations:
+#NHGREP = $(MAKEDEFS) --grep --input - --output - --grep-define ALLDOCS
+# Fallback:
+#NHGREP = cat
+
+GUIDE_PREFORMAT = cat Guidebook.mn | $(NHGREP) | tbl tmac.n -
# the basic guidebook
Guidebook: Guidebook.mn
# Fancier output for those with ditroff, psdit and a PostScript printer.
Guidebook.ps: Guidebook.mn
- tbl tmac.n Guidebook.mn | $(PSCMD) > Guidebook.ps
+ $(GUIDE_PREFORMAT) | $(PSCMD) > Guidebook.ps
# Guidebook.tex is the same as Guidebook.mn but formatted with LaTeX.
# - The invocation command for LaTeX may vary in different installations.
MANEXT = 6
# manual installation for most BSD-style systems
-GAMEMANCREATE = cp nethack.6
-LEVMANCREATE = cp lev_comp.6
-DGNMANCREATE = cp dgn_comp.6
-RCVRMANCREATE = cp recover.6
-DLBMANCREATE = cp dlb.6
+GAMEMANCREATE = cat nethack.6 | $(NHGREP) >
+LEVMANCREATE = cat lev_comp.6 | $(NHGREP) >
+DGNMANCREATE = cat dgn_comp.6 | $(NHGREP) >
+RCVRMANCREATE = cat recover.6 | $(NHGREP) >
+DLBMANCREATE = cat dlb.6 | $(NHGREP) >
# manual installation for most SYSV-style systems
-# GAMEMANCREATE = nroff -man nethack.6 >
-# LEVMANCREATE = nroff -man lev_comp.6 >
-# DGNMANCREATE = nroff -man dgn_comp.6 >
-# RCVRMANCREATE = nroff -man recover.6 >
-# DLBMANCREATE = nroff -man dlb.6 >
+# GAMEMANCREATE = cat nethack.6 | $(NHGREP) | nroff -man - >
+# LEVMANCREATE = cat lev_comp.6 | $(NHGREP) | nroff -man - >
+# DGNMANCREATE = cat dgn_comp.6 | $(NHGREP) | nroff -man - >
+# RCVRMANCREATE = cat recover.6 | $(NHGREP) | nroff -man - >
+# DLBMANCREATE = cat dlb.6 | $(NHGREP) | nroff -man - >
manpages:
-$(GAMEMANCREATE) $(MANDIR)/$(GAME).$(MANEXT)
Guidebook.txt : Guidebook.mn tmac.n
$(GUIDECMD) > Guidebook.txt
+MAN2TXT = $(NHGREP) | nroff -man - | $(COLCMD)
nethack.txt : nethack.6
- nroff -man nethack.6 | $(COLCMD) > nethack.txt
+ cat nethack.6 | $(MAN2TXT) > nethack.txt
lev_comp.txt : lev_comp.6
- nroff -man lev_comp.6 | $(COLCMD) > lev_comp.txt
+ cat lev_comp.6 | $(MAN2TXT) > lev_comp.txt
dgn_comp.txt : dgn_comp.6
- nroff -man dgn_comp.6 | $(COLCMD) > dgn_comp.txt
+ cat dgn_comp.6 | $(MAN2TXT) > dgn_comp.txt
recover.txt : recover.6
- nroff -man recover.6 | $(COLCMD) > recover.txt
+ cat recover.6 | $(MAN2TXT) > recover.txt
dlb.txt : dlb.6
- nroff -man dlb.6 | $(COLCMD) > dlb.txt
-
+ cat dlb.6 | $(MAN2TXT) > dlb.txt
clean:
-rm -f Guidebook.aux Guidebook.log
clean:
( cd src ; $(MAKE) clean )
( cd util ; $(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
../include/monst.h ../include/you.h ../include/flag.h \
../include/dlb.h ../include/patchlevel.h ../include/qtext.h
+# Don't require perl to build, but document how to get a new mdgrep.h.
+#mdgrep.h: mdgrep.pl
+# perl mdgrep.pl
+
../include/onames.h: makedefs
./makedefs -o
../include/pm.h: makedefs
# 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"
-WANT_SHARE_INSTALL=1
-GAMEUID = root
+#WANT_SHARE_INSTALL=1
+GAMEUID = keni
GAMEGRP = games
#CC=gcc -W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN
PREFIX:=/Library/NetHack
SHELLDIR=/usr/local/bin
HACKDIR=$(PREFIX)/nethackdir
+CHOWN=chown
+CHGRP=chgrp
+# We run sgid so the game has access to both HACKDIR and user preferences.
+GAMEPERM = 02755
else
PREFIX:=/Users/$(GAMEUID)
SHELLDIR=$(PREFIX)/bin
HACKDIR=$(PREFIX)/nethackdir
+CHOWN=touch
+CHGRP=touch
+GAMEPERM = 0500
endif
-CHOWN=chown
-CHGRP=chgrp
-# We run sgid so the game has access to both HACKDIR and user preferences.
-GAMEPERM = 02755
VARFILEPERM = 0664
VARDIRPERM = 0775
ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
sys_early_init();
#if defined(__APPLE__)
+ {
/* special hack to change working directory to a resource fork when
running from finder --sam */
#define MAC_PATH_VALUE ".app/Contents/MacOS/"
free(mac_tmp);
}
}
+ }
#endif
hname = argv[0];
if(optstr[0] == '*') return TRUE; /* allow any user */
if(!pw) return FALSE;
pwlen = strlen(pw->pw_name);
- *eop = eos(optstr);
- *w = optstr;
+ eop = eos(optstr);
+ w = optstr;
while( w+pwlen <= eop ){
if( ! *w ) break;
if( isspace(*w) ){ w++; continue;}
Any line starting with a caret is a control line; as in C, zero or more spaces
may be embedded in the line almost anywhere; the caret MUST be in column 1.
+ (XXX for the moment, no white space is allowed after the caret because
+ existing lines in the docs look like that)
Control lines:
^^ a line starting with a (single) literal caret
{
int isif = 1;
char *buf0 = buf;
+#if 1
+ if(isspace(buf[0])) return &buf[-1]; /* XXX see docs above */
+#else
while(buf[0] && isspace(buf[0])) buf++;
+#endif
switch(buf[0]){
case '#': /* comment */
break;
char *buf1;
if(fgets(buf, sizeof(buf), inputfp) == 0) break;
- if(tmp=strchr(buf,'\n')) *tmp = '\0';
+ if( (tmp=strchr(buf,'\n')) ) *tmp = '\0';
grep_lineno++;
if(grep_trace){
Fprintf(outputfp, "%04d %c >%s\n",
# Miscellaneous
@misc = qw/BETA/;
+# Meta
+@meta = qw/ALLDOCS/; # convention: use --grep-define ALLDOCS to notate
+ # items that are conditionally available
+
# JUNK:
# MICRO BSD __GNUC__ NHSTDC TERMLIB __linux__ LINUX WIN32CON NO_TERMS
# ULTRIX_PROTO TERMINFO _DCC DISPMAP OPT_DISPMAP TARGET_API_MAC_CARBON
sub start_file {
($rev) = ('$Revision$') =~ m/: (.*) .$/;
open(OUT, ">$outfile") || die "open $outfile: $!";
+# NB: Date and Revision below will be modified when mdgrep.h is written to
+# cvs - this is correct (but it means you must commit changes to mdgrep.pl
+# before generating mdgrep.h and committing that file.
print OUT <<E_O_M;
/*
- * $outfile
+ * NetHack 3.5 $outfile $Date$ $Revision$
+ * Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008
+ * NetHack may be freely redistributed. See license for details.
+ *
* This file generated by mdgrep.pl version $rev.
* DO NOT EDIT! Your changes will be lost.
*/
&start_file;
&gen_magic(0, @const_false);
&gen_magic(1, @const_true);
-&gen_file(sort(@os,@win,@feature,@misc,@const_false,@const_true));
+&gen_file(sort(@os,@win,@feature,@misc,@meta,@const_false,@const_true));
&gen_commands;
&end_file;