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 |
dfc05e5b |
59 | VERSION = '$version' |
8736538c |
60 | |
61 | # following are optional. |
8736538c |
62 | EXPORT_ALL = 1 |
63 | |
64 | # if some of extensions are empty, |
65 | # no corresponding output will be done. |
66 | # most probably, you'd like to have an export library |
67 | DEF_EXT = .def |
68 | EXP_EXT = .exp |
69 | |
2c2d71f5 |
70 | perlld: $& Makefile ${src}/cygwin/perlld.in |
8736538c |
71 | @echo "extracting perlld (with variable substitutions)" |
7d102301 |
72 | @$sed -e s,@CC@,\${CC}, -e s,@EXPORT_ALL@,\${EXPORT_ALL},g \\ |
8736538c |
73 | -e s,@DEF_EXT@,\${DEF_EXT},g -e s,@EXP_EXT@,\${EXP_EXT},g \\ |
dfc05e5b |
74 | -e s,@LIB_EXT@,\${LIB_EXT},g -e s,@VERSION@,\${VERSION},g \\ |
2c2d71f5 |
75 | ${src}/cygwin/perlld.in >perlld |
8736538c |
76 | |
77 | !GROK!THIS! |
78 | |
79 | # make sure that all library names are not malformed |
80 | libperl=`echo $libperl|sed -e s,\\\..*,,` |
81 | |
8736538c |
82 | linklibperl=-l`echo $libperl|sed -e s,^lib,,` |
83 | |
84 | $spitshell >>Makefile <<!GROK!THIS! |
85 | LIBPERL = $libperl |
86 | LLIBPERL= $linklibperl |
8736538c |
87 | CLDFLAGS= -L$addtopath $ldflags |
88 | CAT = $cat |
89 | AWK = $awk |
90 | !GROK!THIS! |
91 | |
92 | case "$useshrplib" in |
93 | true) |
94 | $spitshell >>Makefile <<'!NO!SUBS!' |
f89d6eaa |
95 | cwobj = $(obj) |
8736538c |
96 | |
97 | # override default rule (NB: make croaks!) to force dll usage |
98 | perlmain$(OBJ_EXT): perlmain.c |
1cab015a |
99 | $(CCCMD) $(PLDLFLAGS) -DUSEIMPORTLIB $*.c |
8736538c |
100 | |
101 | # library used to make statically linked executables |
102 | # miniperl is linked against it to avoid libperl.dll locking |
52ef5499 |
103 | $(LIBPERL)$(LIB_EXT): $& $(cwobj) |
104 | $(AR) rcu $@ $(cwobj) |
8736538c |
105 | |
8736538c |
106 | # dll and import library |
52ef5499 |
107 | $(LIBPERL).dll$(LIB_EXT): $& $(cwobj) ld2 |
8736538c |
108 | $(LDLIBPTH) ld2 $(SHRPLDFLAGS) -o $(LIBPERL)$(DLSUFFIX) \ |
52ef5499 |
109 | $(cwobj) $(libs) |
8736538c |
110 | |
111 | # How to build executables. |
112 | |
113 | # The miniperl -w -MExporter line is a basic cheap test to catch errors |
114 | # before make goes on to run preplibrary and then MakeMaker on extensions. |
115 | # This is very handy because later errors are often caused by miniperl |
116 | # build problems but that's not obvious to the novice. |
117 | # The Module used here must not depend on Config or any extensions. |
118 | |
30f43356 |
119 | miniperl.exe \ |
b53432e4 |
120 | miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) opmini$(OBJ_EXT) |
121 | $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs) |
bd0dd1d8 |
122 | $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest |
8736538c |
123 | |
b53432e4 |
124 | perl.exe \ |
125 | perl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
126 | $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) |
127 | |
128 | pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
129 | $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) |
130 | |
131 | purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
132 | $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) |
133 | |
134 | quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
135 | $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) |
136 | |
8736538c |
137 | !NO!SUBS! |
138 | ;; |
139 | *) |
140 | $spitshell >>Makefile <<'!NO!SUBS!' |
d493b042 |
141 | cwobj = $(obj) |
8736538c |
142 | |
143 | # perl library |
52ef5499 |
144 | $(LIBPERL)$(LIB_EXT): $& $(cwobj) |
145 | $(AR) rcu $@ $(cwobj) |
8736538c |
146 | |
147 | # How to build executables. |
148 | |
149 | # The miniperl -w -MExporter line is a basic cheap test to catch errors |
150 | # before make goes on to run preplibrary and then MakeMaker on extensions. |
151 | # This is very handy because later errors are often caused by miniperl |
152 | # build problems but that's not obvious to the novice. |
153 | # The Module used here must not depend on Config or any extensions. |
154 | |
30f43356 |
155 | miniperl.exe \ |
bd0dd1d8 |
156 | miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) opmini$(OBJ_EXT) |
74294fdf |
157 | $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs) |
bd0dd1d8 |
158 | $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest |
8736538c |
159 | |
b53432e4 |
160 | perl.exe \ |
161 | perl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
162 | $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) -Wl,-Bstatic $(LLIBPERL) -Wl,-Bdynamic `cat ext.libs` $(libs) |
163 | |
164 | pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
165 | $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) |
166 | |
167 | purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
168 | $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) |
169 | |
170 | quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
171 | $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) |
172 | |
8736538c |
173 | !NO!SUBS! |
174 | ;; |
175 | esac |
176 | |
177 | # libperl.a is _the_ library both in dll and static cases |
178 | # $(LIBPERL)$(LIB_EXT) expands to this name dependless of build model |
179 | # |
b250498f |
180 | # NOTE: The "-Wl,-Bstatic $(LLIBPERL) -Wl,-Bdynamic" is required to give |
181 | # the import library linking priority over the dynamic library, since both |
182 | # the .dll and .a are in the same directory. When the new standard for |
183 | # naming import/dynamic/static libraries emerges this should be updated. |
184 | # |
8736538c |
185 | $spitshell >>Makefile <<'!NO!SUBS!' |
186 | |
8736538c |
187 | |
188 | !NO!SUBS! |
189 | |
190 | # suid perl is removed - i've never seen suid scripts for win32 |
191 | |
192 | ############################################## |
193 | # additional targets |
194 | |
195 | $spitshell >>Makefile <<'!NO!SUBS!' |
196 | |
197 | DIST_DIRECTORY = .dist |
198 | |
199 | distdir: miniperl |
200 | -mkdir $(DIST_DIRECTORY) |
201 | ./miniperl '-MExtUtils::Manifest' \ |
202 | -e "ExtUtils::Manifest::manicopy(ExtUtils::Manifest::maniread(),'$(DIST_DIRECTORY)')" |
203 | |
2d4c99b6 |
204 | cygwin1.dll: /bin/cygwin1.dll |
205 | cp /bin/cygwin1.dll . |
206 | |
207 | cygcrypt-0.dll: /bin/cygcrypt-0.dll |
208 | cp /bin/cygcrypt-0.dll . |
209 | |
210 | test_prep: cygwin1.dll cygcrypt-0.dll |
211 | |
8736538c |
212 | !NO!SUBS! |