1 | # This file is read by Makefile.SH to produce rules for $(LIBPERL) (and
|
---|
2 | # some additional rules as well).
|
---|
3 |
|
---|
4 | # Rerun `sh Makefile.SH; make depend' after making any change.
|
---|
5 |
|
---|
6 | # Additional rules supported: libperls.a (for static linking),
|
---|
7 | # ld2, perlld (dynamic linking tools)
|
---|
8 | #
|
---|
9 |
|
---|
10 | #! /bin/sh
|
---|
11 | case $PERL_CONFIG_SH in
|
---|
12 | '')
|
---|
13 | if test -f config.sh; then TOP=.;
|
---|
14 | elif test -f ../config.sh; then TOP=..;
|
---|
15 | elif test -f ../../config.sh; then TOP=../..;
|
---|
16 | elif test -f ../../../config.sh; then TOP=../../..;
|
---|
17 | elif test -f ../../../../config.sh; then TOP=../../../..;
|
---|
18 | else
|
---|
19 | echo "Can't find config.sh."; exit 1
|
---|
20 | fi
|
---|
21 | . $TOP/config.sh
|
---|
22 | ;;
|
---|
23 | esac
|
---|
24 |
|
---|
25 | addtopath=`pwd`
|
---|
26 | $spitshell >>Makefile <<!GROK!THIS!
|
---|
27 |
|
---|
28 | cygwin.c: cygwin/cygwin.c
|
---|
29 | \$(LNS) cygwin/cygwin.c
|
---|
30 |
|
---|
31 | # shell script feeding perlld to decent perl
|
---|
32 | ld2: $& Makefile perlld ${src}/cygwin/ld2.in
|
---|
33 | @echo "extracting ld2 (with variable substitutions)"
|
---|
34 | @$sed s,@buildpath@,$addtopath,g <${src}/cygwin/ld2.in >ld2
|
---|
35 | @chmod a+x ld2
|
---|
36 | @echo "installing ld2 into $installbin"
|
---|
37 | # install is included in Cygwin distributions, and we make a note of th
|
---|
38 | # requirement in the README.cygwin file. However, let's give them
|
---|
39 | # a warning.
|
---|
40 | @/usr/bin/install -c -m 755 ld2 ${installbin}/ld2
|
---|
41 | @if test ! -f ${installbin}/ld2; then \
|
---|
42 | echo "*************************************************" ; \
|
---|
43 | echo "Make will probably fail in a few more steps." ; \
|
---|
44 | echo "When it does, copy \"ld2\" to a directory in" ; \
|
---|
45 | echo "your path, other than \".\"." ; \
|
---|
46 | echo "\"/usr/local/bin\" or something similar will do." ; \
|
---|
47 | echo "Then restart make." ; \
|
---|
48 | echo "*************************************************" ; \
|
---|
49 | fi
|
---|
50 |
|
---|
51 | !GROK!THIS!
|
---|
52 |
|
---|
53 | $spitshell >>Makefile <<!GROK!THIS!
|
---|
54 |
|
---|
55 | # perlld parameters
|
---|
56 | #
|
---|
57 | # these ones are mandatory
|
---|
58 | DLLWRAP = 'dllwrap'
|
---|
59 | VERSION = '$version'
|
---|
60 |
|
---|
61 | # following are optional.
|
---|
62 | WRAPDRIVER = gcc
|
---|
63 | DLLTOOL = dlltool
|
---|
64 | EXPORT_ALL = 1
|
---|
65 |
|
---|
66 | # if some of extensions are empty,
|
---|
67 | # no corresponding output will be done.
|
---|
68 | # most probably, you'd like to have an export library
|
---|
69 | DEF_EXT = .def
|
---|
70 | EXP_EXT = .exp
|
---|
71 |
|
---|
72 | perlld: $& Makefile ${src}/cygwin/perlld.in
|
---|
73 | @echo "extracting perlld (with variable substitutions)"
|
---|
74 | @$sed -e s,@CC@,\${CC}, -e s,@DLLWRAP@,\${DLLWRAP},g \\
|
---|
75 | -e s,@WRAPDRIVER@,\${WRAPDRIVER},g -e s,@DLLTOOL@,\${DLLTOOL},g \\
|
---|
76 | -e s,@AS@,\${AS},g -e s,@EXPORT_ALL@,\${EXPORT_ALL},g \\
|
---|
77 | -e s,@DEF_EXT@,\${DEF_EXT},g -e s,@EXP_EXT@,\${EXP_EXT},g \\
|
---|
78 | -e s,@LIB_EXT@,\${LIB_EXT},g -e s,@VERSION@,\${VERSION},g \\
|
---|
79 | ${src}/cygwin/perlld.in >perlld
|
---|
80 |
|
---|
81 | !GROK!THIS!
|
---|
82 |
|
---|
83 | # make sure that all library names are not malformed
|
---|
84 | libperl=`echo $libperl|sed -e s,\\\..*,,`
|
---|
85 |
|
---|
86 | linklibperl=-l`echo $libperl|sed -e s,^lib,,`
|
---|
87 |
|
---|
88 | $spitshell >>Makefile <<!GROK!THIS!
|
---|
89 | LIBPERL = $libperl
|
---|
90 | LLIBPERL= $linklibperl
|
---|
91 | CLDFLAGS= -L$addtopath $ldflags
|
---|
92 | CAT = $cat
|
---|
93 | AWK = $awk
|
---|
94 | !GROK!THIS!
|
---|
95 |
|
---|
96 | case "$useshrplib" in
|
---|
97 | true)
|
---|
98 | $spitshell >>Makefile <<'!NO!SUBS!'
|
---|
99 | cwobj = $(obj)
|
---|
100 |
|
---|
101 | # override default rule (NB: make croaks!) to force dll usage
|
---|
102 | perlmain$(OBJ_EXT): perlmain.c
|
---|
103 | $(CCCMD) $(PLDLFLAGS) -DUSEIMPORTLIB $*.c
|
---|
104 |
|
---|
105 | # library used to make statically linked executables
|
---|
106 | # miniperl is linked against it to avoid libperl.dll locking
|
---|
107 | $(LIBPERL)$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj)
|
---|
108 | $(AR) rcu $@ perl$(OBJ_EXT) $(cwobj)
|
---|
109 |
|
---|
110 | # dll and import library
|
---|
111 | $(LIBPERL).dll$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) ld2
|
---|
112 | $(LDLIBPTH) ld2 $(SHRPLDFLAGS) -o $(LIBPERL)$(DLSUFFIX) \
|
---|
113 | perl$(OBJ_EXT) $(cwobj) $(libs)
|
---|
114 |
|
---|
115 | # How to build executables.
|
---|
116 |
|
---|
117 | # The miniperl -w -MExporter line is a basic cheap test to catch errors
|
---|
118 | # before make goes on to run preplibrary and then MakeMaker on extensions.
|
---|
119 | # This is very handy because later errors are often caused by miniperl
|
---|
120 | # build problems but that's not obvious to the novice.
|
---|
121 | # The Module used here must not depend on Config or any extensions.
|
---|
122 |
|
---|
123 | miniperl.exe \
|
---|
124 | miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) opmini$(OBJ_EXT)
|
---|
125 | $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs)
|
---|
126 | $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
|
---|
127 |
|
---|
128 | perl.exe \
|
---|
129 | perl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
|
---|
130 | $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
|
---|
131 |
|
---|
132 | pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
|
---|
133 | $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
|
---|
134 |
|
---|
135 | purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
|
---|
136 | $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
|
---|
137 |
|
---|
138 | quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
|
---|
139 | $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
|
---|
140 |
|
---|
141 | !NO!SUBS!
|
---|
142 | ;;
|
---|
143 | *)
|
---|
144 | $spitshell >>Makefile <<'!NO!SUBS!'
|
---|
145 | cwobj = $(obj)
|
---|
146 |
|
---|
147 | # perl library
|
---|
148 | $(LIBPERL)$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj)
|
---|
149 | $(AR) rcu $@ perl$(OBJ_EXT) $(cwobj)
|
---|
150 |
|
---|
151 | # How to build executables.
|
---|
152 |
|
---|
153 | # The miniperl -w -MExporter line is a basic cheap test to catch errors
|
---|
154 | # before make goes on to run preplibrary and then MakeMaker on extensions.
|
---|
155 | # This is very handy because later errors are often caused by miniperl
|
---|
156 | # build problems but that's not obvious to the novice.
|
---|
157 | # The Module used here must not depend on Config or any extensions.
|
---|
158 |
|
---|
159 | miniperl.exe \
|
---|
160 | miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) opmini$(OBJ_EXT)
|
---|
161 | $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs)
|
---|
162 | $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
|
---|
163 |
|
---|
164 | perl.exe \
|
---|
165 | perl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
|
---|
166 | $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) -Wl,-Bstatic $(LLIBPERL) -Wl,-Bdynamic `cat ext.libs` $(libs)
|
---|
167 |
|
---|
168 | pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
|
---|
169 | $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
|
---|
170 |
|
---|
171 | purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
|
---|
172 | $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
|
---|
173 |
|
---|
174 | quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
|
---|
175 | $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
|
---|
176 |
|
---|
177 | !NO!SUBS!
|
---|
178 | ;;
|
---|
179 | esac
|
---|
180 |
|
---|
181 | # libperl.a is _the_ library both in dll and static cases
|
---|
182 | # $(LIBPERL)$(LIB_EXT) expands to this name dependless of build model
|
---|
183 | #
|
---|
184 | # NOTE: The "-Wl,-Bstatic $(LLIBPERL) -Wl,-Bdynamic" is required to give
|
---|
185 | # the import library linking priority over the dynamic library, since both
|
---|
186 | # the .dll and .a are in the same directory. When the new standard for
|
---|
187 | # naming import/dynamic/static libraries emerges this should be updated.
|
---|
188 | #
|
---|
189 | $spitshell >>Makefile <<'!NO!SUBS!'
|
---|
190 |
|
---|
191 |
|
---|
192 | !NO!SUBS!
|
---|
193 |
|
---|
194 | # suid perl is removed - i've never seen suid scripts for win32
|
---|
195 |
|
---|
196 | ##############################################
|
---|
197 | # additional targets
|
---|
198 |
|
---|
199 | $spitshell >>Makefile <<'!NO!SUBS!'
|
---|
200 |
|
---|
201 | DIST_DIRECTORY = .dist
|
---|
202 |
|
---|
203 | distdir: miniperl
|
---|
204 | -mkdir $(DIST_DIRECTORY)
|
---|
205 | ./miniperl '-MExtUtils::Manifest' \
|
---|
206 | -e "ExtUtils::Manifest::manicopy(ExtUtils::Manifest::maniread(),'$(DIST_DIRECTORY)')"
|
---|
207 |
|
---|
208 | !NO!SUBS!
|
---|