NHDT->ANH, nethack->anethack, nhdat->anhdat
[aNetHack.git] / sys / unix / mkmkfile.sh
blobacaedf64faaec435eaa861324d3ab067de244735
1 #!/bin/sh
2 # aNetHack 0.0.1 mkmkfile.sh $ANH-Date: 1432512788 2015/05/25 00:13:08 $ $ANH-Branch: master $:$ANH-Revision: 1.13 $
3 # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
4 # aNetHack may be freely redistributed. See license for details.
6 # build one makefile
7 # args are:
8 # $1 basefile
9 # $2 basefile tag
10 # $3 install path
11 # $4 hints file (path)
12 # $5 hints file (as given by user)
14 echo "#" > $3
15 echo "# This file is generated automatically. Do not edit." >> $3
16 echo "# Your changes will be lost. See sys/unix/NewInstall.unx." >> $3
17 echo "# Identify this file:" >> $3
18 echo "MAKEFILE_$2=1" >> $3
19 echo "" >> $3
21 echo "###" >> $3
22 echo "### Start $5 PRE" >> $3
23 echo "###" >> $3
24 awk '/^#-PRE/,/^#-POST/{ \
25 if(index($0, "#-PRE") == 1) print "# (new segment at source line",NR,")"; \
26 if(index($0, "#-P") != 1) print}' $4 >> $3
27 echo "### End $5 PRE" >> $3
28 echo "" >> $3
30 echo "###" >> $3
31 echo "### Start $1" >> $3
32 echo "###" >> $3
33 cat $1 >> $3
34 echo "### End $1" >> $3
35 echo "" >> $3
37 echo "###" >> $3
38 echo "### Start $5 POST" >> $3
39 echo "###" >> $3
40 awk '/^#-POST/,/^#-PRE/{ \
41 if(index($0, "#-POST") == 1) print "# (new segment at source line",NR,")"; \
42 if(index($0, "#-P") != 1) print}' $4 >> $3
43 echo "### End $5 POST" >> $3