| 1 | case $CONFIGDOTSH in |
| 2 | '') |
| 3 | if test -f config.sh; then TOP=.; |
| 4 | elif test -f ../config.sh; then TOP=..; |
| 5 | elif test -f ../../config.sh; then TOP=../..; |
| 6 | elif test -f ../../../config.sh; then TOP=../../..; |
| 7 | elif test -f ../../../../config.sh; then TOP=../../../..; |
| 8 | else |
| 9 | echo "Can't find config.sh."; exit 1 |
| 10 | fi |
| 11 | . $TOP/config.sh |
| 12 | ;; |
| 13 | esac |
| 14 | : This forces SH files to create target in same directory as SH file. |
| 15 | : This is so that make depend always knows where to find SH derivatives. |
| 16 | case "$0" in |
| 17 | */cflags.SH) cd `expr X$0 : 'X\(.*\)/'` ;; |
| 18 | cflags.SH) ;; |
| 19 | *) case `pwd` in |
| 20 | */x2p) ;; |
| 21 | *) if test -d x2p; then cd x2p |
| 22 | else echo "Can't figure out where to write output."; exit 1 |
| 23 | fi;; |
| 24 | esac;; |
| 25 | esac |
| 26 | echo "Extracting x2p/cflags (with variable substitutions)" |
| 27 | : This section of the file will have variable substitutions done on it. |
| 28 | : Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!. |
| 29 | : Protect any dollar signs and backticks that you do not want interpreted |
| 30 | : by putting a backslash in front. You may delete these comments. |
| 31 | rm -f cflags |
| 32 | $spitshell >cflags <<!GROK!THIS! |
| 33 | !GROK!THIS! |
| 34 | |
| 35 | : In the following dollars and backticks do not need the extra backslash. |
| 36 | $spitshell >>cflags <<'!NO!SUBS!' |
| 37 | case $CONFIG in |
| 38 | '') |
| 39 | if test -f config.sh; then TOP=.; |
| 40 | elif test -f ../config.sh; then TOP=..; |
| 41 | elif test -f ../../config.sh; then TOP=../..; |
| 42 | elif test -f ../../../config.sh; then TOP=../../..; |
| 43 | elif test -f ../../../../config.sh; then TOP=../../../..; |
| 44 | else |
| 45 | echo "Can't find config.sh."; exit 1 |
| 46 | fi |
| 47 | . $TOP/config.sh |
| 48 | ;; |
| 49 | esac |
| 50 | |
| 51 | also=': ' |
| 52 | case $# in |
| 53 | 1) also='echo 1>&2 " CCCMD = "' |
| 54 | esac |
| 55 | |
| 56 | case $# in |
| 57 | 0) set *.c; echo "The current C flags are:" ;; |
| 58 | esac |
| 59 | |
| 60 | set `echo "$* " | sed -e 's/\.[oc] / /g' -e 's/\.obj / /g' -e "s/\\$obj_ext / /g"` |
| 61 | |
| 62 | for file do |
| 63 | |
| 64 | case "$#" in |
| 65 | 1) ;; |
| 66 | *) echo $n " $file.c $c" ;; |
| 67 | esac |
| 68 | |
| 69 | : allow variables like str_cflags to be evaluated |
| 70 | |
| 71 | eval 'eval ${'"${file}_cflags"'-""}' |
| 72 | |
| 73 | : or customize here |
| 74 | |
| 75 | case "$file" in |
| 76 | a2p) ;; |
| 77 | a2py) ;; |
| 78 | hash) ;; |
| 79 | str) ;; |
| 80 | util) ;; |
| 81 | walk) ;; |
| 82 | *) ;; |
| 83 | esac |
| 84 | |
| 85 | ccflags="`echo $ccflags | sed -e 's/-DMULTIPLICITY//'`" |
| 86 | |
| 87 | echo "$cc -c $ccflags $optimize" |
| 88 | eval "$also "'"$cc -c $ccflags $optimize"' |
| 89 | |
| 90 | . $TOP/config.sh |
| 91 | |
| 92 | done |
| 93 | !NO!SUBS! |
| 94 | chmod 755 cflags |
| 95 | $eunicefix cflags |