gitinfo.txt on Unix
Hide the scary perl command during 'make all' feedback in src/. I'm not a shell programmer but this works fine for me when skipping NHgithook::NHversioning because dat/gitinfo.txt is already present, when creating dat/gitinfo.txt successfully, and when creation fails because perl can't find NHgithook.pm. It hasn't been tested when perl itself is absent.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# NetHack Makefile.
|
||||
# NetHack 3.6 Makefile.src $NHDT-Date: 1519228664 2018/02/21 15:57:44 $ $NHDT-Branch: githash $:$NHDT-Revision: 1.51 $
|
||||
# NetHack 3.6 Makefile.src $NHDT-Date: 1520201829 2018/03/04 22:17:09 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.52 $
|
||||
|
||||
# Root of source tree:
|
||||
NHSROOT=..
|
||||
@@ -606,13 +606,13 @@ tile.c: ../win/share/tilemap.c $(HACK_H)
|
||||
# file far more complex. Since "hack.h" depends on most of the include
|
||||
# files, we kludge around this by making date.h dependent on hack.h,
|
||||
# even though it doesn't include this file.
|
||||
# Do NOT include ../dat/gitinfo.txt as either a prerequisite or target.
|
||||
# 'makedefs -v' processes it when present and ignores it if not.
|
||||
#
|
||||
# hack.h depends on makedefs' output, so we know makedefs will be
|
||||
# up to date before being executed
|
||||
../include/date.h: $(VERSOURCES) $(HACK_H)
|
||||
if [[ ! -f ../dat/gitinfo.txt ]]; then \
|
||||
(cd ..;perl -IDEVEL/hooksdir -MNHgithook -e '&NHgithook::nhversioning') || true; \
|
||||
fi
|
||||
-$(SHELL) ../sys/unix/gitinfo.sh #../dat/gitinfo.txt for 'makedefs -v'
|
||||
../util/makedefs -v
|
||||
|
||||
|
||||
|
||||
25
sys/unix/gitinfo.sh
Executable file
25
sys/unix/gitinfo.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
# NetHack 3.6 gitinfo.sh $NHDT-Date: 1520201830 2018/03/04 22:17:10 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.0 $
|
||||
|
||||
# if dat/gitinfo.txt doesn't exist, try to make one; called from Makefile.src
|
||||
|
||||
#
|
||||
# gitinfo.txt is used during development to augment the version number
|
||||
# (for nethack's 'v' command) with more specific information. That is not
|
||||
# necessary when building a released version and it is perfectly OK for
|
||||
# this script to be skipped or to run but fail to generate dat/gitinfo.txt.
|
||||
#
|
||||
|
||||
# try to figure out where we are: top, one level down (expected), or sys/unix
|
||||
prefix=.
|
||||
if [ -f ../sys/unix/gitinfo.sh ]; then prefix=..; fi
|
||||
if [ -f ../../sys/unix/gitinfo.sh ]; then prefix=../..; fi
|
||||
|
||||
# try to run a perl script which is part of nethack's git repository
|
||||
if [[ ! -f $prefix/dat/gitinfo.txt ]]; then
|
||||
( cd $prefix; \
|
||||
perl -IDEVEL/hooksdir -MNHgithook -e '&NHgithook::nhversioning' \
|
||||
2> /dev/null ) \
|
||||
|| true
|
||||
fi
|
||||
exit 0
|
||||
Reference in New Issue
Block a user