]>
Commit | Line | Data |
---|---|---|
567a9e6f RL |
1 | ## |
2 | ## Makefile for OpenSSL | |
3 | ## | |
4 | ## {- join("\n## ", @autowarntext) -} | |
5 | {- | |
9dd4ed28 | 6 | our $makedepprog = platform->makedepprog(); |
834aae2a | 7 | |
567a9e6f | 8 | sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ } |
f5c174ff | 9 | |
cff89b17 AP |
10 | # Shared AIX support is special. We put libcrypto[64].so.ver into |
11 | # libcrypto.a and use libcrypto_a.a as static one. | |
12 | sub sharedaix { !$disabled{shared} && $config{target} =~ /^aix/ } | |
13 | ||
9dd4ed28 | 14 | our $sover_dirname = platform->shlib_version_as_filename(); |
33105818 | 15 | |
27c40a93 BL |
16 | # This makes sure things get built in the order they need |
17 | # to. You're welcome. | |
18 | sub dependmagic { | |
19 | my $target = shift; | |
20 | ||
21 | return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target"; | |
22 | } | |
c00d9311 RL |
23 | |
24 | our $COLUMNS = $ENV{COLUMNS}; | |
25 | if ($COLUMNS =~ /^\d+$/) { | |
26 | $COLUMNS = int($COLUMNS) - 2; # 2 to leave space for ending ' \' | |
27 | } else { | |
28 | $COLUMNS = 76; | |
29 | } | |
30 | ||
31 | sub fill_lines { | |
32 | my $item_sep = shift; # string | |
33 | my $line_length = shift; # number of chars | |
34 | ||
35 | my @result = (); | |
36 | my $resultpos = 0; | |
37 | ||
38 | foreach (@_) { | |
39 | my $fill_line = $result[$resultpos] // ''; | |
40 | my $newline = | |
41 | ($fill_line eq '' ? '' : $fill_line . $item_sep) . $_; | |
42 | ||
43 | if (length($newline) > $line_length) { | |
44 | # If this is a single item and the intended result line | |
45 | # is empty, we put it there anyway | |
46 | if ($fill_line eq '') { | |
47 | $result[$resultpos++] = $newline; | |
48 | } else { | |
49 | $result[++$resultpos] = $_; | |
50 | } | |
51 | } else { | |
52 | $result[$resultpos] = $newline; | |
53 | } | |
54 | } | |
55 | return @result; | |
56 | } | |
834aae2a | 57 | ''; |
567a9e6f RL |
58 | -} |
59 | PLATFORM={- $config{target} -} | |
60 | OPTIONS={- $config{options} -} | |
61 | CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) | |
62 | SRCDIR={- $config{sourcedir} -} | |
63 | BLDDIR={- $config{builddir} -} | |
64 | ||
16942e08 | 65 | VERSION={- "$config{full_version}" -} |
567a9e6f RL |
66 | MAJOR={- $config{major} -} |
67 | MINOR={- $config{minor} -} | |
3a63dbef | 68 | SHLIB_VERSION_NUMBER={- $config{shlib_version} -} |
567a9e6f | 69 | SHLIB_TARGET={- $target{shared_target} -} |
9dd4ed28 | 70 | |
c00d9311 RL |
71 | LIBS={- join(" \\\n" . ' ' x 5, |
72 | fill_lines(" ", $COLUMNS - 5, | |
73 | map { platform->staticlib($_) // () } | |
74 | @{$unified_info{libraries}})) -} | |
75 | SHLIBS={- join(" \\\n" . ' ' x 7, | |
76 | fill_lines(" ", $COLUMNS - 7, | |
77 | map { platform->sharedlib($_) // () } | |
78 | @{$unified_info{libraries}})) -} | |
79 | SHLIB_INFO={- join(" \\\n" . ' ' x 11, | |
80 | fill_lines(" ", $COLUMNS - 11, | |
81 | map { my $x = platform->sharedlib($_); | |
82 | my $y = platform->sharedlib_simple($_); | |
83 | $x ? "\"$x;$y\"" : () } | |
84 | @{$unified_info{libraries}})) -} | |
85 | MODULES={- join(" \\\n" . ' ' x 8, | |
86 | fill_lines(" ", $COLUMNS - 8, | |
87 | map { platform->dso($_) } | |
88 | @{$unified_info{modules}})) -} | |
89 | PROGRAMS={- join(" \\\n" . ' ' x 9, | |
90 | fill_lines(" ", $COLUMNS - 9, | |
91 | map { platform->bin($_) } | |
92 | @{$unified_info{programs}})) -} | |
93 | SCRIPTS={- join(" \\\n" . ' ' x 8, | |
94 | fill_lines(" ", $COLUMNS - 8, @{$unified_info{scripts}})) -} | |
29eed3dd | 95 | {- output_off() if $disabled{makedepend}; "" -} |
c00d9311 RL |
96 | DEPS={- join(" \\\n" . ' ' x 5, |
97 | fill_lines(" ", $COLUMNS - 5, | |
98 | map { platform->isobj($_) ? platform->dep($_) : () } | |
99 | grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } | |
100 | keys %{$unified_info{sources}})); -} | |
29eed3dd | 101 | {- output_on() if $disabled{makedepend}; "" -} |
c00d9311 RL |
102 | GENERATED_MANDATORY={- join(" \\\n" . ' ' x 20, |
103 | fill_lines(" ", $COLUMNS - 20, | |
104 | @{$unified_info{depends}->{""}})) -} | |
8258975c | 105 | GENERATED={- # common0.tmpl provides @generated |
c00d9311 RL |
106 | join(" \\\n" . ' ' x 5, |
107 | fill_lines(" ", $COLUMNS - 5, | |
108 | map { platform->convertext($_) } @generated )) -} | |
9dd4ed28 | 109 | |
ac6bba6f | 110 | INSTALL_LIBS={- |
c00d9311 RL |
111 | join(" \\\n" . ' ' x 13, |
112 | fill_lines(" ", $COLUMNS - 13, | |
113 | map { platform->staticlib($_) // () } | |
114 | grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } | |
115 | @{$unified_info{libraries}})) | |
ac6bba6f RL |
116 | -} |
117 | INSTALL_SHLIBS={- | |
c00d9311 RL |
118 | join(" \\\n" . ' ' x 15, |
119 | fill_lines(" ", $COLUMNS - 15, | |
120 | map { platform->sharedlib($_) // () } | |
121 | grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } | |
122 | @{$unified_info{libraries}})) | |
ac6bba6f RL |
123 | -} |
124 | INSTALL_SHLIB_INFO={- | |
c00d9311 RL |
125 | join(" \\\n" . ' ' x 19, |
126 | fill_lines(" ", $COLUMNS - 19, | |
127 | map { my $x = platform->sharedlib($_); | |
128 | my $y = platform->sharedlib_simple($_); | |
129 | $x ? "\"$x;$y\"" : () } | |
130 | grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } | |
131 | @{$unified_info{libraries}})) | |
ac6bba6f RL |
132 | -} |
133 | INSTALL_ENGINES={- | |
c00d9311 RL |
134 | join(" \\\n" . ' ' x 16, |
135 | fill_lines(" ", $COLUMNS - 16, | |
136 | map { platform->dso($_) } | |
137 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
138 | && $unified_info{attributes}->{modules}->{$_}->{engine} } | |
139 | @{$unified_info{modules}})) | |
ac6bba6f | 140 | -} |
32a5dc9e | 141 | INSTALL_MODULES={- |
41149648 RL |
142 | join(" \\\n" . ' ' x 16, |
143 | fill_lines(" ", $COLUMNS - 16, | |
144 | map { platform->dso($_) } | |
145 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
146 | && !$unified_info{attributes}->{modules}->{$_}->{engine} } | |
147 | @{$unified_info{modules}})) | |
148 | -} | |
ac6bba6f | 149 | INSTALL_PROGRAMS={- |
c00d9311 RL |
150 | join(" \\\n" . ' ' x 16, |
151 | fill_lines(" ", $COLUMNS - 16, map { platform->bin($_) } | |
152 | grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} } | |
153 | @{$unified_info{programs}})) | |
ac6bba6f | 154 | -} |
994e86a9 | 155 | BIN_SCRIPTS={- |
c00d9311 RL |
156 | join(" \\\n" . ' ' x 12, |
157 | fill_lines(" ", $COLUMNS - 12, | |
158 | map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname}; | |
159 | $x ? "$_:$x" : $_ } | |
160 | grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} | |
161 | && !$unified_info{attributes}->{scripts}->{$_}->{misc} } | |
162 | @{$unified_info{scripts}})) | |
994e86a9 RL |
163 | -} |
164 | MISC_SCRIPTS={- | |
c00d9311 RL |
165 | join(" \\\n" . ' ' x 13, |
166 | fill_lines(" ", $COLUMNS - 13, | |
167 | map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname}; | |
168 | $x ? "$_:$x" : $_ } | |
169 | grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} | |
170 | && $unified_info{attributes}->{scripts}->{$_}->{misc} } | |
171 | @{$unified_info{scripts}})) | |
994e86a9 | 172 | -} |
b0940b33 RL |
173 | HTMLDOCS1={- |
174 | join(" \\\n" . ' ' x 10, | |
175 | fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) } | |
176 | @{$unified_info{htmldocs}->{man1}})) -} | |
177 | HTMLDOCS3={- | |
178 | join(" \\\n" . ' ' x 10, | |
179 | fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) } | |
180 | @{$unified_info{htmldocs}->{man3}})) -} | |
181 | HTMLDOCS5={- | |
182 | join(" \\\n" . ' ' x 10, | |
183 | fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) } | |
184 | @{$unified_info{htmldocs}->{man5}})) -} | |
185 | HTMLDOCS7={- | |
186 | join(" \\\n" . ' ' x 10, | |
187 | fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) } | |
188 | @{$unified_info{htmldocs}->{man7}})) -} | |
189 | MANDOCS1={- | |
190 | join(" \\\n" . ' ' x 9, | |
191 | fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) } | |
192 | @{$unified_info{mandocs}->{man1}})) -} | |
193 | MANDOCS3={- | |
194 | join(" \\\n" . ' ' x 9, | |
195 | fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) } | |
196 | @{$unified_info{mandocs}->{man3}})) -} | |
197 | MANDOCS5={- | |
198 | join(" \\\n" . ' ' x 9, | |
199 | fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) } | |
200 | @{$unified_info{mandocs}->{man5}})) -} | |
201 | MANDOCS7={- | |
202 | join(" \\\n" . ' ' x 9, | |
203 | fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) } | |
204 | @{$unified_info{mandocs}->{man7}})) -} | |
567a9e6f | 205 | |
a3f1fc25 RL |
206 | APPS_OPENSSL="{- use File::Spec::Functions; |
207 | catfile("apps","openssl") -}" | |
6a74806e | 208 | |
3c65577f RL |
209 | # DESTDIR is for package builders so that they can configure for, say, |
210 | # /usr/ and yet have everything installed to /tmp/somedir/usr/. | |
567a9e6f | 211 | # Normally it is left empty. |
3c65577f | 212 | DESTDIR= |
567a9e6f RL |
213 | |
214 | # Do not edit these manually. Use Configure with --prefix or --openssldir | |
215 | # to change this! Short explanation in the top comment in Configure | |
216 | INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet | |
217 | # | |
218 | our $prefix = $config{prefix} || "/usr/local"; | |
219 | $prefix -} | |
220 | OPENSSLDIR={- # | |
221 | # The logic here is that if no --openssldir was given, | |
222 | # OPENSSLDIR will get the value from $prefix plus "/ssl". | |
223 | # If --openssldir was given and the value is an absolute | |
224 | # path, OPENSSLDIR will get its value without change. | |
225 | # If the value from --openssldir is a relative path, | |
226 | # OPENSSLDIR will get $prefix with the --openssldir | |
227 | # value appended as a subdirectory. | |
228 | # | |
229 | use File::Spec::Functions; | |
230 | our $openssldir = | |
231 | $config{openssldir} ? | |
232 | (file_name_is_absolute($config{openssldir}) ? | |
233 | $config{openssldir} | |
234 | : catdir($prefix, $config{openssldir})) | |
235 | : catdir($prefix, "ssl"); | |
236 | $openssldir -} | |
e454f3ad RL |
237 | LIBDIR={- our $libdir = $config{libdir}; |
238 | unless ($libdir) { | |
239 | # | |
240 | # if $prefix/lib$target{multilib} is not an existing | |
241 | # directory, then assume that it's not searched by linker | |
242 | # automatically, in which case adding $target{multilib} suffix | |
243 | # causes more grief than we're ready to tolerate, so don't... | |
244 | our $multilib = | |
245 | -d "$prefix/lib$target{multilib}" ? $target{multilib} : ""; | |
246 | $libdir = "lib$multilib"; | |
247 | } | |
248 | file_name_is_absolute($libdir) ? "" : $libdir -} | |
249 | # $(libdir) is chosen to be compatible with the GNU coding standards | |
250 | libdir={- file_name_is_absolute($libdir) | |
251 | ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -} | |
252 | ENGINESDIR=$(libdir)/engines-{- $sover_dirname -} | |
3f4e8d66 | 253 | MODULESDIR=$(libdir)/ossl-modules |
567a9e6f | 254 | |
fad599f7 RL |
255 | # Convenience variable for those who want to set the rpath in shared |
256 | # libraries and applications | |
e454f3ad | 257 | LIBRPATH=$(libdir) |
fad599f7 | 258 | |
dde10ab4 | 259 | MANDIR=$(INSTALLTOP)/share/man |
8be7bdb5 RL |
260 | DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME) |
261 | HTMLDIR=$(DOCDIR)/html | |
567a9e6f | 262 | |
3544091a RL |
263 | # MANSUFFIX is for the benefit of anyone who may want to have a suffix |
264 | # appended after the manpage file section number. "ssl" is popular, | |
265 | # resulting in files such as config.5ssl rather than config.5. | |
266 | MANSUFFIX= | |
567a9e6f RL |
267 | HTMLSUFFIX=html |
268 | ||
5407338a RS |
269 | # For "optional" echo messages, to get "real" silence |
270 | ECHO = echo | |
567a9e6f | 271 | |
abe256e7 RL |
272 | ##### User defined commands and flags ################################ |
273 | ||
274 | # We let the C compiler driver to take care of .s files. This is done in | |
275 | # order to be excused from maintaining a separate set of architecture | |
276 | # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC | |
277 | # gcc, then the driver will automatically translate it to -xarch=v8plus | |
278 | # and pass it down to assembler. In any case, we do not define AS or | |
279 | # ASFLAGS for this reason. | |
280 | ||
281 | CROSS_COMPILE={- $config{CROSS_COMPILE} -} | |
282 | CC=$(CROSS_COMPILE){- $config{CC} -} | |
283 | CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -} | |
284 | CPPFLAGS={- our $cppflags1 = join(" ", | |
285 | (map { "-D".$_} @{$config{CPPDEFINES}}), | |
286 | (map { "-I".$_} @{$config{CPPINCLUDES}}), | |
287 | @{$config{CPPFLAGS}}) -} | |
288 | CFLAGS={- join(' ', @{$config{CFLAGS}}) -} | |
289 | CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -} | |
290 | LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -} | |
291 | EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -} | |
292 | ||
293 | MAKEDEPEND={- $config{makedepprog} -} | |
567a9e6f | 294 | |
9e265322 | 295 | PERL={- $config{PERL} -} |
567a9e6f | 296 | |
abe256e7 RL |
297 | AR=$(CROSS_COMPILE){- $config{AR} -} |
298 | ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -} | |
299 | RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -} | |
300 | RC= $(CROSS_COMPILE){- $config{RC} -} | |
301 | RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -} | |
302 | ||
567a9e6f | 303 | RM= rm -f |
98e5534e | 304 | RMDIR= rmdir |
abe256e7 RL |
305 | TAR= {- $target{TAR} || "tar" -} |
306 | TARFLAGS= {- $target{TARFLAGS} -} | |
567a9e6f RL |
307 | |
308 | BASENAME= openssl | |
309 | NAME= $(BASENAME)-$(VERSION) | |
b741f153 | 310 | # Relative to $(SRCDIR) |
567a9e6f RL |
311 | TARFILE= ../$(NAME).tar |
312 | ||
abe256e7 RL |
313 | ##### Project flags ################################################## |
314 | ||
315 | # Variables starting with CNF_ are common variables for all product types | |
316 | ||
317 | CNF_CPPFLAGS={- our $cppflags2 = | |
318 | join(' ', $target{cppflags} || (), | |
319 | (map { "-D".$_} @{$target{defines}}, | |
320 | @{$config{defines}}), | |
321 | (map { "-I".$_} @{$target{includes}}, | |
322 | @{$config{includes}}), | |
323 | @{$config{cppflags}}) -} | |
324 | CNF_CFLAGS={- join(' ', $target{cflags} || (), | |
325 | @{$config{cflags}}) -} | |
326 | CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (), | |
327 | @{$config{cxxflags}}) -} | |
328 | CNF_LDFLAGS={- join(' ', $target{lflags} || (), | |
329 | @{$config{lflags}}) -} | |
330 | CNF_EX_LIBS={- join(' ', $target{ex_libs} || (), | |
331 | @{$config{ex_libs}}) -} | |
332 | ||
333 | # Variables starting with LIB_ are used to build library object files | |
334 | # and shared libraries. | |
335 | # Variables starting with DSO_ are used to build DSOs and their object files. | |
336 | # Variables starting with BIN_ are used to build programs and their object | |
337 | # files. | |
338 | ||
58d6be5b RL |
339 | LIB_CPPFLAGS={- our $lib_cppflags = |
340 | join(' ', $target{lib_cppflags} || (), | |
abe256e7 RL |
341 | $target{shared_cppflag} || (), |
342 | (map { '-D'.$_ } | |
d368d9d2 RL |
343 | @{$target{lib_defines} || ()}, |
344 | @{$target{shared_defines} || ()}, | |
2fce15b5 RL |
345 | @{$config{lib_defines} || ()}, |
346 | @{$config{shared_defines} || ()}), | |
d368d9d2 RL |
347 | (map { '-I'.quotify1($_) } |
348 | @{$target{lib_includes}}, | |
349 | @{$target{shared_includes}}, | |
350 | @{$config{lib_includes}}, | |
351 | @{$config{shared_includes}}), | |
58d6be5b RL |
352 | @{$config{lib_cppflags}}, |
353 | @{$config{shared_cppflag}}); | |
354 | join(' ', $lib_cppflags, | |
355 | (map { '-D'.$_ } | |
abe256e7 | 356 | 'OPENSSLDIR="\"$(OPENSSLDIR)\""', |
3f4e8d66 RL |
357 | 'ENGINESDIR="\"$(ENGINESDIR)\""', |
358 | 'MODULESDIR="\"$(MODULESDIR)\""'), | |
abe256e7 RL |
359 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} |
360 | LIB_CFLAGS={- join(' ', $target{lib_cflags} || (), | |
361 | $target{shared_cflag} || (), | |
362 | @{$config{lib_cflags}}, | |
363 | @{$config{shared_cflag}}, | |
364 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
365 | LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (), | |
366 | $target{shared_cxxflag} || (), | |
367 | @{$config{lib_cxxflags}}, | |
368 | @{$config{shared_cxxflag}}, | |
369 | '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} | |
370 | LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (), | |
371 | $config{shared_ldflag} || (), | |
372 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
373 | LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
374 | DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (), | |
375 | $target{module_cppflags} || (), | |
2fce15b5 | 376 | (map { '-D'.$_ } |
d368d9d2 RL |
377 | @{$target{dso_defines}}, |
378 | @{$target{module_defines}}, | |
2fce15b5 RL |
379 | @{$config{dso_defines} || ()}, |
380 | @{$config{module_defines} || ()}), | |
d368d9d2 RL |
381 | (map { '-I'.quotify1($_) } |
382 | @{$target{dso_includes}}, | |
383 | @{$target{module_includes}}, | |
384 | @{$config{dso_includes}}, | |
385 | @{$config{module_includes}}), | |
abe256e7 RL |
386 | @{$config{dso_cppflags}}, |
387 | @{$config{module_cppflags}}, | |
388 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} | |
389 | DSO_CFLAGS={- join(' ', $target{dso_cflags} || (), | |
390 | $target{module_cflags} || (), | |
391 | @{$config{dso_cflags}}, | |
392 | @{$config{module_cflags}}, | |
393 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
394 | DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (), | |
395 | $target{module_cxxflags} || (), | |
396 | @{$config{dso_cxxflags}}, | |
397 | @{$config{module_cxxflag}}, | |
398 | '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} | |
399 | DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (), | |
400 | $target{module_ldflags} || (), | |
401 | @{$config{dso_ldflags}}, | |
402 | @{$config{module_ldflags}}, | |
403 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
404 | DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
405 | BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (), | |
2fce15b5 | 406 | (map { '-D'.$_ } @{$config{bin_defines} || ()}), |
abe256e7 RL |
407 | @{$config{bin_cppflags}}, |
408 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} | |
409 | BIN_CFLAGS={- join(' ', $target{bin_cflags} || (), | |
410 | @{$config{bin_cflags}}, | |
411 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
412 | BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (), | |
413 | @{$config{bin_cxxflags}}, | |
414 | '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} | |
415 | BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (), | |
416 | @{$config{bin_lflags}}, | |
417 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
418 | BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
419 | ||
420 | # CPPFLAGS_Q is used for one thing only: to build up buildinf.h | |
421 | CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g; | |
422 | $cppflags2 =~ s|([\\"])|\\$1|g; | |
58d6be5b RL |
423 | $lib_cppflags =~ s|([\\"])|\\$1|g; |
424 | join(' ', $lib_cppflags || (), $cppflags2 || (), | |
425 | $cppflags1 || ()) -} | |
abe256e7 | 426 | |
567a9e6f RL |
427 | PERLASM_SCHEME= {- $target{perlasm_scheme} -} |
428 | ||
429 | # For x86 assembler: Set PROCESSOR to 386 if you want to support | |
430 | # the 80386. | |
431 | PROCESSOR= {- $config{processor} -} | |
432 | ||
9c7ce40b AP |
433 | # We want error [and other] messages in English. Trouble is that make(1) |
434 | # doesn't pass macros down as environment variables unless there already | |
435 | # was corresponding variable originally set. In other words we can only | |
436 | # reassign environment variables, but not set new ones, not in portable | |
437 | # manner that is. That's why we reassign several, just to be sure... | |
438 | LC_ALL=C | |
439 | LC_MESSAGES=C | |
440 | LANG=C | |
441 | ||
567a9e6f RL |
442 | # The main targets ################################################### |
443 | ||
b0940b33 | 444 | {- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils |
27c40a93 | 445 | {- dependmagic('build_libs'); -}: build_libs_nodep |
1842f369 | 446 | {- dependmagic('build_modules'); -}: build_modules_nodep |
1e3d16b0 | 447 | {- dependmagic('build_programs'); -}: build_programs_nodep |
567a9e6f | 448 | |
b0940b33 RL |
449 | build_docs: build_man_docs build_html_docs |
450 | build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7) | |
451 | build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7) | |
452 | ||
27c40a93 | 453 | build_generated: $(GENERATED_MANDATORY) |
c058fcd7 | 454 | build_libs_nodep: libcrypto.pc libssl.pc openssl.pc |
1842f369 | 455 | build_modules_nodep: $(MODULES) |
1e3d16b0 RL |
456 | build_programs_nodep: $(PROGRAMS) $(SCRIPTS) |
457 | ||
458 | # Kept around for backward compatibility | |
459 | build_apps build_tests: build_programs | |
68a5f1a2 | 460 | |
9b03b91b RL |
461 | # Convenience target to prebuild all generated files, not just the mandatory |
462 | # ones | |
b0940b33 | 463 | build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs |
18d15882 AP |
464 | @ : {- output_off() if $disabled{makedepend}; "" -} |
465 | @echo "Warning: consider configuring with no-makedepend, because if" | |
466 | @echo " target system doesn't have $(PERL)," | |
467 | @echo " then make will fail..." | |
468 | @ : {- output_on() if $disabled{makedepend}; "" -} | |
9b03b91b | 469 | |
b0940b33 RL |
470 | all: build_sw build_docs |
471 | ||
1b741653 | 472 | test: tests |
1842f369 | 473 | {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils |
d90a6beb | 474 | @ : {- output_off() if $disabled{tests}; "" -} |
f0790d4d RL |
475 | ( SRCTOP=$(SRCDIR) \ |
476 | BLDTOP=$(BLDDIR) \ | |
cbece220 | 477 | PERL="$(PERL)" \ |
9dd4ed28 | 478 | EXE_EXT={- platform->binext() -} \ |
f0790d4d | 479 | $(PERL) $(SRCDIR)/test/run_tests.pl $(TESTS) ) |
d90a6beb MC |
480 | @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} |
481 | @echo "Tests are not supported with your chosen Configure options" | |
482 | @ : {- output_on() if !$disabled{tests}; "" -} | |
567a9e6f RL |
483 | |
484 | list-tests: | |
4813ad2d RL |
485 | @ : {- output_off() if $disabled{tests}; "" -} |
486 | @SRCTOP="$(SRCDIR)" \ | |
487 | $(PERL) $(SRCDIR)/test/run_tests.pl list | |
488 | @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} | |
489 | @echo "Tests are not supported with your chosen Configure options" | |
490 | @ : {- output_on() if !$disabled{tests}; "" -} | |
491 | ||
492 | install: install_sw install_ssldirs install_docs | |
493 | ||
494 | uninstall: uninstall_docs uninstall_sw | |
567a9e6f RL |
495 | |
496 | libclean: | |
f99f91f1 | 497 | @set -e; for s in $(SHLIB_INFO); do \ |
49bb4dd0 | 498 | if [ "$$s" = ";" ]; then continue; fi; \ |
f99f91f1 RL |
499 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
500 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
49bb4dd0 BE |
501 | $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\ |
502 | $(RM) apps/$$s1; \ | |
503 | $(RM) test/$$s1; \ | |
504 | $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\ | |
f99f91f1 RL |
505 | $(RM) $$s1; \ |
506 | if [ "$$s1" != "$$s2" ]; then \ | |
5407338a | 507 | $(ECHO) $(RM) $$s2; \ |
f99f91f1 RL |
508 | $(RM) $$s2; \ |
509 | fi; \ | |
510 | done | |
511 | $(RM) $(LIBS) | |
9dd4ed28 | 512 | $(RM) *{- platform->defext() -} |
567a9e6f RL |
513 | |
514 | clean: libclean | |
b0940b33 RL |
515 | $(RM) $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7) |
516 | $(RM) $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7) | |
1842f369 | 517 | $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(SCRIPTS) |
b0a97931 | 518 | $(RM) $(GENERATED_MANDATORY) $(GENERATED) |
38b71bd4 TI |
519 | -$(RM) `find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -print` |
520 | -$(RM) `find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -print` | |
4813ad2d | 521 | $(RM) core |
65718c51 | 522 | $(RM) tags TAGS doc-nits cmd-nits |
d016d1ec | 523 | $(RM) -r test/test-runs |
4813ad2d | 524 | $(RM) openssl.pc libcrypto.pc libssl.pc |
853094db | 525 | -$(RM) `find . -type l \! -name '.*' -print` |
4813ad2d | 526 | $(RM) $(TARFILE) |
567a9e6f | 527 | |
7cae3864 | 528 | distclean: clean |
4813ad2d RL |
529 | $(RM) configdata.pm |
530 | $(RM) Makefile | |
7cae3864 | 531 | |
f8d9d6e4 | 532 | # We check if any depfile is newer than Makefile and decide to |
a6adf099 | 533 | # concatenate only if that is true. |
ea80a25e | 534 | depend: |
29eed3dd | 535 | @: {- output_off() if $disabled{makedepend}; "" -} |
c39785d4 RL |
536 | @$(PERL) $(SRCDIR)/util/add-depends.pl {- |
537 | defined $makedepprog && $makedepprog =~ /\/makedepend/ | |
538 | ? 'makedepend' : 'gcc' -} | |
29eed3dd | 539 | @: {- output_on() if $disabled{makedepend}; "" -} |
567a9e6f RL |
540 | |
541 | # Install helper targets ############################################# | |
542 | ||
41149648 | 543 | install_sw: install_dev install_engines install_modules install_runtime |
567a9e6f | 544 | |
41149648 | 545 | uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev |
567a9e6f RL |
546 | |
547 | install_docs: install_man_docs install_html_docs | |
548 | ||
549 | uninstall_docs: uninstall_man_docs uninstall_html_docs | |
3b8033f3 | 550 | $(RM) -r $(DESTDIR)$(DOCDIR) |
567a9e6f | 551 | |
dde10ab4 RL |
552 | install_ssldirs: |
553 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs | |
554 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private | |
66c2eb8b | 555 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc |
4813ad2d RL |
556 | @set -e; for x in dummy $(MISC_SCRIPTS); do \ |
557 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
d8356e1b RL |
558 | x1=`echo "$$x" | cut -f1 -d:`; \ |
559 | x2=`echo "$$x" | cut -f2 -d:`; \ | |
560 | fn=`basename $$x1`; \ | |
561 | $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ | |
562 | cp $$x1 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ | |
4813ad2d RL |
563 | chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ |
564 | mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \ | |
565 | $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \ | |
d8356e1b RL |
566 | if [ "$$x1" != "$$x2" ]; then \ |
567 | ln=`basename "$$x2"`; \ | |
568 | : {- output_off() unless windowsdll(); "" -}; \ | |
569 | $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ | |
570 | cp $(DESTDIR)$(OPENSSLDIR)/misc/$$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \ | |
571 | : {- output_on() unless windowsdll(); | |
572 | output_off() if windowsdll(); "" -}; \ | |
573 | $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ | |
574 | ln -sf $$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \ | |
575 | : {- output_on() if windowsdll(); "" -}; \ | |
576 | fi; \ | |
4813ad2d | 577 | done |
5407338a | 578 | @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" |
4813ad2d RL |
579 | @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new |
580 | @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new | |
cb926df2 | 581 | @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist |
c7af65c7 | 582 | @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \ |
5407338a | 583 | $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ |
cb926df2 RL |
584 | cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ |
585 | chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ | |
586 | fi | |
5407338a | 587 | @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" |
c7af65c7 RS |
588 | @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new |
589 | @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new | |
590 | @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist | |
591 | @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \ | |
5407338a | 592 | $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ |
c7af65c7 RS |
593 | cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \ |
594 | chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \ | |
595 | fi | |
dde10ab4 | 596 | |
c1123d9f | 597 | install_dev: install_runtime_libs |
567a9e6f | 598 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
5407338a | 599 | @$(ECHO) "*** Installing development files" |
3c65577f | 600 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl |
92ebf6c4 | 601 | @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} |
5407338a | 602 | @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" |
24c4f736 RL |
603 | @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c |
604 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c | |
92ebf6c4 | 605 | @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} |
567a9e6f RL |
606 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ |
607 | $(BLDDIR)/include/openssl/*.h; do \ | |
608 | fn=`basename $$i`; \ | |
5407338a | 609 | $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
3c65577f RL |
610 | cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ |
611 | chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ | |
567a9e6f | 612 | done |
e454f3ad | 613 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir) |
0f01b7bc | 614 | @set -e; for l in $(INSTALL_LIBS); do \ |
567a9e6f | 615 | fn=`basename $$l`; \ |
e454f3ad RL |
616 | $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \ |
617 | cp $$l $(DESTDIR)$(libdir)/$$fn.new; \ | |
618 | $(RANLIB) $(DESTDIR)$(libdir)/$$fn.new; \ | |
619 | chmod 644 $(DESTDIR)$(libdir)/$$fn.new; \ | |
620 | mv -f $(DESTDIR)$(libdir)/$$fn.new \ | |
621 | $(DESTDIR)$(libdir)/$$fn; \ | |
567a9e6f | 622 | done |
84af1bae | 623 | @ : {- output_off() if $disabled{shared}; "" -} |
0f01b7bc | 624 | @set -e; for s in $(INSTALL_SHLIB_INFO); do \ |
c8c2b779 RL |
625 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
626 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
627 | fn1=`basename $$s1`; \ | |
628 | fn2=`basename $$s2`; \ | |
cff89b17 | 629 | : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \ |
c8c2b779 | 630 | if [ "$$fn1" != "$$fn2" ]; then \ |
e454f3ad RL |
631 | $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \ |
632 | ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \ | |
567a9e6f | 633 | fi; \ |
cff89b17 | 634 | : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \ |
e454f3ad RL |
635 | $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \ |
636 | cp $$s2 $(DESTDIR)$(libdir)/$$fn2.new; \ | |
637 | chmod 755 $(DESTDIR)$(libdir)/$$fn2.new; \ | |
638 | mv -f $(DESTDIR)$(libdir)/$$fn2.new \ | |
639 | $(DESTDIR)$(libdir)/$$fn2; \ | |
cff89b17 AP |
640 | : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \ |
641 | a=$(DESTDIR)$(libdir)/$$fn2; \ | |
642 | $(ECHO) "install $$s1 -> $$a"; \ | |
643 | if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \ | |
644 | mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \ | |
645 | cp -f $$a $$a.new; \ | |
646 | for so in `$(AR) t $$a`; do \ | |
647 | $(AR) x $$a $$so; \ | |
648 | chmod u+w $$so; \ | |
649 | strip -X32_64 -e $$so; \ | |
650 | $(AR) r $$a.new $$so; \ | |
651 | done; \ | |
652 | )); fi; \ | |
653 | $(AR) r $$a.new $$s1; \ | |
654 | mv -f $$a.new $$a; \ | |
655 | : {- output_off() if sharedaix(); output_on(); "" -}; \ | |
567a9e6f | 656 | done |
84af1bae | 657 | @ : {- output_on() if $disabled{shared}; "" -} |
e454f3ad RL |
658 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig |
659 | @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc" | |
660 | @cp libcrypto.pc $(DESTDIR)$(libdir)/pkgconfig | |
661 | @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc | |
662 | @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc" | |
663 | @cp libssl.pc $(DESTDIR)$(libdir)/pkgconfig | |
664 | @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libssl.pc | |
665 | @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc" | |
666 | @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig | |
667 | @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc | |
567a9e6f | 668 | |
c1123d9f | 669 | uninstall_dev: uninstall_runtime_libs |
5407338a | 670 | @$(ECHO) "*** Uninstalling development files" |
92ebf6c4 | 671 | @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} |
5407338a | 672 | @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" |
24c4f736 | 673 | @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c |
92ebf6c4 | 674 | @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} |
567a9e6f RL |
675 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ |
676 | $(BLDDIR)/include/openssl/*.h; do \ | |
677 | fn=`basename $$i`; \ | |
5407338a | 678 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
3c65577f | 679 | $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ |
567a9e6f | 680 | done |
98e5534e RL |
681 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl |
682 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include | |
0f01b7bc | 683 | @set -e; for l in $(INSTALL_LIBS); do \ |
567a9e6f | 684 | fn=`basename $$l`; \ |
e454f3ad RL |
685 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \ |
686 | $(RM) $(DESTDIR)$(libdir)/$$fn; \ | |
567a9e6f | 687 | done |
84af1bae | 688 | @ : {- output_off() if $disabled{shared}; "" -} |
0f01b7bc | 689 | @set -e; for s in $(INSTALL_SHLIB_INFO); do \ |
c8c2b779 RL |
690 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
691 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
692 | fn1=`basename $$s1`; \ | |
693 | fn2=`basename $$s2`; \ | |
694 | : {- output_off() if windowsdll(); "" -}; \ | |
cff89b17 AP |
695 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ |
696 | $(RM) $(DESTDIR)$(libdir)/$$fn2; \ | |
697 | if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \ | |
698 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \ | |
699 | $(RM) $(DESTDIR)$(libdir)/$$fn1; \ | |
567a9e6f | 700 | fi; \ |
c8c2b779 | 701 | : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ |
e454f3ad RL |
702 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ |
703 | $(RM) $(DESTDIR)$(libdir)/$$fn2; \ | |
ce5ed82f | 704 | : {- output_on() unless windowsdll(); "" -}; \ |
567a9e6f | 705 | done |
c8cca980 | 706 | @ : {- output_on() if $disabled{shared}; "" -} |
e454f3ad RL |
707 | $(RM) $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc |
708 | $(RM) $(DESTDIR)$(libdir)/pkgconfig/libssl.pc | |
709 | $(RM) $(DESTDIR)$(libdir)/pkgconfig/openssl.pc | |
710 | -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig | |
711 | -$(RMDIR) $(DESTDIR)$(libdir) | |
567a9e6f | 712 | |
41149648 RL |
713 | _install_modules_deps: install_runtime_libs build_modules |
714 | ||
715 | install_engines: _install_modules_deps | |
567a9e6f | 716 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
b2de11c5 | 717 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/ |
41149648 | 718 | @$(ECHO) "*** Installing engines" |
0f01b7bc | 719 | @set -e; for e in dummy $(INSTALL_ENGINES); do \ |
2b364f61 | 720 | if [ "$$e" = "dummy" ]; then continue; fi; \ |
567a9e6f | 721 | fn=`basename $$e`; \ |
5407338a | 722 | $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \ |
b2de11c5 RL |
723 | cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \ |
724 | chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \ | |
725 | mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \ | |
726 | $(DESTDIR)$(ENGINESDIR)/$$fn; \ | |
567a9e6f RL |
727 | done |
728 | ||
729 | uninstall_engines: | |
41149648 | 730 | @$(ECHO) "*** Uninstalling engines" |
0f01b7bc | 731 | @set -e; for e in dummy $(INSTALL_ENGINES); do \ |
2b364f61 | 732 | if [ "$$e" = "dummy" ]; then continue; fi; \ |
567a9e6f | 733 | fn=`basename $$e`; \ |
9dd4ed28 | 734 | if [ "$$fn" = '{- platform->dso("ossltest") -}' ]; then \ |
f0c93a85 RL |
735 | continue; \ |
736 | fi; \ | |
5407338a | 737 | $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \ |
b2de11c5 | 738 | $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \ |
567a9e6f | 739 | done |
b2de11c5 | 740 | -$(RMDIR) $(DESTDIR)$(ENGINESDIR) |
567a9e6f | 741 | |
41149648 RL |
742 | install_modules: _install_modules_deps |
743 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
744 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MODULESDIR)/ | |
745 | @$(ECHO) "*** Installing modules" | |
746 | @set -e; for e in dummy $(INSTALL_MODULES); do \ | |
747 | if [ "$$e" = "dummy" ]; then continue; fi; \ | |
748 | fn=`basename $$e`; \ | |
749 | $(ECHO) "install $$e -> $(DESTDIR)$(MODULESDIR)/$$fn"; \ | |
750 | cp $$e $(DESTDIR)$(MODULESDIR)/$$fn.new; \ | |
751 | chmod 755 $(DESTDIR)$(MODULESDIR)/$$fn.new; \ | |
752 | mv -f $(DESTDIR)$(MODULESDIR)/$$fn.new \ | |
753 | $(DESTDIR)$(MODULESDIR)/$$fn; \ | |
754 | done | |
755 | ||
756 | uninstall_modules: | |
757 | @$(ECHO) "*** Uninstalling modules" | |
758 | @set -e; for e in dummy $(INSTALL_MODULES); do \ | |
759 | if [ "$$e" = "dummy" ]; then continue; fi; \ | |
760 | fn=`basename $$e`; \ | |
761 | if [ "$$fn" = '{- platform->dso("ossltest") -}' ]; then \ | |
762 | continue; \ | |
763 | fi; \ | |
764 | $(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$$fn"; \ | |
765 | $(RM) $(DESTDIR)$(MODULESDIR)/$$fn; \ | |
766 | done | |
767 | -$(RMDIR) $(DESTDIR)$(MODULESDIR) | |
768 | ||
c1123d9f RL |
769 | install_runtime: install_programs |
770 | ||
e8d01a60 | 771 | install_runtime_libs: build_libs |
567a9e6f | 772 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
36b53720 | 773 | @ : {- output_off() if windowsdll(); "" -} |
e454f3ad | 774 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir) |
9694ebf7 RL |
775 | @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -} |
776 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin | |
777 | @ : {- output_on() unless windowsdll(); "" -} | |
c1123d9f | 778 | @$(ECHO) "*** Installing runtime libraries" |
0f01b7bc | 779 | @set -e; for s in dummy $(INSTALL_SHLIBS); do \ |
2b364f61 | 780 | if [ "$$s" = "dummy" ]; then continue; fi; \ |
f99f91f1 | 781 | fn=`basename $$s`; \ |
36b53720 | 782 | : {- output_off() unless windowsdll(); "" -}; \ |
5407338a | 783 | $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 784 | cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
fa63e452 | 785 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
3c65577f RL |
786 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ |
787 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
36b53720 | 788 | : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \ |
e454f3ad RL |
789 | $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \ |
790 | cp $$s $(DESTDIR)$(libdir)/$$fn.new; \ | |
791 | chmod 755 $(DESTDIR)$(libdir)/$$fn.new; \ | |
792 | mv -f $(DESTDIR)$(libdir)/$$fn.new \ | |
793 | $(DESTDIR)$(libdir)/$$fn; \ | |
36b53720 | 794 | : {- output_on() if windowsdll(); "" -}; \ |
fcf80c46 | 795 | done |
c1123d9f | 796 | |
e8d01a60 | 797 | install_programs: install_runtime_libs build_programs |
c1123d9f RL |
798 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
799 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin | |
800 | @$(ECHO) "*** Installing runtime programs" | |
0f01b7bc | 801 | @set -e; for x in dummy $(INSTALL_PROGRAMS); do \ |
2b364f61 | 802 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 803 | fn=`basename $$x`; \ |
5407338a | 804 | $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f RL |
805 | cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
806 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
807 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
808 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 809 | done |
2b364f61 RL |
810 | @set -e; for x in dummy $(BIN_SCRIPTS); do \ |
811 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
567a9e6f | 812 | fn=`basename $$x`; \ |
5407338a | 813 | $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f RL |
814 | cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
815 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
816 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
817 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 818 | done |
567a9e6f | 819 | |
c1123d9f RL |
820 | uninstall_runtime: uninstall_programs uninstall_runtime_libs |
821 | ||
822 | uninstall_programs: | |
823 | @$(ECHO) "*** Uninstalling runtime programs" | |
0f01b7bc | 824 | @set -e; for x in dummy $(INSTALL_PROGRAMS); \ |
567a9e6f | 825 | do \ |
2b364f61 | 826 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 827 | fn=`basename $$x`; \ |
5407338a | 828 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 829 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ |
567a9e6f | 830 | done; |
2b364f61 | 831 | @set -e; for x in dummy $(BIN_SCRIPTS); \ |
567a9e6f | 832 | do \ |
2b364f61 | 833 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 834 | fn=`basename $$x`; \ |
5407338a | 835 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 836 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ |
567a9e6f | 837 | done |
c1123d9f RL |
838 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin |
839 | ||
840 | uninstall_runtime_libs: | |
841 | @$(ECHO) "*** Uninstalling runtime libraries" | |
b1837abd | 842 | @ : {- output_off() unless windowsdll(); "" -} |
0f01b7bc | 843 | @set -e; for s in dummy $(INSTALL_SHLIBS); do \ |
2b364f61 | 844 | if [ "$$s" = "dummy" ]; then continue; fi; \ |
f99f91f1 | 845 | fn=`basename $$s`; \ |
5407338a | 846 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 847 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ |
fcf80c46 | 848 | done |
b1837abd | 849 | @ : {- output_on() unless windowsdll(); "" -} |
567a9e6f | 850 | |
567a9e6f | 851 | |
b0940b33 | 852 | install_man_docs: build_man_docs |
567a9e6f | 853 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
b0940b33 RL |
854 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man1 |
855 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man3 | |
856 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man5 | |
857 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man7 | |
5407338a | 858 | @$(ECHO) "*** Installing manpages" |
b0940b33 RL |
859 | @set -e; for x in dummy $(MANDOCS1); do \ |
860 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
861 | fn=`basename $$x`; \ | |
cf86057a SAS |
862 | $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ |
863 | cp $$x $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \ | |
864 | chmod 755 $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \ | |
b0940b33 RL |
865 | done |
866 | @set -e; for x in dummy $(MANDOCS3); do \ | |
867 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
868 | fn=`basename $$x`; \ | |
cf86057a SAS |
869 | $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ |
870 | cp $$x $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \ | |
871 | chmod 755 $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \ | |
b0940b33 RL |
872 | done |
873 | @set -e; for x in dummy $(MANDOCS5); do \ | |
874 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
875 | fn=`basename $$x`; \ | |
cf86057a SAS |
876 | $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ |
877 | cp $$x $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \ | |
878 | chmod 755 $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \ | |
b0940b33 RL |
879 | done |
880 | @set -e; for x in dummy $(MANDOCS7); do \ | |
881 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
882 | fn=`basename $$x`; \ | |
cf86057a SAS |
883 | $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ |
884 | cp $$x $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \ | |
885 | chmod 755 $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \ | |
b0940b33 | 886 | done |
567a9e6f RL |
887 | |
888 | uninstall_man_docs: | |
5407338a | 889 | @$(ECHO) "*** Uninstalling manpages" |
b0940b33 RL |
890 | @set -e; for x in dummy $(MANDOCS1); do \ |
891 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
892 | fn=`basename $$x`; \ | |
cf86057a SAS |
893 | $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ |
894 | $(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \ | |
b0940b33 RL |
895 | done |
896 | @set -e; for x in dummy $(MANDOCS3); do \ | |
897 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
898 | fn=`basename $$x`; \ | |
cf86057a SAS |
899 | $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ |
900 | $(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \ | |
b0940b33 RL |
901 | done |
902 | @set -e; for x in dummy $(MANDOCS5); do \ | |
903 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
904 | fn=`basename $$x`; \ | |
cf86057a SAS |
905 | $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ |
906 | $(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \ | |
b0940b33 RL |
907 | done |
908 | @set -e; for x in dummy $(MANDOCS7); do \ | |
909 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
910 | fn=`basename $$x`; \ | |
cf86057a SAS |
911 | $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ |
912 | $(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \ | |
b0940b33 | 913 | done |
567a9e6f | 914 | |
b0940b33 | 915 | install_html_docs: build_html_docs |
567a9e6f | 916 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
b0940b33 RL |
917 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man1 |
918 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man3 | |
919 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man5 | |
920 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man7 | |
5407338a | 921 | @$(ECHO) "*** Installing HTML manpages" |
b0940b33 RL |
922 | @set -e; for x in dummy $(HTMLDOCS1); do \ |
923 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
924 | fn=`basename $$x`; \ | |
925 | $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \ | |
926 | cp $$x $(DESTDIR)$(HTMLDIR)/man1/$$fn; \ | |
927 | chmod 755 $(DESTDIR)$(HTMLDIR)/man1/$$fn; \ | |
928 | done | |
929 | @set -e; for x in dummy $(HTMLDOCS3); do \ | |
930 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
931 | fn=`basename $$x`; \ | |
932 | $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \ | |
933 | cp $$x $(DESTDIR)$(HTMLDIR)/man3/$$fn; \ | |
934 | chmod 755 $(DESTDIR)$(HTMLDIR)/man3/$$fn; \ | |
935 | done | |
936 | @set -e; for x in dummy $(HTMLDOCS5); do \ | |
937 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
938 | fn=`basename $$x`; \ | |
939 | $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \ | |
940 | cp $$x $(DESTDIR)$(HTMLDIR)/man5/$$fn; \ | |
941 | chmod 755 $(DESTDIR)$(HTMLDIR)/man5/$$fn; \ | |
942 | done | |
943 | @set -e; for x in dummy $(HTMLDOCS7); do \ | |
944 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
945 | fn=`basename $$x`; \ | |
946 | $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \ | |
947 | cp $$x $(DESTDIR)$(HTMLDIR)/man7/$$fn; \ | |
948 | chmod 755 $(DESTDIR)$(HTMLDIR)/man7/$$fn; \ | |
949 | done | |
567a9e6f RL |
950 | |
951 | uninstall_html_docs: | |
b0940b33 RL |
952 | @$(ECHO) "*** Uninstalling HTML manpages" |
953 | @set -e; for x in dummy $(HTMLDOCS1); do \ | |
954 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
955 | fn=`basename $$x`; \ | |
956 | $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \ | |
957 | $(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn; \ | |
958 | done | |
959 | @set -e; for x in dummy $(HTMLDOCS3); do \ | |
960 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
961 | fn=`basename $$x`; \ | |
962 | $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \ | |
963 | $(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn; \ | |
964 | done | |
965 | @set -e; for x in dummy $(HTMLDOCS5); do \ | |
966 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
967 | fn=`basename $$x`; \ | |
968 | $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \ | |
969 | $(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn; \ | |
970 | done | |
971 | @set -e; for x in dummy $(HTMLDOCS7); do \ | |
972 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
973 | fn=`basename $$x`; \ | |
974 | $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \ | |
975 | $(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn; \ | |
976 | done | |
567a9e6f RL |
977 | |
978 | # Developer targets (note: these are only available on Unix) ######### | |
979 | ||
6bb2106e RL |
980 | update: generate errors ordinals |
981 | ||
b7650c67 | 982 | generate: generate_apps generate_crypto_bn generate_crypto_objects \ |
8e32e1ab | 983 | generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids |
567a9e6f | 984 | |
65718c51 | 985 | .PHONY: doc-nits cmd-nits |
32d40d0d | 986 | doc-nits: build_generated |
1624ebdb | 987 | $(PERL) $(SRCDIR)/util/find-doc-nits -n -l -e |
65c1f979 | 988 | |
65718c51 | 989 | cmd-nits: build_generated apps/openssl |
1624ebdb | 990 | $(PERL) $(SRCDIR)/util/find-doc-nits -c |
65718c51 | 991 | |
567a9e6f RL |
992 | # Test coverage is a good idea for the future |
993 | #coverage: $(PROGRAMS) $(TESTPROGRAMS) | |
994 | # ... | |
995 | ||
567a9e6f RL |
996 | lint: |
997 | lint -DLINT $(INCLUDES) $(SRCS) | |
998 | ||
9a9f8ee7 RL |
999 | generate_apps: |
1000 | ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \ | |
1001 | < apps/openssl.cnf > apps/openssl-vms.cnf ) | |
9a9f8ee7 RL |
1002 | |
1003 | generate_crypto_bn: | |
1004 | ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h ) | |
1005 | ||
1006 | generate_crypto_objects: | |
22defb43 RS |
1007 | ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \ |
1008 | crypto/objects/objects.txt \ | |
1009 | crypto/objects/obj_mac.num \ | |
1010 | > crypto/objects/obj_mac.new && \ | |
1011 | mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num ) | |
9a9f8ee7 RL |
1012 | ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \ |
1013 | crypto/objects/objects.txt \ | |
1014 | crypto/objects/obj_mac.num \ | |
22defb43 | 1015 | > include/openssl/obj_mac.h ) |
e6f2bb66 KM |
1016 | ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \ |
1017 | include/openssl/obj_mac.h \ | |
22defb43 | 1018 | > crypto/objects/obj_dat.h ) |
9a9f8ee7 RL |
1019 | ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \ |
1020 | crypto/objects/obj_mac.num \ | |
1021 | crypto/objects/obj_xref.txt \ | |
1022 | > crypto/objects/obj_xref.h ) | |
ad16671d | 1023 | ( cd $(SRCDIR); cat crypto/objects/obj_compat.h >> include/openssl/obj_mac.h ) |
6bb2106e | 1024 | |
b7650c67 RL |
1025 | generate_crypto_conf: |
1026 | ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \ | |
1027 | > crypto/conf/conf_def.h ) | |
1028 | ||
1029 | generate_crypto_asn1: | |
1030 | ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \ | |
1031 | > crypto/asn1/charmap.h ) | |
1032 | ||
8e32e1ab RL |
1033 | generate_fuzz_oids: |
1034 | ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \ | |
1035 | crypto/objects/obj_dat.h \ | |
1036 | > fuzz/oids.txt ) | |
1037 | ||
52df25cf RS |
1038 | # Set to -force to force a rebuild |
1039 | ERROR_REBUILD= | |
567a9e6f | 1040 | errors: |
aa6cc8d3 RL |
1041 | ( b=`pwd`; set -e; cd $(SRCDIR); \ |
1042 | $(PERL) util/ck_errf.pl -strict -internal; \ | |
cb7b7275 | 1043 | $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal ) |
aa6cc8d3 | 1044 | ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \ |
52df25cf | 1045 | for E in *.ec ; do \ |
aa6cc8d3 RL |
1046 | $(PERL) ../util/ck_errf.pl -strict \ |
1047 | -conf $$E `basename $$E .ec`.c; \ | |
cb7b7275 | 1048 | $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \ |
52df25cf RS |
1049 | -conf $$E `basename $$E .ec`.c ; \ |
1050 | done ) | |
567a9e6f | 1051 | |
30699aa1 RL |
1052 | {- use File::Basename; |
1053 | ||
1054 | our @sslheaders = | |
1055 | qw( include/openssl/ssl.h | |
1056 | include/openssl/ssl2.h | |
1057 | include/openssl/ssl3.h | |
1058 | include/openssl/sslerr.h | |
1059 | include/openssl/tls1.h | |
1060 | include/openssl/dtls1.h | |
1061 | include/openssl/srtp.h ); | |
1062 | our @cryptoheaders = | |
1063 | qw( include/internal/dso.h | |
1064 | include/internal/o_dir.h | |
30699aa1 | 1065 | include/internal/err.h |
c2041da8 | 1066 | include/internal/evp.h |
30699aa1 | 1067 | include/internal/sslconf.h ); |
df443918 | 1068 | our @cryptoskipheaders = ( @sslheaders, |
30699aa1 RL |
1069 | qw( include/openssl/conf_api.h |
1070 | include/openssl/ebcdic.h | |
1071 | include/openssl/opensslconf.h | |
1072 | include/openssl/symhacks.h ) ); | |
1073 | foreach my $f ( glob(catfile($config{sourcedir}, | |
1074 | 'include','openssl','*.h')) ) { | |
1075 | my $fn = "include/openssl/" . basename($f); | |
1076 | push @cryptoheaders, $fn unless grep { $_ eq $fn } @cryptoskipheaders; | |
1077 | } | |
1078 | ""; | |
1079 | -} | |
c00d9311 RL |
1080 | CRYPTOHEADERS={- join(" \\\n" . ' ' x 14, |
1081 | fill_lines(" ", $COLUMNS - 14, sort @cryptoheaders)) -} | |
1082 | SSLHEADERS={- join(" \\\n" . ' ' x 11, | |
1083 | fill_lines(" ", $COLUMNS - 11, sort @sslheaders)) -} | |
567a9e6f | 1084 | ordinals: |
30699aa1 RL |
1085 | ( cd $(SRCDIR); \ |
1086 | $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \ | |
1087 | --ordinals util/libcrypto.num \ | |
1088 | --symhacks include/openssl/symhacks.h \ | |
1089 | $(CRYPTOHEADERS) ) | |
1090 | ( cd $(SRCDIR); \ | |
1091 | $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \ | |
1092 | --ordinals util/libssl.num \ | |
1093 | --symhacks include/openssl/symhacks.h \ | |
1094 | $(SSLHEADERS)) | |
567a9e6f RL |
1095 | |
1096 | test_ordinals: | |
1097 | ( cd test; \ | |
1098 | SRCTOP=../$(SRCDIR) \ | |
1099 | BLDTOP=../$(BLDDIR) \ | |
1100 | $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals ) | |
1101 | ||
1102 | tags TAGS: FORCE | |
1103 | rm -f TAGS tags | |
1104 | -ctags -R . | |
1105 | -etags `find . -name '*.[ch]' -o -name '*.pm'` | |
1106 | ||
1107 | # Release targets (note: only available on Unix) ##################### | |
1108 | ||
1109 | tar: | |
b741f153 | 1110 | (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)') |
567a9e6f RL |
1111 | |
1112 | # Helper targets ##################################################### | |
1113 | ||
c3845ceb | 1114 | link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl |
567a9e6f | 1115 | |
c3845ceb | 1116 | $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl: configdata.pm |
567a9e6f RL |
1117 | @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ |
1118 | mkdir -p "$(BLDDIR)/util"; \ | |
c3845ceb | 1119 | ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \ |
567a9e6f | 1120 | fi |
342a1a23 | 1121 | |
c058fcd7 | 1122 | FORCE: |
567a9e6f RL |
1123 | |
1124 | # Building targets ################################################### | |
1125 | ||
9dd4ed28 | 1126 | libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // () } @{$unified_info{libraries}}) -} |
567a9e6f RL |
1127 | libcrypto.pc: |
1128 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
1129 | echo 'exec_prefix=$${prefix}'; \ | |
e454f3ad RL |
1130 | if [ -n "$(LIBDIR)" ]; then \ |
1131 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
1132 | else \ | |
1133 | echo 'libdir=$(libdir)'; \ | |
1134 | fi; \ | |
567a9e6f | 1135 | echo 'includedir=$${prefix}/include'; \ |
d4453024 | 1136 | echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \ |
567a9e6f RL |
1137 | echo ''; \ |
1138 | echo 'Name: OpenSSL-libcrypto'; \ | |
1139 | echo 'Description: OpenSSL cryptography library'; \ | |
1140 | echo 'Version: '$(VERSION); \ | |
1141 | echo 'Libs: -L$${libdir} -lcrypto'; \ | |
abe256e7 | 1142 | echo 'Libs.private: $(LIB_EX_LIBS)'; \ |
567a9e6f RL |
1143 | echo 'Cflags: -I$${includedir}' ) > libcrypto.pc |
1144 | ||
1145 | libssl.pc: | |
1146 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
1147 | echo 'exec_prefix=$${prefix}'; \ | |
e454f3ad RL |
1148 | if [ -n "$(LIBDIR)" ]; then \ |
1149 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
1150 | else \ | |
1151 | echo 'libdir=$(libdir)'; \ | |
1152 | fi; \ | |
567a9e6f RL |
1153 | echo 'includedir=$${prefix}/include'; \ |
1154 | echo ''; \ | |
1155 | echo 'Name: OpenSSL-libssl'; \ | |
1156 | echo 'Description: Secure Sockets Layer and cryptography libraries'; \ | |
1157 | echo 'Version: '$(VERSION); \ | |
1158 | echo 'Requires.private: libcrypto'; \ | |
1159 | echo 'Libs: -L$${libdir} -lssl'; \ | |
567a9e6f RL |
1160 | echo 'Cflags: -I$${includedir}' ) > libssl.pc |
1161 | ||
1162 | openssl.pc: | |
1163 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
1164 | echo 'exec_prefix=$${prefix}'; \ | |
e454f3ad RL |
1165 | if [ -n "$(LIBDIR)" ]; then \ |
1166 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
1167 | else \ | |
1168 | echo 'libdir=$(libdir)'; \ | |
1169 | fi; \ | |
567a9e6f RL |
1170 | echo 'includedir=$${prefix}/include'; \ |
1171 | echo ''; \ | |
1172 | echo 'Name: OpenSSL'; \ | |
1173 | echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \ | |
1174 | echo 'Version: '$(VERSION); \ | |
1175 | echo 'Requires: libssl libcrypto' ) > openssl.pc | |
1176 | ||
c00d9311 RL |
1177 | configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \ |
1178 | {- join(" \\\n" . ' ' x 15, | |
1179 | fill_lines(" ", $COLUMNS - 15, | |
1180 | @{$config{build_file_templates}}, | |
1181 | @{$config{build_infos}}, | |
1182 | @{$config{conf_files}})) -} | |
27f42b46 | 1183 | @echo "Detected changed: $?" |
a1b6933e | 1184 | $(PERL) configdata.pm -r |
567a9e6f RL |
1185 | @echo "**************************************************" |
1186 | @echo "*** ***" | |
1187 | @echo "*** Please run the same make command again ***" | |
1188 | @echo "*** ***" | |
1189 | @echo "**************************************************" | |
1190 | @false | |
1191 | ||
bf01fbbf | 1192 | reconfigure reconf: |
a1b6933e | 1193 | $(PERL) configdata.pm -r |
bf01fbbf | 1194 | |
567a9e6f RL |
1195 | {- |
1196 | use File::Basename; | |
1197 | use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; | |
cedbb146 RL |
1198 | |
1199 | # Helper function to figure out dependencies on libraries | |
1200 | # It takes a list of library names and outputs a list of dependencies | |
1201 | sub compute_lib_depends { | |
cedbb146 RL |
1202 | # Depending on shared libraries: |
1203 | # On Windows POSIX layers, we depend on {libname}.dll.a | |
1204 | # On Unix platforms, we depend on {shlibname}.so | |
9dd4ed28 | 1205 | return map { platform->sharedlib_simple($_) // platform->staticlib($_) } @_; |
cedbb146 RL |
1206 | } |
1207 | ||
66ddf178 RL |
1208 | sub generatesrc { |
1209 | my %args = @_; | |
1210 | my $generator = join(" ", @{$args{generator}}); | |
8d34daf0 | 1211 | my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}}); |
d4605727 | 1212 | my $incs = join("", map { " -I".$_ } @{$args{incs}}); |
25628ab2 | 1213 | my $defs = join("", map { " -D".$_ } @{$args{defs}}); |
8d34daf0 | 1214 | my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}}); |
66ddf178 | 1215 | |
b0940b33 RL |
1216 | if ($args{src} =~ /\.html$/) { |
1217 | my $title = basename($args{src}, ".html"); | |
98706c5a | 1218 | my $pod = $args{generator}->[0]; |
b0940b33 | 1219 | return <<"EOF"; |
98706c5a | 1220 | $args{src}: $pod |
1ec45fab | 1221 | \$(PERL) \$(SRCDIR)/util/mkpod2html.pl -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc" |
b0940b33 RL |
1222 | EOF |
1223 | } elsif ($args{src} =~ /\.(\d)$/) { | |
1224 | my $section = $1; | |
1225 | my $name = uc basename($args{src}, ".$section"); | |
98706c5a | 1226 | my $pod = $args{generator}->[0]; |
b0940b33 | 1227 | return <<"EOF"; |
98706c5a | 1228 | $args{src}: $pod |
b0940b33 | 1229 | pod2man --name=$name --section=$section --center=OpenSSL \\ |
1ec45fab | 1230 | --release=\$(VERSION) $pod >\$\@ |
b0940b33 RL |
1231 | EOF |
1232 | } elsif (platform->isdef($args{src})) { | |
9dd4ed28 | 1233 | my $target = platform->def($args{src}); |
ef2dfc99 | 1234 | (my $mkdef_os = $target{shared_target}) =~ s|-shared$||; |
66a24ab8 | 1235 | my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : ''; |
9dd4ed28 | 1236 | my $ord_name = $args{generator}->[1] || $args{product}; |
ef2dfc99 | 1237 | return <<"EOF"; |
66a24ab8 RL |
1238 | $target: $args{generator}->[0] $deps \$(SRCDIR)/util/mkdef.pl |
1239 | \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $args{generator}->[0] --name $ord_name --OS $mkdef_os > $target | |
ef2dfc99 | 1240 | EOF |
9dd4ed28 | 1241 | } elsif (!platform->isasm($args{src})) { |
7cae3864 RL |
1242 | if ($args{generator}->[0] =~ m|^.*\.in$|) { |
1243 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
1244 | "util", "dofile.pl")), | |
1245 | rel2abs($config{builddir})); | |
70d96753 RL |
1246 | my @modules = ( 'configdata.pm', |
1247 | grep { $_ =~ m|\.pm$| } @{$args{deps}} ); | |
1248 | my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules; | |
1249 | @modules = map { "-M".basename($_, '.pm') } @modules; | |
1250 | my $modules = join(' ', '', sort keys %moduleincs, @modules); | |
7cae3864 | 1251 | return <<"EOF"; |
70d96753 RL |
1252 | $args{src}: $args{generator}->[0] $deps \$(BLDDIR)/configdata.pm |
1253 | \$(PERL)$modules "$dofile" "-o$target{build_file}" $generator > \$@ | |
7cae3864 RL |
1254 | EOF |
1255 | } else { | |
1256 | return <<"EOF"; | |
769777b0 | 1257 | $args{src}: $args{generator}->[0] $deps |
8d34daf0 | 1258 | \$(PERL)$generator_incs $generator > \$@ |
66ddf178 | 1259 | EOF |
7cae3864 | 1260 | } |
66ddf178 | 1261 | } else { |
593d5c2f RL |
1262 | my $cppflags = { |
1263 | shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', | |
1264 | lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', | |
1265 | dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', | |
1266 | bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' | |
1267 | } -> {$args{intent}}; | |
1268 | ||
8458f1bf | 1269 | if ($args{generator}->[0] =~ /\.pl$/) { |
593d5c2f | 1270 | $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator |
cf076a3f | 1271 | .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)'; |
8458f1bf | 1272 | } elsif ($args{generator}->[0] =~ /\.m4$/) { |
8d34daf0 | 1273 | $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >' |
8458f1bf RL |
1274 | } elsif ($args{generator}->[0] =~ /\.S$/) { |
1275 | $generator = undef; | |
1276 | } else { | |
1277 | die "Generator type for $args{src} unknown: $generator\n"; | |
1278 | } | |
1279 | ||
1280 | if (defined($generator)) { | |
66ddf178 | 1281 | return <<"EOF"; |
769777b0 | 1282 | $args{src}: $args{generator}->[0] $deps |
8458f1bf | 1283 | $generator \$@ |
66ddf178 | 1284 | EOF |
66ddf178 | 1285 | } |
8458f1bf | 1286 | return <<"EOF"; |
769777b0 | 1287 | $args{src}: $args{generator}->[0] $deps |
25628ab2 | 1288 | \$(CC) $incs $cppflags $defs -E $args{generator}->[0] | \\ |
39199fb3 | 1289 | \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@ |
8458f1bf | 1290 | EOF |
66ddf178 RL |
1291 | } |
1292 | } | |
1293 | ||
bb26842d RL |
1294 | # Should one wonder about the end of the Perl snippet, it's because this |
1295 | # second regexp eats up line endings as well, if the removed path is the | |
1296 | # last in the line. We may therefore need to put back a line ending. | |
88297284 | 1297 | sub src2obj { |
567a9e6f | 1298 | my %args = @_; |
e805c2d6 | 1299 | my $obj = platform->convertext($args{obj}); |
9dd4ed28 | 1300 | my $dep = platform->dep($args{obj}); |
a23f0316 | 1301 | my @srcs = @{$args{srcs}}; |
8458f1bf RL |
1302 | my $srcs = join(" ", @srcs); |
1303 | my $deps = join(" ", @srcs, @{$args{deps}}); | |
45502bfe | 1304 | my $incs = join("", map { " -I".$_ } @{$args{incs}}); |
25628ab2 | 1305 | my $defs = join("", map { " -D".$_ } @{$args{defs}}); |
722c9762 RL |
1306 | my $cmd; |
1307 | my $cmdflags; | |
1308 | my $cmdcompile; | |
81183680 RL |
1309 | if (grep /\.rc$/, @srcs) { |
1310 | $cmd = '$(RC)'; | |
1311 | $cmdflags = '$(RCFLAGS)'; | |
8c3bc594 | 1312 | $cmdcompile = ''; |
81183680 RL |
1313 | } elsif (grep /\.(cc|cpp)$/, @srcs) { |
1314 | $cmd = '$(CXX)'; | |
722c9762 RL |
1315 | $cmdcompile = ' -c'; |
1316 | $cmdflags = { | |
9dfc8680 | 1317 | shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)', |
722c9762 RL |
1318 | lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)', |
1319 | dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)', | |
1320 | bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)' | |
1321 | } -> {$args{intent}}; | |
7763472f | 1322 | } else { |
722c9762 RL |
1323 | $cmd = '$(CC)'; |
1324 | $cmdcompile = ' -c'; | |
1325 | $cmdflags = { | |
9dfc8680 | 1326 | shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', |
722c9762 RL |
1327 | lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', |
1328 | dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', | |
1329 | bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' | |
1330 | } -> {$args{intent}}; | |
7763472f | 1331 | } |
a23f0316 AP |
1332 | my $recipe; |
1333 | # extension-specific rules | |
1334 | if (grep /\.s$/, @srcs) { | |
1335 | $recipe .= <<"EOF"; | |
9dd4ed28 | 1336 | $obj: $deps |
a23f0316 | 1337 | $cmd $cmdflags -c -o \$\@ $srcs |
7e5b8b93 | 1338 | EOF |
a23f0316 | 1339 | } elsif (grep /\.S$/, @srcs) { |
18d15882 AP |
1340 | # Originally there was mutli-step rule with $(CC) -E file.S |
1341 | # followed by $(CC) -c file.s. It compensated for one of | |
1342 | # legacy platform compiler's inability to handle .S files. | |
1343 | # The platform is long discontinued by vendor so there is | |
1344 | # hardly a point to drag it along... | |
29eed3dd | 1345 | $recipe .= <<"EOF"; |
9dd4ed28 | 1346 | $obj: $deps |
25628ab2 | 1347 | $cmd $incs $defs $cmdflags -c -o \$\@ $srcs |
a23f0316 | 1348 | EOF |
49bb4dd0 BE |
1349 | } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/ |
1350 | && !grep /\.rc$/, @srcs) { | |
a23f0316 | 1351 | $recipe .= <<"EOF"; |
9dd4ed28 RL |
1352 | $obj: $deps |
1353 | $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs | |
1354 | \@touch $dep.tmp | |
1355 | \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\ | |
1356 | rm -f $dep.tmp; \\ | |
29b28eee | 1357 | else \\ |
9dd4ed28 | 1358 | mv $dep.tmp $dep; \\ |
987dbc7f | 1359 | fi |
29eed3dd | 1360 | EOF |
7e5b8b93 | 1361 | } else { |
29eed3dd | 1362 | $recipe .= <<"EOF"; |
9dd4ed28 | 1363 | $obj: $deps |
25628ab2 | 1364 | $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs |
567a9e6f | 1365 | EOF |
81183680 | 1366 | if (defined $makedepprog && $makedepprog =~ /\/makedepend/) { |
7e5b8b93 | 1367 | $recipe .= <<"EOF"; |
c39785d4 | 1368 | \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\ |
9dd4ed28 | 1369 | > $dep |
567a9e6f | 1370 | EOF |
7e5b8b93 | 1371 | } |
29eed3dd RL |
1372 | } |
1373 | return $recipe; | |
567a9e6f | 1374 | } |
d8cac50b | 1375 | # We *know* this routine is only called when we've configure 'shared'. |
f6196227 | 1376 | sub obj2shlib { |
567a9e6f | 1377 | my %args = @_; |
47eeaf45 | 1378 | my @linkdirs = (); |
e805c2d6 RL |
1379 | my @linklibs = (); |
1380 | foreach (@{$args{deps}}) { | |
1381 | if (platform->isstaticlib($_)) { | |
1382 | push @linklibs, platform->convertext($_); | |
1383 | } else { | |
1384 | my $d = "-L" . dirname($_); | |
1385 | my $l = basename($_); | |
1386 | $l =~ s/^lib//; | |
1387 | $l = "-l" . $l; | |
1388 | push @linklibs, $l; | |
1389 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
1390 | } | |
47eeaf45 | 1391 | } |
e805c2d6 RL |
1392 | my $linkflags = join("", map { $_." " } @linkdirs); |
1393 | my $linklibs = join("", map { $_." " } @linklibs); | |
1394 | my @objs = map { platform->convertext($_) } | |
9dd4ed28 | 1395 | grep { !platform->isdef($_) } |
ef2dfc99 | 1396 | @{$args{objs}}; |
9dd4ed28 RL |
1397 | my @defs = map { platform->def($_) } |
1398 | grep { platform->isdef($_) } | |
81183680 | 1399 | @{$args{objs}}; |
81183680 RL |
1400 | my @deps = compute_lib_depends(@{$args{deps}}); |
1401 | die "More than one exported symbol map" if scalar @defs > 1; | |
c00d9311 | 1402 | |
9dd4ed28 RL |
1403 | my $simple = platform->sharedlib_simple($args{lib}); |
1404 | my $full = platform->sharedlib($args{lib}); | |
81183680 | 1405 | my $shared_soname = ""; |
d8cac50b | 1406 | $shared_soname .= ' '.$target{shared_sonameflag}.basename($full) |
81183680 RL |
1407 | if defined $target{shared_sonameflag}; |
1408 | my $shared_imp = ""; | |
d8cac50b | 1409 | $shared_imp .= ' '.$target{shared_impflag}.basename($simple) |
81183680 RL |
1410 | if defined $target{shared_impflag}; |
1411 | my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); | |
c00d9311 RL |
1412 | |
1413 | my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs)); | |
1414 | my $deps = join(" \\\n" . ' ' x (length($full) + 2), | |
1415 | fill_lines(' ', $COLUMNS - length($full) - 2, | |
1416 | @objs, @defs, @deps)); | |
1417 | ||
81183680 | 1418 | my $recipe = <<"EOF"; |
9dd4ed28 | 1419 | $simple: $full |
fcf80c46 | 1420 | EOF |
9dd4ed28 | 1421 | if (sharedaix()) { |
81183680 | 1422 | $recipe .= <<"EOF"; |
9dd4ed28 RL |
1423 | rm -f $simple && \\ |
1424 | \$(AR) r $simple $full | |
cff89b17 | 1425 | EOF |
9dd4ed28 | 1426 | } elsif ($simple ne $full) { |
cff89b17 | 1427 | $recipe .= <<"EOF"; |
d8cac50b | 1428 | rm -f $simple && \\ |
9dd4ed28 | 1429 | ln -s $full $simple |
81183680 | 1430 | EOF |
9dd4ed28 RL |
1431 | } |
1432 | $recipe .= <<"EOF"; | |
1433 | $full: $deps | |
1434 | \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\ | |
c00d9311 RL |
1435 | -o $full$shared_def \\ |
1436 | $objs \\ | |
1437 | $linklibs \$(LIB_EX_LIBS) | |
9dd4ed28 RL |
1438 | EOF |
1439 | if (windowsdll()) { | |
81183680 | 1440 | $recipe .= <<"EOF"; |
9dd4ed28 RL |
1441 | rm -f apps/$full |
1442 | rm -f test/$full | |
1443 | rm -f fuzz/$full | |
1444 | cp -p $full apps/ | |
1445 | cp -p $full test/ | |
1446 | cp -p $full fuzz/ | |
567a9e6f | 1447 | EOF |
81183680 | 1448 | } |
9dd4ed28 | 1449 | return $recipe; |
567a9e6f | 1450 | } |
5386287c | 1451 | sub obj2dso { |
567a9e6f | 1452 | my %args = @_; |
285daccd | 1453 | my $dso = platform->dso($args{module}); |
47eeaf45 | 1454 | my @linkdirs = (); |
e805c2d6 RL |
1455 | my @linklibs = (); |
1456 | foreach (@{$args{deps}}) { | |
1457 | next unless defined $_; | |
1458 | if (platform->isstaticlib($_)) { | |
1459 | push @linklibs, platform->convertext($_); | |
1460 | } else { | |
1461 | my $d = "-L" . dirname($_); | |
1462 | my $l = basename($_); | |
1463 | $l =~ s/^lib//; | |
1464 | $l = "-l" . $l; | |
1465 | push @linklibs, $l; | |
1466 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
1467 | } | |
47eeaf45 | 1468 | } |
e805c2d6 RL |
1469 | my $linkflags = join("", map { $_." " } @linkdirs); |
1470 | my $linklibs = join("", map { $_." " } @linklibs); | |
1471 | my @objs = map { platform->convertext($_) } | |
9dd4ed28 | 1472 | grep { !platform->isdef($_) } |
29f3cfdd | 1473 | @{$args{objs}}; |
9dd4ed28 RL |
1474 | my @defs = map { platform->def($_) } |
1475 | grep { platform->isdef($_) } | |
66a24ab8 | 1476 | @{$args{objs}}; |
81183680 | 1477 | my @deps = compute_lib_depends(@{$args{deps}}); |
66a24ab8 | 1478 | my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); |
c00d9311 RL |
1479 | |
1480 | my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs)); | |
1481 | my $deps = join(" \\\n" . ' ' x (length($dso) + 2), | |
1482 | fill_lines(' ', $COLUMNS - length($dso) - 2, | |
1483 | @objs, @defs, @deps)); | |
1484 | ||
567a9e6f | 1485 | return <<"EOF"; |
9dd4ed28 | 1486 | $dso: $deps |
722c9762 | 1487 | \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\ |
c00d9311 RL |
1488 | -o $dso$shared_def \\ |
1489 | $objs \\ | |
1490 | $linklibs\$(DSO_EX_LIBS) | |
567a9e6f RL |
1491 | EOF |
1492 | } | |
1493 | sub obj2lib { | |
1494 | my %args = @_; | |
9dd4ed28 RL |
1495 | my $lib = platform->staticlib($args{lib}); |
1496 | my @objs = map { platform->obj($_) } @{$args{objs}}; | |
c00d9311 RL |
1497 | my $objs = join(" \\\n" . ' ' x (length($lib) + 2), |
1498 | fill_lines(' ', $COLUMNS - length($lib) - 2, @objs)); | |
567a9e6f | 1499 | return <<"EOF"; |
9dd4ed28 | 1500 | $lib: $objs |
5b18235a | 1501 | \$(AR) \$(ARFLAGS) \$\@ \$\? |
567a9e6f RL |
1502 | \$(RANLIB) \$\@ || echo Never mind. |
1503 | EOF | |
1504 | } | |
1505 | sub obj2bin { | |
1506 | my %args = @_; | |
9dd4ed28 | 1507 | my $bin = platform->bin($args{bin}); |
c00d9311 RL |
1508 | my @objs = map { platform->obj($_) } @{$args{objs}}; |
1509 | my @deps = compute_lib_depends(@{$args{deps}}); | |
1510 | my $objs = join(" \\\n" . ' ' x (length($bin) + 2), | |
1511 | fill_lines(' ', $COLUMNS - length($bin) - 2, @objs)); | |
47eeaf45 | 1512 | my @linkdirs = (); |
e805c2d6 RL |
1513 | my @linklibs = (); |
1514 | foreach (@{$args{deps}}) { | |
1515 | next unless defined $_; | |
1516 | if (platform->isstaticlib($_)) { | |
1517 | push @linklibs, platform->convertext($_); | |
1518 | } else { | |
1519 | my $d = "-L" . dirname($_); | |
1520 | my $l = basename($_); | |
1521 | $l =~ s/^lib//; | |
1522 | $l = "-l" . $l; | |
1523 | push @linklibs, $l; | |
1524 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
1525 | } | |
47eeaf45 | 1526 | } |
e805c2d6 RL |
1527 | my $linkflags = join("", map { $_." " } @linkdirs); |
1528 | my $linklibs = join("", map { $_." " } @linklibs); | |
81183680 | 1529 | my $cmd = '$(CC)'; |
722c9762 | 1530 | my $cmdflags = '$(BIN_CFLAGS)'; |
81183680 RL |
1531 | if (grep /_cc\.o$/, @{$args{objs}}) { |
1532 | $cmd = '$(CXX)'; | |
722c9762 | 1533 | $cmdflags = '$(BIN_CXXFLAGS)'; |
7763472f | 1534 | } |
c00d9311 RL |
1535 | |
1536 | my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs)); | |
1537 | my $deps = join(" \\\n" . ' ' x (length($bin) + 2), | |
1538 | fill_lines(' ', $COLUMNS - length($bin) - 2, | |
1539 | @objs, @deps)); | |
1540 | ||
567a9e6f | 1541 | return <<"EOF"; |
c00d9311 | 1542 | $bin: $deps |
9dd4ed28 | 1543 | rm -f $bin |
722c9762 | 1544 | \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\ |
c00d9311 RL |
1545 | -o $bin \\ |
1546 | $objs \\ | |
e805c2d6 | 1547 | $linklibs\$(BIN_EX_LIBS) |
567a9e6f RL |
1548 | EOF |
1549 | } | |
1550 | sub in2script { | |
1551 | my %args = @_; | |
1552 | my $script = $args{script}; | |
1553 | my $sources = join(" ", @{$args{sources}}); | |
1554 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
1555 | "util", "dofile.pl")), | |
1556 | rel2abs($config{builddir})); | |
1557 | return <<"EOF"; | |
88297284 | 1558 | $script: $sources |
4b799cea | 1559 | \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ |
ba327ade | 1560 | "-o$target{build_file}" $sources > "$script" |
567a9e6f | 1561 | chmod a+x $script |
0ad1d94d RL |
1562 | EOF |
1563 | } | |
1564 | sub generatedir { | |
1565 | my %args = @_; | |
1566 | my $dir = $args{dir}; | |
9dd4ed28 | 1567 | my @deps = map { platform->convertext($_) } @{$args{deps}}; |
c00d9311 | 1568 | my @comments = (); |
9dd4ed28 RL |
1569 | my %extinfo = ( dso => platform->dsoext(), |
1570 | lib => platform->libext(), | |
1571 | bin => platform->binext() ); | |
0ad1d94d | 1572 | |
b6e66075 RL |
1573 | # We already have a 'test' target, and the top directory is just plain |
1574 | # silly | |
1575 | return if $dir eq "test" || $dir eq "."; | |
1576 | ||
0ad1d94d RL |
1577 | foreach my $type (("dso", "lib", "bin", "script")) { |
1578 | next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type}); | |
850000aa RL |
1579 | # For lib object files, we could update the library. However, it |
1580 | # was decided that it's enough to build the directory local object | |
1581 | # files, so we don't need to add any actions, and the dependencies | |
1582 | # are already taken care of. | |
1583 | if ($type ne "lib") { | |
0ad1d94d RL |
1584 | foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { |
1585 | if (dirname($prod) eq $dir) { | |
1586 | push @deps, $prod.$extinfo{$type}; | |
1587 | } else { | |
c00d9311 | 1588 | push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}}); |
0ad1d94d RL |
1589 | } |
1590 | } | |
1591 | } | |
1592 | } | |
1593 | ||
c00d9311 RL |
1594 | my $target = "$dir $dir/"; |
1595 | my $deps = join(" \\\n\t", | |
1596 | fill_lines(' ', $COLUMNS - 8, @deps)); | |
1597 | my $comments = join("\n", "", @comments); | |
0ad1d94d | 1598 | return <<"EOF"; |
c00d9311 RL |
1599 | $target: \\ |
1600 | $deps$comments | |
567a9e6f RL |
1601 | EOF |
1602 | } | |
1603 | "" # Important! This becomes part of the template result. | |
1604 | -} |