makedefs --grep prep, misc cleanup (TRUNK ONLY)
use makedefs --grep in Makefile.doc call make clean in doc from make clean in top add commented out rule to produce mdgrep.h from mdgrep.pl macosx1.5: don't chown/chgrp for single-user install unixmain.c: work around C90 warning for Mac-specific code, fix last fix makedefs.c: temporarily disallow blank after control introducer until docs catch up mdgrep.pl: add ALLDOCS, clean up generated file's header
This commit is contained in:
+31
-19
@@ -4,6 +4,9 @@
|
|||||||
# for Atari
|
# for Atari
|
||||||
# SHELL=E:/GEMINI2/MUPFEL.TTP
|
# 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 # regular ASCII file
|
||||||
#GUIDEBOOK = Guidebook.ps # PostScript file
|
#GUIDEBOOK = Guidebook.ps # PostScript file
|
||||||
#GUIDEBOOK = Guidebook.dvi # TeX device-independent file
|
#GUIDEBOOK = Guidebook.dvi # TeX device-independent file
|
||||||
@@ -22,8 +25,17 @@ PSCMD = groff
|
|||||||
# Not appropriate for creating Guidebook.txt.
|
# Not appropriate for creating Guidebook.txt.
|
||||||
# GUIDECMD = cat Guidebook.txt
|
# GUIDECMD = cat Guidebook.txt
|
||||||
# The following works better with groff-1.18, eg on Linux
|
# The following works better with groff-1.18, eg on Linux
|
||||||
# GUIDECMD = tbl tmac.n Guidebook.mn | nroff -c -Tascii | $(COLCMD)
|
# GUIDECMD = $(GUIDE_PREFORMAT) | nroff -c -Tascii | $(COLCMD)
|
||||||
GUIDECMD = tbl tmac.n Guidebook.mn | nroff | $(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
|
# the basic guidebook
|
||||||
Guidebook: Guidebook.mn
|
Guidebook: Guidebook.mn
|
||||||
@@ -31,7 +43,7 @@ Guidebook: Guidebook.mn
|
|||||||
|
|
||||||
# Fancier output for those with ditroff, psdit and a PostScript printer.
|
# Fancier output for those with ditroff, psdit and a PostScript printer.
|
||||||
Guidebook.ps: Guidebook.mn
|
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.
|
# Guidebook.tex is the same as Guidebook.mn but formatted with LaTeX.
|
||||||
# - The invocation command for LaTeX may vary in different installations.
|
# - The invocation command for LaTeX may vary in different installations.
|
||||||
@@ -47,17 +59,17 @@ MANDIR = /usr/man/man6
|
|||||||
MANEXT = 6
|
MANEXT = 6
|
||||||
|
|
||||||
# manual installation for most BSD-style systems
|
# manual installation for most BSD-style systems
|
||||||
GAMEMANCREATE = cp nethack.6
|
GAMEMANCREATE = cat nethack.6 | $(NHGREP) >
|
||||||
LEVMANCREATE = cp lev_comp.6
|
LEVMANCREATE = cat lev_comp.6 | $(NHGREP) >
|
||||||
DGNMANCREATE = cp dgn_comp.6
|
DGNMANCREATE = cat dgn_comp.6 | $(NHGREP) >
|
||||||
RCVRMANCREATE = cp recover.6
|
RCVRMANCREATE = cat recover.6 | $(NHGREP) >
|
||||||
DLBMANCREATE = cp dlb.6
|
DLBMANCREATE = cat dlb.6 | $(NHGREP) >
|
||||||
# manual installation for most SYSV-style systems
|
# manual installation for most SYSV-style systems
|
||||||
# GAMEMANCREATE = nroff -man nethack.6 >
|
# GAMEMANCREATE = cat nethack.6 | $(NHGREP) | nroff -man - >
|
||||||
# LEVMANCREATE = nroff -man lev_comp.6 >
|
# LEVMANCREATE = cat lev_comp.6 | $(NHGREP) | nroff -man - >
|
||||||
# DGNMANCREATE = nroff -man dgn_comp.6 >
|
# DGNMANCREATE = cat dgn_comp.6 | $(NHGREP) | nroff -man - >
|
||||||
# RCVRMANCREATE = nroff -man recover.6 >
|
# RCVRMANCREATE = cat recover.6 | $(NHGREP) | nroff -man - >
|
||||||
# DLBMANCREATE = nroff -man dlb.6 >
|
# DLBMANCREATE = cat dlb.6 | $(NHGREP) | nroff -man - >
|
||||||
|
|
||||||
manpages:
|
manpages:
|
||||||
-$(GAMEMANCREATE) $(MANDIR)/$(GAME).$(MANEXT)
|
-$(GAMEMANCREATE) $(MANDIR)/$(GAME).$(MANEXT)
|
||||||
@@ -74,17 +86,17 @@ distrib: $(DISTRIB)
|
|||||||
|
|
||||||
Guidebook.txt : Guidebook.mn tmac.n
|
Guidebook.txt : Guidebook.mn tmac.n
|
||||||
$(GUIDECMD) > Guidebook.txt
|
$(GUIDECMD) > Guidebook.txt
|
||||||
|
MAN2TXT = $(NHGREP) | nroff -man - | $(COLCMD)
|
||||||
nethack.txt : nethack.6
|
nethack.txt : nethack.6
|
||||||
nroff -man nethack.6 | $(COLCMD) > nethack.txt
|
cat nethack.6 | $(MAN2TXT) > nethack.txt
|
||||||
lev_comp.txt : lev_comp.6
|
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
|
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
|
recover.txt : recover.6
|
||||||
nroff -man recover.6 | $(COLCMD) > recover.txt
|
cat recover.6 | $(MAN2TXT) > recover.txt
|
||||||
dlb.txt : dlb.6
|
dlb.txt : dlb.6
|
||||||
nroff -man dlb.6 | $(COLCMD) > dlb.txt
|
cat dlb.6 | $(MAN2TXT) > dlb.txt
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -f Guidebook.aux Guidebook.log
|
-rm -f Guidebook.aux Guidebook.log
|
||||||
|
|||||||
@@ -268,6 +268,7 @@ install: rootcheck $(GAME) recover $(VARDAT) dungeon spec_levs
|
|||||||
clean:
|
clean:
|
||||||
( cd src ; $(MAKE) clean )
|
( cd src ; $(MAKE) clean )
|
||||||
( cd util ; $(MAKE) clean )
|
( cd util ; $(MAKE) clean )
|
||||||
|
( cd doc ; $(MAKE) clean )
|
||||||
|
|
||||||
# 'make spotless' returns the source tree to near-distribution condition.
|
# 'make spotless' returns the source tree to near-distribution condition.
|
||||||
# it removes .o files, executables, and compiled data files
|
# it removes .o files, executables, and compiled data files
|
||||||
|
|||||||
@@ -183,6 +183,10 @@ makedefs.o: makedefs.c $(CONFIG_H) ../include/permonst.h \
|
|||||||
../include/monst.h ../include/you.h ../include/flag.h \
|
../include/monst.h ../include/you.h ../include/flag.h \
|
||||||
../include/dlb.h ../include/patchlevel.h ../include/qtext.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
|
../include/onames.h: makedefs
|
||||||
./makedefs -o
|
./makedefs -o
|
||||||
../include/pm.h: makedefs
|
../include/pm.h: makedefs
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ endif
|
|||||||
# administered this may not be what you (or your admin) want.
|
# administered this may not be what you (or your admin) want.
|
||||||
# Consider a non-shared install (WANT_SHARE_INSTALL=0) instead.
|
# Consider a non-shared install (WANT_SHARE_INSTALL=0) instead.
|
||||||
# - 'make install' must be run as "sudo make install"
|
# - 'make install' must be run as "sudo make install"
|
||||||
WANT_SHARE_INSTALL=1
|
#WANT_SHARE_INSTALL=1
|
||||||
GAMEUID = root
|
GAMEUID = keni
|
||||||
GAMEGRP = games
|
GAMEGRP = games
|
||||||
|
|
||||||
#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
|
||||||
@@ -113,15 +113,18 @@ ifeq ($(GAMEUID),root)
|
|||||||
PREFIX:=/Library/NetHack
|
PREFIX:=/Library/NetHack
|
||||||
SHELLDIR=/usr/local/bin
|
SHELLDIR=/usr/local/bin
|
||||||
HACKDIR=$(PREFIX)/nethackdir
|
HACKDIR=$(PREFIX)/nethackdir
|
||||||
else
|
|
||||||
PREFIX:=/Users/$(GAMEUID)
|
|
||||||
SHELLDIR=$(PREFIX)/bin
|
|
||||||
HACKDIR=$(PREFIX)/nethackdir
|
|
||||||
endif
|
|
||||||
CHOWN=chown
|
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
|
||||||
|
PREFIX:=/Users/$(GAMEUID)
|
||||||
|
SHELLDIR=$(PREFIX)/bin
|
||||||
|
HACKDIR=$(PREFIX)/nethackdir
|
||||||
|
CHOWN=touch
|
||||||
|
CHGRP=touch
|
||||||
|
GAMEPERM = 0500
|
||||||
|
endif
|
||||||
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)
|
||||||
|
|||||||
+4
-2
@@ -59,6 +59,7 @@ char *argv[];
|
|||||||
sys_early_init();
|
sys_early_init();
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
{
|
||||||
/* special hack to change working directory to a resource fork when
|
/* special hack to change working directory to a resource fork when
|
||||||
running from finder --sam */
|
running from finder --sam */
|
||||||
#define MAC_PATH_VALUE ".app/Contents/MacOS/"
|
#define MAC_PATH_VALUE ".app/Contents/MacOS/"
|
||||||
@@ -85,6 +86,7 @@ char *argv[];
|
|||||||
free(mac_tmp);
|
free(mac_tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
hname = argv[0];
|
hname = argv[0];
|
||||||
@@ -588,8 +590,8 @@ char *optstr;
|
|||||||
if(optstr[0] == '*') return TRUE; /* allow any user */
|
if(optstr[0] == '*') return TRUE; /* allow any user */
|
||||||
if(!pw) return FALSE;
|
if(!pw) return FALSE;
|
||||||
pwlen = strlen(pw->pw_name);
|
pwlen = strlen(pw->pw_name);
|
||||||
*eop = eos(optstr);
|
eop = eos(optstr);
|
||||||
*w = optstr;
|
w = optstr;
|
||||||
while( w+pwlen <= eop ){
|
while( w+pwlen <= eop ){
|
||||||
if( ! *w ) break;
|
if( ! *w ) break;
|
||||||
if( isspace(*w) ){ w++; continue;}
|
if( isspace(*w) ){ w++; continue;}
|
||||||
|
|||||||
+7
-1
@@ -488,6 +488,8 @@ do_ext_makedefs(int argc, char **argv){
|
|||||||
|
|
||||||
Any line starting with a caret is a control line; as in C, zero or more spaces
|
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.
|
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:
|
Control lines:
|
||||||
^^ a line starting with a (single) literal caret
|
^^ a line starting with a (single) literal caret
|
||||||
@@ -585,7 +587,11 @@ do_grep_control(buf)
|
|||||||
{
|
{
|
||||||
int isif = 1;
|
int isif = 1;
|
||||||
char *buf0 = buf;
|
char *buf0 = buf;
|
||||||
|
#if 1
|
||||||
|
if(isspace(buf[0])) return &buf[-1]; /* XXX see docs above */
|
||||||
|
#else
|
||||||
while(buf[0] && isspace(buf[0])) buf++;
|
while(buf[0] && isspace(buf[0])) buf++;
|
||||||
|
#endif
|
||||||
switch(buf[0]){
|
switch(buf[0]){
|
||||||
case '#': /* comment */
|
case '#': /* comment */
|
||||||
break;
|
break;
|
||||||
@@ -678,7 +684,7 @@ do_grep(){
|
|||||||
char *buf1;
|
char *buf1;
|
||||||
|
|
||||||
if(fgets(buf, sizeof(buf), inputfp) == 0) break;
|
if(fgets(buf, sizeof(buf), inputfp) == 0) break;
|
||||||
if(tmp=strchr(buf,'\n')) *tmp = '\0';
|
if( (tmp=strchr(buf,'\n')) ) *tmp = '\0';
|
||||||
grep_lineno++;
|
grep_lineno++;
|
||||||
if(grep_trace){
|
if(grep_trace){
|
||||||
Fprintf(outputfp, "%04d %c >%s\n",
|
Fprintf(outputfp, "%04d %c >%s\n",
|
||||||
|
|||||||
+12
-2
@@ -28,6 +28,10 @@
|
|||||||
# Miscellaneous
|
# Miscellaneous
|
||||||
@misc = qw/BETA/;
|
@misc = qw/BETA/;
|
||||||
|
|
||||||
|
# Meta
|
||||||
|
@meta = qw/ALLDOCS/; # convention: use --grep-define ALLDOCS to notate
|
||||||
|
# items that are conditionally available
|
||||||
|
|
||||||
# JUNK:
|
# JUNK:
|
||||||
# MICRO BSD __GNUC__ NHSTDC TERMLIB __linux__ LINUX WIN32CON NO_TERMS
|
# MICRO BSD __GNUC__ NHSTDC TERMLIB __linux__ LINUX WIN32CON NO_TERMS
|
||||||
# ULTRIX_PROTO TERMINFO _DCC DISPMAP OPT_DISPMAP TARGET_API_MAC_CARBON
|
# ULTRIX_PROTO TERMINFO _DCC DISPMAP OPT_DISPMAP TARGET_API_MAC_CARBON
|
||||||
@@ -52,9 +56,15 @@ $outfile = "mdgrep.h";
|
|||||||
sub start_file {
|
sub start_file {
|
||||||
($rev) = ('$Revision$') =~ m/: (.*) .$/;
|
($rev) = ('$Revision$') =~ m/: (.*) .$/;
|
||||||
open(OUT, ">$outfile") || die "open $outfile: $!";
|
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;
|
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.
|
* This file generated by mdgrep.pl version $rev.
|
||||||
* DO NOT EDIT! Your changes will be lost.
|
* DO NOT EDIT! Your changes will be lost.
|
||||||
*/
|
*/
|
||||||
@@ -107,6 +117,6 @@ sub gen_commands {
|
|||||||
&start_file;
|
&start_file;
|
||||||
&gen_magic(0, @const_false);
|
&gen_magic(0, @const_false);
|
||||||
&gen_magic(1, @const_true);
|
&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;
|
&gen_commands;
|
||||||
&end_file;
|
&end_file;
|
||||||
|
|||||||
Reference in New Issue
Block a user