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.
15 if test -f config.sh; then TOP=.;
16 elif test -f ../config.sh; then TOP=..;
17 elif test -f ../../config.sh; then TOP=../..;
18 elif test -f ../../../config.sh; then TOP=../../..;
19 elif test -f ../../../../config.sh; then TOP=../../../..;
21 echo "Can't find config.sh generated by Configure"; exit 1
27 if test "X$extspec" = X; then
28 echo "make_ext: no extension specified"
32 # convert old style Name.a into ext/Name/Name.a format
35 *) extspec=`echo "$extspec" | sed -e 's:\(.*\)\.\(.*\):ext/\1/\1.\2:'`
38 # get extension directory path, module name and depth
39 pname=`echo "$extspec" | sed -e 's:^ext/::' -e 's:/[^/]*$::'`
40 mname=`echo "$pname" | sed -e 's!/!::!'`
41 depth=`echo "$pname" | sed -e 's![^/][^/]*!..!g'`
43 if test ! -d "ext/$pname"; then
44 echo " Skipping $extspec (directory does not exist)"
45 exit 0 # not an error ?
48 # check link type and do any preliminaries
50 static) makeargs='CCCDLFLAGS=' ;;
51 dynamic) makeargs='' ;;
52 *) echo "make_ext: unknown link type '$linktype'"; exit 1;;
53 '') echo "make_ext: no link type specified (eg static or dynamic)"; exit 1;;
57 echo " Making $mname ($linktype)"
61 if test ! -f Makefile ; then
62 test -f Makefile.PL && ../$depth/miniperl -I../$depth/lib Makefile.PL
64 if test ! -f Makefile ; then
65 test -f Makefile.SH && sh Makefile.SH
72 $make $linktype $makeargs