blob: 317dd5c8ce3eafb7967c5e26619ae977153110ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
#!/bin/sh
# This script acts as a simple interface for building extensions.
# It primarily used by the perl Makefile:
#
# d_dummy $(dynamic_ext): miniperl preplibrary FORCE
# @sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
#
# It may be deleted in a later release of perl so try to
# avoid using it for other purposes.
target=$1; shift
extspec=$1; shift
makecmd=$1; shift # Should be something like MAKE=make
passthru="$*" # allow extra macro=value to be passed through
echo ""
# Previously, $make was taken from config.sh. However, the user might
# instead be running a possibly incompatible make. This might happen if
# the user types "gmake" instead of a plain "make", for example. The
# correct current value of MAKE will come through from the main perl
# makefile as MAKE=/whatever/make in $makecmd. We'll be cautious in
# case third party users of this script (are there any?) don't have the
# MAKE=$(MAKE) argument, which was added after 5.004_03.
case "$makecmd" in
MAKE=*)
eval $makecmd
;;
*) echo 'ext/util/make_ext: WARNING: Please include MAKE=$(MAKE)'
echo ' in your call to make_ext. See ext/util/make_ext for details.'
exit 1
;;
esac
case $CONFIG in
'')
if test -f config.sh; then TOP=.;
elif test -f ../config.sh; then TOP=..;
elif test -f ../../config.sh; then TOP=../..;
elif test -f ../../../config.sh; then TOP=../../..;
elif test -f ../../../../config.sh; then TOP=../../../..;
else
echo "Can't find config.sh generated by Configure"; exit 1
fi
. $TOP/config.sh
;;
esac
if test "X$extspec" = X; then
echo "make_ext: no extension specified"
exit 1;
fi
# The Perl Makefile.SH will expand all extensions to
# lib/auto/X/X.a (or lib/auto/X/Y/Y.a if nested)
# A user wishing to run make_ext might use
# X (or X/Y or X::Y if nested)
# canonise into X/Y form (pname)
case "$extspec" in
lib*) # Remove lib/auto prefix and /*.* suffix
pname=`echo "$extspec" | sed -e 's:^lib/auto/::' -e 's:/[^/]*\.[^/]*$::' ` ;;
ext*) # Remove ext/ prefix and /pm_to_blib suffix
pname=`echo "$extspec" | sed -e 's:^ext/::' -e 's:/pm_to_blib$::' ` ;;
*::*) # Convert :: to /
pname=`echo "$extspec" | sed -e 's/::/\//g' ` ;;
*) pname="$extspec" ;;
esac
# echo "Converted $extspec to $pname"
mname=`echo "$pname" | sed -e 's!/!::!g'`
depth=`echo "$pname" | sed -e 's![^/][^/]*!..!g'`
makefile=Makefile
makeargs=''
makeopts=''
if test ! -d "ext/$pname"; then
echo " Skipping $extspec (directory does not exist)"
exit 0 # not an error ?
fi
echo " Making $mname ($target)"
cd ext/$pname
# check link type and do any preliminaries
case "$target" in
# convert 'static' or 'dynamic' into 'all LINKTYPE=XXX'
static) makeargs="LINKTYPE=static CCCDLFLAGS="
target=all
;;
dynamic) makeargs="LINKTYPE=dynamic";
target=all
;;
nonxs) makeargs="";
target=all
;;
*clean) # If Makefile has been moved to Makefile.old by a make clean
# then use Makefile.old for realclean rather than rebuild it
if test ! -f $makefile -a -f Makefile.old; then
makefile=Makefile.old
makeopts="-f $makefile"
echo "Note: Using Makefile.old"
fi
;;
*) # for the time being we are strict about what make_ext is used for
echo "make_ext: unknown make target '$target'"; exit 1
;;
'') echo "make_ext: no make target specified (eg static or dynamic)"; exit 1
;;
esac
if test ! -f $makefile ; then
test -f Makefile.PL && ../$depth/miniperl -I../$depth/lib Makefile.PL INSTALLDIRS=perl PERL_CORE=1 $passthru
fi
if test ! -f $makefile ; then
if test -f Makefile.SH; then
echo "Warning: Writing $makefile from old-style Makefile.SH!"
sh Makefile.SH
else
echo "Warning: No Makefile!"
fi
fi
case "$target" in
clean) ;;
realclean) ;;
*) # Give makefile an opportunity to rewrite itself.
# reassure users that life goes on...
$MAKE config $passthru || echo "$MAKE config failed, continuing anyway..."
;;
esac
$MAKE $makeopts $target $makeargs $passthru || exit
exit $?
|