First steps of making builds outside the source
[p5sagit/p5-mst-13.2.git] / cflags.SH
index 8a1ba82..2aed681 100755 (executable)
--- a/cflags.SH
+++ b/cflags.SH
@@ -1,4 +1,4 @@
-case $CONFIG in
+case $CONFIGDOTSH in
 '')
        if test -f config.sh; then TOP=.;
        elif test -f ../config.sh; then TOP=..;
@@ -24,11 +24,12 @@ echo "Extracting cflags (with variable substitutions)"
 rm -f cflags
 $spitshell >cflags <<!GROK!THIS!
 $startsh
+src=$src
 !GROK!THIS!
 
 : In the following dollars and backticks do not need the extra backslash.
 $spitshell >>cflags <<'!NO!SUBS!'
-case $CONFIG in
+case $CONFIGDOTSH in
 '')
        if test -f config.sh; then TOP=.;
        elif test -f ../config.sh; then TOP=..;
@@ -65,7 +66,7 @@ case $# in
 0) set *.c; echo "The current C flags are:" ;;
 esac
 
-set `echo "$* " | sed -e 's/\.[oc] / /g' -e 's/\.obj / /g'`
+set `echo "$* " | sed -e 's/\.[oc] / /g' -e 's/\.obj / /g' -e "s/\\$obj_ext / /g"`
 
 for file do
 
@@ -74,9 +75,18 @@ for file do
     *) echo $n "    $file.c    $c" ;;
     esac
 
+    : allow for out-of-source experience
+
+    if test "X$src" != X.; then
+        ccflags="$ccflags -I$src -I."
+    fi
+
     : allow variables like toke_cflags to be evaluated
 
-    eval 'eval ${'"${file}_cflags"'-""}'
+    if echo $file | grep -v / >/dev/null
+    then
+      eval 'eval ${'"${file}_cflags"'-""}'
+    fi
 
     : or customize here