]> granicus.if.org Git - php/commitdiff
Speed up the genif.sh script a little bit. Whereas it took three seconds
authorSascha Schumann <sas@php.net>
Wed, 20 Dec 2000 16:29:07 +0000 (16:29 +0000)
committerSascha Schumann <sas@php.net>
Wed, 20 Dec 2000 16:29:07 +0000 (16:29 +0000)
previously, it takes now about 100ms on a P233.

build/print_include.awk [new file with mode: 0644]
configure.in
genif.sh

diff --git a/build/print_include.awk b/build/print_include.awk
new file mode 100644 (file)
index 0000000..508ed4c
--- /dev/null
@@ -0,0 +1,6 @@
+/phpext_/ {
+       if (old_filename != FILENAME) {
+               printf "#include \"" FILENAME "\"\\\\n"
+               old_filename = FILENAME
+       }
+}
index ab578bc3b2c83ae62426f67c506758098cd03a40..aefa87c7f9a9be6b3e11321fa7b32e519f33998e 100644 (file)
@@ -865,7 +865,7 @@ if test -n "\$REDO_ALL"; then
   echo "creating main/internal_functions.c"
   extensions=\`grep '^s.@EXT_STATIC@' \$0|sed -e 's/^.*@% *//' -e 's/%.*$//'\`
 dnl mv -f main/internal_functions.c main/internal_functions.c.old 2>/dev/null
-  sh $srcdir/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" \$extensions > main/internal_functions.c
+  sh $srcdir/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$extensions > main/internal_functions.c
 dnl  if cmp main/internal_functions.c.old main/internal_functions.c > /dev/null 2>&1; then
 dnl      echo "main/internal_functions.c is unchanged"
 dnl      mv main/internal_functions.c.old main/internal_functions.c
index 968250f439ef1849045143b61384b6e39de16fa2..9f9dcd6ada41fca4a4dbb440c6d60127d8cfe8a8 100644 (file)
--- a/genif.sh
+++ b/genif.sh
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $Id: genif.sh,v 1.9 2000-06-27 16:22:26 sas Exp $
+# $Id: genif.sh,v 1.10 2000-12-20 16:29:07 sas Exp $
 # replacement for genif.pl
 
 infile="$1"
@@ -9,6 +9,8 @@ srcdir="$1"
 shift
 extra_module_ptrs="$1"
 shift
+awk="$1"
+shift
 
 if test "$infile" = "" -o "$srcdir" = ""; then
        echo "please supply infile and srcdir"
@@ -16,20 +18,17 @@ if test "$infile" = "" -o "$srcdir" = ""; then
 fi
 
 module_ptrs="$extra_module_ptrs"
-includes=""
-
+header_list=""
 olddir=`pwd`
 cd $srcdir
 
 for ext in ${1+"$@"} ; do
        module_ptrs="   phpext_${ext}_ptr,\\\n$module_ptrs"
-       for header in ext/$ext/*.h ; do
-               if grep phpext_ $header >/dev/null 2>&1 ; then
-                       includes="#include \"$header\"\\\n$includes"
-               fi
-       done
+       header_list="$header_list ext/$ext/*.h"
 done
 
+includes=`$awk -f $srcdir/build/print_include.awk $header_list`
+
 cd $olddir
 
 cat $infile | \