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