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