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:
keni
2008-06-25 18:56:47 +00:00
parent 64ab88d6b4
commit 41479c040a
7 changed files with 69 additions and 31 deletions

View File

@@ -4,6 +4,9 @@
# 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
@@ -22,8 +25,17 @@ PSCMD = groff
# 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
@@ -31,7 +43,7 @@ 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.
@@ -47,17 +59,17 @@ MANDIR = /usr/man/man6
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)
@@ -74,17 +86,17 @@ distrib: $(DISTRIB)
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

View File

@@ -268,6 +268,7 @@ install: rootcheck $(GAME) recover $(VARDAT) dungeon spec_levs
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

View File

@@ -183,6 +183,10 @@ makedefs.o: makedefs.c $(CONFIG_H) ../include/permonst.h \
../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

View File

@@ -45,8 +45,8 @@ endif
# 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
@@ -113,15 +113,18 @@ ifeq ($(GAMEUID),root)
PREFIX:=/Library/NetHack
SHELLDIR=/usr/local/bin
HACKDIR=$(PREFIX)/nethackdir
else
PREFIX:=/Users/$(GAMEUID)
SHELLDIR=$(PREFIX)/bin
HACKDIR=$(PREFIX)/nethackdir
endif
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
VARFILEPERM = 0664
VARDIRPERM = 0775
ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)

View File

@@ -59,6 +59,7 @@ char *argv[];
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/"
@@ -85,6 +86,7 @@ char *argv[];
free(mac_tmp);
}
}
}
#endif
hname = argv[0];
@@ -588,8 +590,8 @@ char *optstr;
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;}

View File

@@ -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
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
@@ -585,7 +587,11 @@ do_grep_control(buf)
{
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;
@@ -678,7 +684,7 @@ do_grep(){
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",

View File

@@ -28,6 +28,10 @@
# 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
@@ -52,9 +56,15 @@ $outfile = "mdgrep.h";
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.
*/
@@ -107,6 +117,6 @@ sub gen_commands {
&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;