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