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