Cleaned up how "prog_SOURCES" variable is found in input.
authorTom Tromey <tromey@redhat.com>
Tue, 21 Nov 1995 09:11:38 +0000 (09:11 +0000)
committerTom Tromey <tromey@redhat.com>
Tue, 21 Nov 1995 09:11:38 +0000 (09:11 +0000)
Ditto prog_OBJECTS.
Put static sed scripts into separate, installed files.

automake.in

index 25f2e73..668b7e8 100755 (executable)
@@ -109,45 +109,9 @@ test -n "$mfiles" || {
 
 am_status=0
 
-# Remove \newline.
-am_rmnl=/tmp/am.sed1
-cat > $am_rmnl <<\EOF
-/\\$/{
-  s///
-  H
-  d
-}
-/[^\\]$/{
-  H
-  x
-  s/\n//g
-  p
-  s/.*//
-  h
-}
-EOF
-
-# Turn Makefile target and variable assignments into shell variable
-# assignments:
-# * For targets, define the variable `target_NAME' to "explicit".
-# * For variables whose names are uppercase, perform the actual assignment.
-#   We only do this for all-upper variables to avoid conflict with variables
-#   used in automake.
-# * For other variables, define `var_NAME' to "explicit".  Such variables
-#   can only be used as flags; any use of their values must be done
-#   later, in the generated Makefile.
-am_ass=/tmp/am.sed2
-cat > $am_ass <<\EOF
-s/(/{/g
-s/)/}/g
-/^ *\([a-zA-Z_.][a-zA-Z0-9_.]*\):.*/{
-s//target_\1=explicit/
-s/\./_/g
-p
-}
-s/^ *\([A-Z][A-Z0-9_]*\)[       ]*=[    ]*\(.*\)/\1='\2'/p
-s/^ *\([A-Za-z][A-Za-z0-9_]*\)[        ]*=[    ]*\(.*\)/var_\1=explicit/p
-EOF
+# Some handy sed scripts.
+am_rmnl=$am_dir/nl-remove.sed
+am_ass=$am_dir/hack-make.sed
 
 for am_makefile in $mfiles; do
 (
@@ -204,12 +168,12 @@ for am_makefile in $mfiles; do
     cat $am_dir/compile.am >&5
     grep @kr@ ${am_makefile}.am >/dev/null && cat $am_dir/compile-kr.am >&5
     for am_file in $PROGRAMS $LIBPROGRAMS $LIBRARIES; do
-      if grep "^[       ]*${am_file}_SOURCES[   ]*=" ${am_makefile}.am >/dev/null; then
-        if grep "^[     ]*${am_file}_OBJECTS[   ]*=" ${am_makefile}.am >/dev/null; then
-          :
-        else
-          sed -n -f $am_rmnl ${am_makefile}.am |
-          sed -n "/^[   ]*${am_file}_SOURCES[   ]*=/{
+       if eval "test \"\$var_${am_file}_SOURCES\" = explicit"; then
+         if eval "test \"\$var_${am_file}_OBJECTS\" = explicit"; then
+            :
+         else
+            sed -n -f $am_rmnl ${am_makefile}.am |
+            sed -n "/^[         ]*${am_file}_SOURCES[   ]*=/{
 s/SOURCES/OBJECTS/
 s/@[^@]*@//g
 s/\$([^)]*)//g
@@ -220,16 +184,16 @@ s/\\.\$(kr)c/.${kr}o/g
 s/\\.[cCmylfs]/.${kr}o/g
 p
 }" >&4
-        fi
-        SOURCES="$SOURCES \${${am_file}_SOURCES}"
-      else
-        echo "${am_file}_SOURCES = ${am_file}.c
-${am_file}_OBJECTS = ${am_file}.${kr}o" >&4
-        SOURCES="$SOURCES ${am_file}.c"
-      fi
-      if test -n "$CONFIG_HEADER"; then
-        echo "\$(${am_file}_OBJECTS): $CONFIG_HEADER" >&5
-      fi
+         fi
+         SOURCES="$SOURCES \${${am_file}_SOURCES}"
+       else
+         echo "${am_file}_SOURCES = ${am_file}.c" >&4
+         echo "${am_file}_OBJECTS = ${am_file}.${kr}o" >&4
+          SOURCES="$SOURCES ${am_file}.c"
+       fi
+       if test -n "$CONFIG_HEADER"; then
+         echo "\$(${am_file}_OBJECTS): $CONFIG_HEADER" >&5
+       fi
     done
   fi
 
@@ -382,6 +346,4 @@ ${am_file}_OBJECTS = ${am_file}.${kr}o" >&4
 )
 done
 
-rm -f $am_rmnl $am_ass
-
 exit $am_status