xref: /PHP-7.2/build/genif.sh (revision 9f5cb626)
1#! /bin/sh
2
3# $Id: genif.sh,v 1.6 2005-06-21 13:47:38 sniper Exp $
4# replacement for genif.pl
5
6infile=$1
7shift
8srcdir=$1
9shift
10extra_module_ptrs=$1
11shift
12awk=$1
13shift
14
15if test -z "$infile" || test -z "$srcdir"; then
16	echo "please supply infile and srcdir" >&2
17	exit 1
18fi
19
20header_list=
21olddir=`pwd`
22cd $srcdir
23
24module_ptrs="$extra_module_ptrs`echo $@ | $awk -f ./build/order_by_dep.awk`"
25
26for ext in ${1+"$@"} ; do
27	ext_dir=`echo "$ext" | cut -d ';' -f 2`
28	header_list="$header_list $ext_dir/*.h*"
29done
30
31includes=`$awk -f ./build/print_include.awk $header_list`
32
33cd $olddir
34
35cat $infile | \
36	sed \
37	-e "s'@EXT_INCLUDE_CODE@'$includes'" \
38	-e "s'@EXT_MODULE_PTRS@'$module_ptrs'" \
39	-e 's/@NEWLINE@/\
40/g'
41