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