1 # This script acts as a simple interface for building extensions.
2 # It primarily used by the perl Makefile:
4 # d_dummy $(dynamic_ext): miniperl preplibrary FORCE
5 # ext/util/make_ext dynamic $@
7 # It may be deleted in a later release of perl so try to
8 # avoid using it for other purposes.
12 passthru="$*" # allow extra macro=value to be passed through
17 if test -f config.sh; then TOP=.;
18 elif test -f ../config.sh; then TOP=..;
19 elif test -f ../../config.sh; then TOP=../..;
20 elif test -f ../../../config.sh; then TOP=../../..;
21 elif test -f ../../../../config.sh; then TOP=../../../..;
23 echo "Can't find config.sh generated by Configure"; exit 1
29 if test "X$extspec" = X; then
30 echo "make_ext: no extension specified"
35 extspec=`echo "$extspec" | sed -e 's:^ext/::' -e 's:\.[^\.]*$::'`
36 extspec="ext/$extspec"
37 tailext=`echo "$extspec" | sed -e 's:.*/\([^/]*\)$:\1:'"`
38 headext=`echo "$extspec" | sed -e 's:/[^/]*$::'"`
39 if test -d "$headext/$tailext"; then
40 extspec="$headext/$tailext"
42 if test -f "$extspec/$tailext.xs"; then
43 extspec="$extspec/$tailext"
46 # get extension directory path, module name and depth
47 pname=`echo "$extspec" | sed -e 's:^ext/::' -e 's:/[^/]*$::'`
48 mname=`echo "$pname" | sed -e 's!/!::!g'`
49 depth=`echo "$pname" | sed -e 's![^/][^/]*!..!g'`
53 if test ! -d "ext/$pname"; then
54 echo " Skipping $extspec (directory does not exist)"
55 exit 0 # not an error ?
59 echo " Making $mname ($target)"
63 # check link type and do any preliminaries
65 # convert 'static' or 'dynamic' into 'all LINKTYPE=XXX'
66 static) makeargs="LINKTYPE=static CCCDLFLAGS="; target=all ;;
67 dynamic) makeargs="LINKTYPE=dynamic"; target=all ;;
69 *) # for the time being we are strict about what make_ext is used for
70 echo "make_ext: unknown make target '$target'"; exit 1;;
71 '') echo "make_ext: no make target specified (eg static or dynamic)"; exit 1;;
74 if test ! -f Makefile ; then
75 test -f Makefile.PL && ../$depth/miniperl -I../$depth/lib Makefile.PL
77 if test ! -f Makefile ; then
78 test -f Makefile.SH && sh Makefile.SH
84 *) $make config $passthru;;
87 $make $target $makeargs $passthru || exit