File: settings

package info (click to toggle)
bind 1%3A8.1.2-5
  • links: PTS
  • area: main
  • in suites: slink
  • size: 5,076 kB
  • ctags: 7,956
  • sloc: ansic: 54,479; sh: 6,936; makefile: 2,900; yacc: 1,223; perl: 315; lex: 221; awk: 45; sed: 15
file content (35 lines) | stat: -rwxr-xr-x 890 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

# this process is necessary because make(1) puts its command line into
# the environment, and when we exec a sub-make we need these command
# line settings (like CDEBUG=-g for example) to override what we get out
# of port/$systype/Makefile.set.  therefore feed Makefile.set to this
# and it will merge things appropriately.  a cache file is maintained
# to avoid calling this script way too often.

cachefile=${1-//}
if [ -f "$cachefile" ]; then
	echo "Using $cachefile" >&2
	exec cat $cachefile
fi

case $cachefile in
//) ;;
*)   echo "Making $cachefile" >&2 ;;
esac

result=''
while read setting; do
	var=`expr "$setting" : "'\([A-Z0-9_]*\)="`
	val=`expr "$setting" : "'[A-Z0-9_]*=\([^']*\)'\$"`
	eval "env=`echo \\${\$var-'$val'}`"
	result="$result '$var=$env'"
done

case $cachefile in
//) echo $result ;;
*)  echo $result > $cachefile
    exec cat $cachefile ;;
esac

exit