Commit | Line | Data |
---|---|---|
8736538c AS |
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 $CONFIG 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 | # shell script feeding perlld to decent perl | |
2c2d71f5 | 29 | ld2: $& Makefile perlld ${src}/cygwin/ld2.in |
8736538c | 30 | @echo "extracting ld2 (with variable substitutions)" |
2c2d71f5 | 31 | @$sed s,@buildpath@,$addtopath,g <${src}/cygwin/ld2.in >ld2 |
1cab015a EF |
32 | @echo "installing ld2 into $installbin" |
33 | # install is included in Cygwin distributions, and we make a note of th | |
2c2d71f5 | 34 | # requirement in the README.cygwin file. However, let's give them |
1cab015a EF |
35 | # a warning. |
36 | @if test -n "`type $1 2>&1 | sed -n -e '/'$1'$/p'`" ; then \ | |
37 | install -c -m 755 ld2 ${installbin}/ld2 ; \ | |
38 | else \ | |
39 | echo "*************************************************" ; \ | |
2c2d71f5 | 40 | echo "Oh, no! You didn't read the README.cygwin" ; \ |
1cab015a EF |
41 | echo "file, which stated that \"install\" was required." ; \ |
42 | echo "Make will probably fail in a few more steps." ; \ | |
43 | echo "When it does, copy \"ld2\" to a directory in" ; \ | |
44 | echo "your path, other than \".\"." ; \ | |
45 | echo "\"/usr/local/bin\" or something similar will do." ; \ | |
46 | echo "Then restart make." ; \ | |
47 | echo "*************************************************" ; \ | |
48 | fi | |
49 | ||
8736538c AS |
50 | !GROK!THIS! |
51 | ||
52 | $spitshell >>Makefile <<!GROK!THIS! | |
53 | ||
54 | # perlld parameters | |
55 | # | |
56 | # this one is pretty mandatory | |
57 | DLLWRAP = 'dllwrap' | |
58 | ||
59 | # following are optional. | |
60 | WRAPDRIVER = gcc | |
61 | DLLTOOL = dlltool | |
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 AS |
71 | @echo "extracting perlld (with variable substitutions)" |
72 | @$sed -e s,@CC@,\${CC}, -e s,@DLLWRAP@,\${DLLWRAP},g \\ | |
73 | -e s,@WRAPDRIVER@,\${WRAPDRIVER},g -e s,@DLLTOOL@,\${DLLTOOL},g \\ | |
74 | -e s,@AS@,\${AS},g -e s,@EXPORT_ALL@,\${EXPORT_ALL},g \\ | |
75 | -e s,@DEF_EXT@,\${DEF_EXT},g -e s,@EXP_EXT@,\${EXP_EXT},g \\ | |
76 | -e s,@LIB_EXT@,\${LIB_EXT},g \\ | |
2c2d71f5 | 77 | ${src}/cygwin/perlld.in >perlld |
8736538c AS |
78 | |
79 | !GROK!THIS! | |
80 | ||
81 | # make sure that all library names are not malformed | |
82 | libperl=`echo $libperl|sed -e s,\\\..*,,` | |
83 | ||
84 | # it would be nice to allow dll to have any name, | |
85 | # but for now i insist on 'lib<whatever>.dll' | |
86 | if ( ! ( echo $libperl | grep '^lib' >/dev/null ) ) | |
87 | then | |
88 | libperl=lib$libperl | |
89 | fi | |
90 | linklibperl=-l`echo $libperl|sed -e s,^lib,,` | |
91 | ||
92 | $spitshell >>Makefile <<!GROK!THIS! | |
93 | LIBPERL = $libperl | |
94 | LLIBPERL= $linklibperl | |
8736538c AS |
95 | CLDFLAGS= -L$addtopath $ldflags |
96 | CAT = $cat | |
97 | AWK = $awk | |
98 | !GROK!THIS! | |
99 | ||
100 | case "$useshrplib" in | |
101 | true) | |
102 | $spitshell >>Makefile <<'!NO!SUBS!' | |
f89d6eaa | 103 | cwobj = $(obj) |
8736538c AS |
104 | |
105 | # override default rule (NB: make croaks!) to force dll usage | |
106 | perlmain$(OBJ_EXT): perlmain.c | |
1cab015a | 107 | $(CCCMD) $(PLDLFLAGS) -DUSEIMPORTLIB $*.c |
8736538c AS |
108 | |
109 | # library used to make statically linked executables | |
110 | # miniperl is linked against it to avoid libperl.dll locking | |
111 | $(LIBPERL)s$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) | |
112 | $(AR) rcu $@ perl$(OBJ_EXT) $(cwobj) | |
113 | ||
8736538c AS |
114 | # dll and import library |
115 | $(LIBPERL)$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) ld2 | |
116 | $(LDLIBPTH) ld2 $(SHRPLDFLAGS) -o $(LIBPERL)$(DLSUFFIX) \ | |
117 | perl$(OBJ_EXT) $(cwobj) $(libs) | |
118 | ||
119 | # How to build executables. | |
120 | ||
121 | # The miniperl -w -MExporter line is a basic cheap test to catch errors | |
122 | # before make goes on to run preplibrary and then MakeMaker on extensions. | |
123 | # This is very handy because later errors are often caused by miniperl | |
124 | # build problems but that's not obvious to the novice. | |
125 | # The Module used here must not depend on Config or any extensions. | |
126 | ||
127 | miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)s$(LIB_EXT) | |
128 | $(LDLIBPTH) $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) $(LLIBPERL)s $(libs) | |
129 | $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e 0 || $(MAKE) minitest | |
130 | ||
131 | !NO!SUBS! | |
132 | ;; | |
133 | *) | |
134 | $spitshell >>Makefile <<'!NO!SUBS!' | |
d493b042 | 135 | cwobj = $(obj) |
8736538c AS |
136 | |
137 | # perl library | |
138 | $(LIBPERL)$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) | |
139 | $(AR) rcu $@ perl$(OBJ_EXT) $(cwobj) | |
140 | ||
141 | # How to build executables. | |
142 | ||
143 | # The miniperl -w -MExporter line is a basic cheap test to catch errors | |
144 | # before make goes on to run preplibrary and then MakeMaker on extensions. | |
145 | # This is very handy because later errors are often caused by miniperl | |
146 | # build problems but that's not obvious to the novice. | |
147 | # The Module used here must not depend on Config or any extensions. | |
148 | ||
149 | miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) | |
150 | $(LDLIBPTH) $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) $(LLIBPERL) $(libs) | |
151 | $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e 0 || $(MAKE) minitest | |
152 | ||
153 | !NO!SUBS! | |
154 | ;; | |
155 | esac | |
156 | ||
157 | # libperl.a is _the_ library both in dll and static cases | |
158 | # $(LIBPERL)$(LIB_EXT) expands to this name dependless of build model | |
159 | # | |
160 | $spitshell >>Makefile <<'!NO!SUBS!' | |
161 | ||
162 | perl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs | |
163 | $(SHRPENV) $(LDLIBPTH) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) | |
164 | ||
165 | pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs | |
166 | $(SHRPENV) $(LDLIBPTH) purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) | |
167 | ||
168 | purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs | |
169 | $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) | |
170 | ||
171 | quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs | |
172 | $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) | |
173 | ||
174 | !NO!SUBS! | |
175 | ||
176 | # suid perl is removed - i've never seen suid scripts for win32 | |
177 | ||
178 | ############################################## | |
179 | # additional targets | |
180 | ||
181 | $spitshell >>Makefile <<'!NO!SUBS!' | |
182 | ||
183 | DIST_DIRECTORY = .dist | |
184 | ||
185 | distdir: miniperl | |
186 | -mkdir $(DIST_DIRECTORY) | |
187 | ./miniperl '-MExtUtils::Manifest' \ | |
188 | -e "ExtUtils::Manifest::manicopy(ExtUtils::Manifest::maniread(),'$(DIST_DIRECTORY)')" | |
189 | ||
190 | !NO!SUBS! |