gen_links.sh: auto-generate .gitignore files to ignore symlinks

In each subdir that is a target for symlinks, automatically ignore the results
of gen_links():

- At the top of gen_links.sh.inc, clear the .gitignore.
- In the loop, add each link name to the local .gitignore.
- In selected gen_links.sh, there is also a "manual" link creationg. So that
  this also ends up in the local .gitignore, have the link creation as separate
  gen_link() macro which at the same time adds to ./.gitignore.
- in the root .gitignore, ignore all the subdirs' generated */.gitignore files.

Change-Id: I73c11fe8362358bf7e1bdf0e1be53399b5d3351b
This commit is contained in:
Neels Hofmeyr 2018-03-15 22:14:38 +01:00
parent 1a4c4601d7
commit 53fb0cf22b
6 changed files with 16 additions and 6 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ deps/*/
*.log
*.so
compile
*/.gitignore

View File

@ -28,7 +28,7 @@ gen_links $DIR $FILES
DIR=../SCCP_CNL113341/src
FILES="SCCP_Emulation.ttcn SCCP_EncDec.cc SCCP_Mapping.ttcnpp SCCP_Types.ttcn SCCPasp_Types.ttcn"
gen_links $DIR $FILES
ln -sf SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
gen_link SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
DIR=$BASEDIR/titan.ProtocolModules.BSSMAP_v11.2.0/src
FILES="BSSAP_Types.ttcn"

View File

@ -49,7 +49,7 @@ gen_links $DIR $FILES
DIR=../SCCP_CNL113341/src
FILES="SCCP_Emulation.ttcn SCCP_Mapping.ttcnpp SCCP_Types.ttcn SCCPasp_Types.ttcn"
gen_links $DIR $FILES
ln -sf SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
gen_link SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
DIR=$BASEDIR/titan.ProtocolModules.BSSMAP_v11.2.0/src
FILES="BSSAP_Types.ttcn"

View File

@ -1,12 +1,21 @@
#!dont_run_this
# This file is sourced by */gen_links.sh
rm -f .gitignore
gen_link() {
src="$1"
f="$2"
echo "Linking $f"
ln -sf "$src" "$f"
echo "$f" >> .gitignore
}
gen_links() {
DIR=$1
shift
FILES=$*
for f in $FILES; do
echo "Linking $f"
ln -sf $DIR/$f $f
gen_link "$DIR/$f" "$f"
done
}

View File

@ -44,7 +44,7 @@ gen_links $DIR $FILES
DIR=../SCCP_CNL113341/src
FILES="SCCP_Emulation.ttcn SCCP_EncDec.cc SCCP_Mapping.ttcnpp SCCP_Types.ttcn SCCPasp_Types.ttcn"
gen_links $DIR $FILES
ln -s SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
gen_link SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
DIR=$BASEDIR/titan.ProtocolModules.BSSMAP_v11.2.0/src
FILES="BSSAP_Types.ttcn"

View File

@ -29,7 +29,7 @@ gen_links $DIR $FILES
DIR=../SCCP_CNL113341/src
FILES="SCCP_Emulation.ttcn SCCP_Mapping.ttcnpp SCCP_Types.ttcn SCCPasp_Types.ttcn"
gen_links $DIR $FILES
ln -sf SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
gen_link SCCP_Mapping.ttcnpp SCCP_Mapping.ttcn
DIR=$BASEDIR/titan.ProtocolModules.BSSMAP_v11.2.0/src
FILES="BSSAP_Types.ttcn"