2016-03-02 19:29:56 +08:00
|
|
|
##
|
|
|
|
## Makefile for OpenSSL
|
|
|
|
##
|
|
|
|
## {- join("\n## ", @autowarntext) -}
|
|
|
|
{-
|
2019-12-02 16:48:44 +08:00
|
|
|
use File::Basename;
|
2021-05-17 20:25:12 +08:00
|
|
|
use OpenSSL::Util;
|
2019-12-02 16:48:44 +08:00
|
|
|
|
2018-10-23 20:36:23 +08:00
|
|
|
our $sover_dirname = platform->shlib_version_as_filename();
|
2016-07-07 00:37:52 +08:00
|
|
|
|
2018-03-04 05:26:45 +08:00
|
|
|
my $build_scheme = $target{build_scheme};
|
|
|
|
my $install_flavour = $build_scheme->[$#$build_scheme]; # last element
|
2016-03-17 17:08:25 +08:00
|
|
|
my $win_installenv =
|
2018-03-04 05:26:45 +08:00
|
|
|
$install_flavour eq "VC-WOW" ? "ProgramFiles(x86)"
|
|
|
|
: "ProgramW6432";
|
2016-03-17 17:08:25 +08:00
|
|
|
my $win_commonenv =
|
2018-03-04 05:26:45 +08:00
|
|
|
$install_flavour eq "VC-WOW" ? "CommonProgramFiles(x86)"
|
|
|
|
: "CommonProgramW6432";
|
2016-03-17 17:08:25 +08:00
|
|
|
our $win_installroot =
|
2018-03-04 05:26:45 +08:00
|
|
|
defined($ENV{$win_installenv}) ? $win_installenv : 'ProgramFiles';
|
2016-03-17 17:08:25 +08:00
|
|
|
our $win_commonroot =
|
2018-03-04 05:26:45 +08:00
|
|
|
defined($ENV{$win_commonenv}) ? $win_commonenv : 'CommonProgramFiles';
|
2016-05-06 18:45:50 +08:00
|
|
|
|
|
|
|
# expand variables early
|
|
|
|
$win_installroot = $ENV{$win_installroot};
|
|
|
|
$win_commonroot = $ENV{$win_commonroot};
|
2016-03-17 17:08:25 +08:00
|
|
|
|
2017-04-22 21:06:35 +08:00
|
|
|
# This makes sure things get built in the order they need
|
|
|
|
# to. You're welcome.
|
|
|
|
sub dependmagic {
|
|
|
|
my $target = shift;
|
|
|
|
|
2020-11-07 20:52:30 +08:00
|
|
|
return "$target: build_generated\n\t\$(MAKE) /\$(MAKEFLAGS) depend\n\t\$(MAKE) /\$(MAKEFLAGS) _$target\n_$target";
|
2017-04-22 21:06:35 +08:00
|
|
|
}
|
2016-03-02 19:29:56 +08:00
|
|
|
'';
|
|
|
|
-}
|
|
|
|
|
|
|
|
PLATFORM={- $config{target} -}
|
|
|
|
SRCDIR={- $config{sourcedir} -}
|
|
|
|
BLDDIR={- $config{builddir} -}
|
2020-06-29 10:20:41 +08:00
|
|
|
FIPSKEY={- $config{FIPSKEY} -}
|
2016-03-02 19:29:56 +08:00
|
|
|
|
2018-12-07 07:32:43 +08:00
|
|
|
VERSION={- "$config{full_version}" -}
|
2021-09-08 15:40:37 +08:00
|
|
|
VERSION_NUMBER={- "$config{version}" -}
|
2016-03-02 19:29:56 +08:00
|
|
|
MAJOR={- $config{major} -}
|
|
|
|
MINOR={- $config{minor} -}
|
|
|
|
|
Switch to MAJOR.MINOR.PATCH versioning and version 3.0.0-dev
We're strictly use version numbers of the form MAJOR.MINOR.PATCH.
Letter releases are things of days past.
The most central change is that we now express the version number with
three macros, one for each part of the version number:
OPENSSL_VERSION_MAJOR
OPENSSL_VERSION_MINOR
OPENSSL_VERSION_PATCH
We also provide two additional macros to express pre-release and build
metadata information (also specified in semantic versioning):
OPENSSL_VERSION_PRE_RELEASE
OPENSSL_VERSION_BUILD_METADATA
To get the library's idea of all those values, we introduce the
following functions:
unsigned int OPENSSL_version_major(void);
unsigned int OPENSSL_version_minor(void);
unsigned int OPENSSL_version_patch(void);
const char *OPENSSL_version_pre_release(void);
const char *OPENSSL_version_build_metadata(void);
Additionally, for shared library versioning (which is out of scope in
semantic versioning, but that we still need):
OPENSSL_SHLIB_VERSION
We also provide a macro that contains the release date. This is not
part of the version number, but is extra information that we want to
be able to display:
OPENSSL_RELEASE_DATE
Finally, also provide the following convenience functions:
const char *OPENSSL_version_text(void);
const char *OPENSSL_version_text_full(void);
The following macros and functions are deprecated, and while currently
existing for backward compatibility, they are expected to disappear:
OPENSSL_VERSION_NUMBER
OPENSSL_VERSION_TEXT
OPENSSL_VERSION
OpenSSL_version_num()
OpenSSL_version()
Also, this function is introduced to replace OpenSSL_version() for all
indexes except for OPENSSL_VERSION:
OPENSSL_info()
For configuration, the option 'newversion-only' is added to disable all
the macros and functions that are mentioned as deprecated above.
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7724)
2018-09-27 21:56:35 +08:00
|
|
|
SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
|
2016-03-02 19:29:56 +08:00
|
|
|
|
2018-10-23 20:36:23 +08:00
|
|
|
LIBS={- join(" ", map { ( platform->sharedlib_import($_), platform->staticlib($_) ) } @{$unified_info{libraries}}) -}
|
|
|
|
SHLIBS={- join(" ", map { platform->sharedlib($_) // () } @{$unified_info{libraries}}) -}
|
|
|
|
SHLIBPDBS={- join(" ", map { platform->sharedlibpdb($_) // () } @{$unified_info{libraries}}) -}
|
2021-05-24 20:06:00 +08:00
|
|
|
MODULES={- our @MODULES = map { platform->dso($_) }
|
|
|
|
# Drop all modules that are dependencies, they will
|
|
|
|
# be processed through their dependents
|
|
|
|
grep { my $x = $_;
|
|
|
|
!grep { grep { $_ eq $x } @$_ }
|
|
|
|
values %{$unified_info{depends}} }
|
|
|
|
@{$unified_info{modules}};
|
2020-02-25 18:14:28 +08:00
|
|
|
join(" ", @MODULES) -}
|
2019-01-31 07:06:50 +08:00
|
|
|
MODULEPDBS={- join(" ", map { platform->dsopdb($_) } @{$unified_info{modules}}) -}
|
2021-05-24 20:06:00 +08:00
|
|
|
FIPSMODULE={- # We do some extra checking here, as there should be only one
|
|
|
|
use File::Basename;
|
|
|
|
our @fipsmodules =
|
|
|
|
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
|
|
|
&& $unified_info{attributes}->{modules}->{$_}->{fips} }
|
|
|
|
@{$unified_info{modules}};
|
|
|
|
die "More that one FIPS module" if scalar @fipsmodules > 1;
|
2021-05-31 20:18:56 +08:00
|
|
|
join(" ", map { platform->dso($_) } @fipsmodules) -}
|
2021-05-24 20:06:00 +08:00
|
|
|
FIPSMODULENAME={- die "More that one FIPS module" if scalar @fipsmodules > 1;
|
|
|
|
join(", ", map { basename(platform->dso($_)) } @fipsmodules) -}
|
2018-10-23 20:36:23 +08:00
|
|
|
PROGRAMS={- our @PROGRAMS = map { platform->bin($_) } @{$unified_info{programs}}; join(" ", @PROGRAMS) -}
|
2016-07-08 23:58:36 +08:00
|
|
|
PROGRAMPDBS={- join(" ", map { $_.".pdb" } @{$unified_info{programs}}) -}
|
2020-02-25 18:14:28 +08:00
|
|
|
SCRIPTS={- our @SCRIPTS = @{$unified_info{scripts}}; join(" ", @SCRIPTS) -}
|
2016-03-19 07:05:25 +08:00
|
|
|
{- output_off() if $disabled{makedepend}; "" -}
|
2018-10-23 20:36:23 +08:00
|
|
|
DEPS={- join(" ", map { platform->isobj($_) ? platform->dep($_) : () }
|
2016-03-02 19:29:56 +08:00
|
|
|
grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
|
|
|
|
keys %{$unified_info{sources}}); -}
|
2016-03-19 07:05:25 +08:00
|
|
|
{- output_on() if $disabled{makedepend}; "" -}
|
2020-02-25 18:14:28 +08:00
|
|
|
GENERATED_MANDATORY={- our @GENERATED_MANDATORY = @{$unified_info{depends}->{""}};
|
|
|
|
join(" ", @GENERATED_MANDATORY) -}
|
Configuration: Simplify generating list of generated files in build file templates
Computing the value of the GENERATED variable in the build file
templates is somewhat overcomplicated, and because of possible
duplication errors, changes are potentially error prone.
Looking more closely at how this list is determined, it can be
observed that the exact list of files to check is consistently
available in all the values found in the %unified_info tables
'depends', 'sources' and 'shared_sources', and all that's needed is to
filter those values so only those present as keys in the 'generate'
table are left.
This computation is also common for all build files, so due to its
apparent complexity, we move it to common0.tmpl, with the result left
in a global variable (@generated), to be consumed by all build file
templates.
common0.tmpl is included among the files to process when creating
build files, but unlike common.tmpl, it comes first of all.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5930)
2018-04-11 19:13:22 +08:00
|
|
|
GENERATED={- # common0.tmpl provides @generated
|
2020-02-25 18:14:28 +08:00
|
|
|
our @GENERATED = map { platform->convertext($_) } @generated;
|
|
|
|
join(" ", @GENERATED) -}
|
2018-10-23 20:36:23 +08:00
|
|
|
|
2018-11-07 18:02:06 +08:00
|
|
|
INSTALL_LIBS={-
|
|
|
|
join(" ", map { quotify1(platform->sharedlib_import($_)
|
|
|
|
// platform->staticlib($_)) }
|
2019-10-04 05:30:58 +08:00
|
|
|
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
2018-11-07 18:02:06 +08:00
|
|
|
@{$unified_info{libraries}})
|
|
|
|
-}
|
|
|
|
INSTALL_SHLIBS={-
|
|
|
|
join(" ", map { my $x = platform->sharedlib($_);
|
|
|
|
$x ? quotify_l($x) : () }
|
2019-10-04 05:30:58 +08:00
|
|
|
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
2018-11-07 18:02:06 +08:00
|
|
|
@{$unified_info{libraries}})
|
|
|
|
-}
|
|
|
|
INSTALL_SHLIBPDBS={-
|
|
|
|
join(" ", map { my $x = platform->sharedlibpdb($_);
|
|
|
|
$x ? quotify_l($x) : () }
|
2019-10-04 05:30:58 +08:00
|
|
|
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
2018-11-07 18:02:06 +08:00
|
|
|
@{$unified_info{libraries}})
|
|
|
|
-}
|
|
|
|
INSTALL_ENGINES={-
|
|
|
|
join(" ", map { quotify1(platform->dso($_)) }
|
2019-10-04 05:30:58 +08:00
|
|
|
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
|
|
|
&& $unified_info{attributes}->{modules}->{$_}->{engine} }
|
2019-01-31 07:06:50 +08:00
|
|
|
@{$unified_info{modules}})
|
2018-11-07 18:02:06 +08:00
|
|
|
-}
|
|
|
|
INSTALL_ENGINEPDBS={-
|
|
|
|
join(" ", map { quotify1(platform->dsopdb($_)) }
|
2019-10-04 05:30:58 +08:00
|
|
|
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
|
|
|
&& $unified_info{attributes}->{modules}->{$_}->{engine} }
|
2019-01-31 07:06:50 +08:00
|
|
|
@{$unified_info{modules}})
|
2018-11-07 18:02:06 +08:00
|
|
|
-}
|
2020-04-23 18:50:20 +08:00
|
|
|
INSTALL_MODULES={-
|
2021-01-08 01:47:01 +08:00
|
|
|
join(" ", map { quotify1(platform->dso($_)) }
|
2020-04-24 16:08:42 +08:00
|
|
|
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
2021-01-08 01:47:01 +08:00
|
|
|
&& !$unified_info{attributes}->{modules}->{$_}->{engine}
|
|
|
|
&& !$unified_info{attributes}->{modules}->{$_}->{fips} }
|
2020-04-24 16:08:42 +08:00
|
|
|
@{$unified_info{modules}})
|
2020-04-17 21:38:45 +08:00
|
|
|
-}
|
|
|
|
INSTALL_MODULEPDBS={-
|
|
|
|
join(" ", map { quotify1(platform->dsopdb($_)) }
|
|
|
|
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
|
|
|
&& !$unified_info{attributes}->{modules}->{$_}->{engine} }
|
|
|
|
@{$unified_info{modules}})
|
|
|
|
-}
|
2021-05-24 20:24:32 +08:00
|
|
|
INSTALL_FIPSMODULE={-
|
|
|
|
join(" ", map { quotify1(platform->dso($_)) }
|
|
|
|
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
|
|
|
&& $unified_info{attributes}->{modules}->{$_}->{fips} }
|
|
|
|
@{$unified_info{modules}})
|
|
|
|
-}
|
|
|
|
INSTALL_FIPSMODULECONF=providers\fipsmodule.cnf
|
2018-11-07 18:02:06 +08:00
|
|
|
INSTALL_PROGRAMS={-
|
|
|
|
join(" ", map { quotify1(platform->bin($_)) }
|
2019-10-04 05:30:58 +08:00
|
|
|
grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
|
2018-11-07 18:02:06 +08:00
|
|
|
@{$unified_info{programs}})
|
|
|
|
-}
|
|
|
|
INSTALL_PROGRAMPDBS={-
|
|
|
|
join(" ", map { quotify1(platform->binpdb($_)) }
|
2019-10-04 05:30:58 +08:00
|
|
|
grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
|
2018-11-07 18:02:06 +08:00
|
|
|
@{$unified_info{programs}})
|
|
|
|
-}
|
Build: use attributes to indicate installed script classes
We have two classes of scripts to be installed, those that are
installed as "normal" programs, and those that are installed as "misc"
scripts. These classes are installed in different locations, so the
build file templates must pay attention.
Because we didn't have the tools to indicate what scripts go where, we
had these scripts hard coded in the build template files, with the
maintenance issues that may cause. Now that we have attributes, those
can be used to classify the installed scripts, and have the build file
templates simply check the attributes to know what's what.
Furthermore, the 'tsget.pl' script exists both as 'tsget.pl' and
'tsget', which is done by installing a symbolic link (or copy). This
link name is now given through an attribute, which results in even
less hard coding in the Unix Makefile template.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7581)
2018-11-07 18:05:17 +08:00
|
|
|
BIN_SCRIPTS={-
|
|
|
|
join(" ", map { quotify1($_) }
|
2019-10-04 05:30:58 +08:00
|
|
|
grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
|
|
|
|
&& !$unified_info{attributes}->{scripts}->{$_}->{misc} }
|
Build: use attributes to indicate installed script classes
We have two classes of scripts to be installed, those that are
installed as "normal" programs, and those that are installed as "misc"
scripts. These classes are installed in different locations, so the
build file templates must pay attention.
Because we didn't have the tools to indicate what scripts go where, we
had these scripts hard coded in the build template files, with the
maintenance issues that may cause. Now that we have attributes, those
can be used to classify the installed scripts, and have the build file
templates simply check the attributes to know what's what.
Furthermore, the 'tsget.pl' script exists both as 'tsget.pl' and
'tsget', which is done by installing a symbolic link (or copy). This
link name is now given through an attribute, which results in even
less hard coding in the Unix Makefile template.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7581)
2018-11-07 18:05:17 +08:00
|
|
|
@{$unified_info{scripts}})
|
|
|
|
-}
|
|
|
|
MISC_SCRIPTS={-
|
|
|
|
join(" ", map { quotify1($_) }
|
2019-10-04 05:30:58 +08:00
|
|
|
grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
|
|
|
|
&& $unified_info{attributes}->{scripts}->{$_}->{misc} }
|
Build: use attributes to indicate installed script classes
We have two classes of scripts to be installed, those that are
installed as "normal" programs, and those that are installed as "misc"
scripts. These classes are installed in different locations, so the
build file templates must pay attention.
Because we didn't have the tools to indicate what scripts go where, we
had these scripts hard coded in the build template files, with the
maintenance issues that may cause. Now that we have attributes, those
can be used to classify the installed scripts, and have the build file
templates simply check the attributes to know what's what.
Furthermore, the 'tsget.pl' script exists both as 'tsget.pl' and
'tsget', which is done by installing a symbolic link (or copy). This
link name is now given through an attribute, which results in even
less hard coding in the Unix Makefile template.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7581)
2018-11-07 18:05:17 +08:00
|
|
|
@{$unified_info{scripts}})
|
|
|
|
-}
|
Add exporters for CMake
CMake's older package finder, FindOpenSSL.cmake, does a best guess effort
and doesn't always get it right.
By CMake's own documentation, that's what such modules are (best effort
attempts), and package producers are (strongly) encouraged to help out by
producing and installing <PackageName>Config.cmake files to get a more
deterministic configuration.
The resulting OpenSSLConfig.cmake tries to mimic the result from CMake's
FindOpenSSL.cmake, by using the same variable and imported target names.
It also adds a few extra variables of its own, such as:
OPENSSL_MODULES_DIR Indicates the default installation directory
for OpenSSL loadable modules, such as providers.
OPENSSL_RUNTIME_DIR Indicates the default runtime directory, where
for example the openssl program is located.
OPENSSL_PROGRAM Is the full directory-and-filename of the
openssl program.
The imported targets OpenSSL::Crypto and OpenSSL::SSL are as precisely
specified as possible, so for example, they are specified with the both the
import library and the DLL on Windows, which should make life easier on that
platform.
For the moment, one of the following must be done in your CMake project for
this CMake configuration to take priority over CMake's FindOpenSSL.cmake:
- The variable CMAKE_FIND_PACKAGE_PREFER_CONFIG must be set to true prior
to the 'find_package(OpenSSL)' call.
- The 'find_package' call itself must use the "Full Signature". If you
don't know any better, simply add the 'CONFIG' option, i.e. from this
example:
find_package(OpenSSL 3.0 REQUIRED)
to this:
find_package(OpenSSL 3.0 REQUIRED CONFIG)
Just as with the 'pkg-config' exporters, two variants of the .cmake files
are produced:
- Those in 'exporters/' are installed in the location that 'pkg-config'
itself prefers for installed packages.
- Those in the top directory are to be used when it's desirable to build
directly against an OpenSSL build tree.
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20878)
2023-05-03 18:36:09 +08:00
|
|
|
INSTALL_EXPORTERS_CMAKE={-
|
|
|
|
join(" ", map { quotify1($_) }
|
|
|
|
grep { $unified_info{attributes}->{generate}->{$_}->{exporter} eq 'cmake'}
|
|
|
|
sort keys %{$unified_info{generate}})
|
|
|
|
-}
|
2021-05-21 13:24:57 +08:00
|
|
|
IMAGEDOCS1={- our @IMAGEDOCS1 = @{$unified_info{imagedocs}->{man1}};
|
|
|
|
join(" ", @IMAGEDOCS1) -}
|
|
|
|
IMAGEDOCS3={- our @IMAGEDOCS3 = @{$unified_info{imagedocs}->{man3}};
|
|
|
|
join(" ", @IMAGEDOCS3) -}
|
|
|
|
IMAGEDOCS5={- our @IMAGEDOCS5 = @{$unified_info{imagedocs}->{man5}};
|
|
|
|
join(" ", @IMAGEDOCS5) -}
|
|
|
|
IMAGEDOCS7={- our @IMAGEDOCS7 = @{$unified_info{imagedocs}->{man7}};
|
|
|
|
join(" ", @IMAGEDOCS7) -}
|
2019-12-02 16:48:44 +08:00
|
|
|
HTMLDOCS1={- our @HTMLDOCS1 = @{$unified_info{htmldocs}->{man1}};
|
|
|
|
join(" ", @HTMLDOCS1) -}
|
|
|
|
HTMLDOCS3={- our @HTMLDOCS3 = @{$unified_info{htmldocs}->{man3}};
|
|
|
|
join(" ", @HTMLDOCS3) -}
|
|
|
|
HTMLDOCS5={- our @HTMLDOCS5 = @{$unified_info{htmldocs}->{man5}};
|
|
|
|
join(" ", @HTMLDOCS5) -}
|
|
|
|
HTMLDOCS7={- our @HTMLDOCS7 = @{$unified_info{htmldocs}->{man7}};
|
|
|
|
join(" ", @HTMLDOCS7) -}
|
|
|
|
HTMLDOCS1_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS1;
|
|
|
|
join(' ', sort keys %dirs) -}
|
|
|
|
HTMLDOCS3_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS3;
|
|
|
|
join(' ', sort keys %dirs) -}
|
|
|
|
HTMLDOCS5_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS5;
|
|
|
|
join(' ', sort keys %dirs) -}
|
|
|
|
HTMLDOCS7_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS7;
|
|
|
|
join(' ', sort keys %dirs) -}
|
2016-07-08 20:52:09 +08:00
|
|
|
|
2020-02-26 21:39:16 +08:00
|
|
|
APPS_OPENSSL="{- use File::Spec::Functions;
|
|
|
|
catfile("apps","openssl") -}"
|
2017-06-16 01:31:01 +08:00
|
|
|
|
2016-03-02 19:29:56 +08:00
|
|
|
# Do not edit these manually. Use Configure with --prefix or --openssldir
|
|
|
|
# to change this! Short explanation in the top comment in Configure
|
2016-06-28 19:20:21 +08:00
|
|
|
INSTALLTOP_dev={- # $prefix is used in the OPENSSLDIR perl snippet
|
|
|
|
#
|
|
|
|
use File::Spec::Functions qw(:DEFAULT splitpath);
|
2017-10-04 15:42:23 +08:00
|
|
|
our $prefix = canonpath($config{prefix}
|
|
|
|
|| "$win_installroot\\OpenSSL");
|
2016-06-28 19:20:21 +08:00
|
|
|
our ($prefix_dev, $prefix_dir, $prefix_file) =
|
2016-06-30 06:10:21 +08:00
|
|
|
splitpath($prefix, 1);
|
2016-06-28 19:20:21 +08:00
|
|
|
$prefix_dev -}
|
2017-10-04 15:42:23 +08:00
|
|
|
INSTALLTOP_dir={- canonpath($prefix_dir) -}
|
2016-06-28 19:20:21 +08:00
|
|
|
OPENSSLDIR_dev={- #
|
|
|
|
# The logic here is that if no --openssldir was given,
|
2017-06-11 19:10:15 +08:00
|
|
|
# OPENSSLDIR will get the value "$win_commonroot\\SSL".
|
2016-06-28 19:20:21 +08:00
|
|
|
# If --openssldir was given and the value is an absolute
|
|
|
|
# path, OPENSSLDIR will get its value without change.
|
|
|
|
# If the value from --openssldir is a relative path,
|
|
|
|
# OPENSSLDIR will get $prefix with the --openssldir
|
|
|
|
# value appended as a subdirectory.
|
|
|
|
#
|
|
|
|
use File::Spec::Functions qw(:DEFAULT splitpath);
|
2016-07-07 01:43:59 +08:00
|
|
|
our $openssldir =
|
2016-06-28 19:20:21 +08:00
|
|
|
$config{openssldir} ?
|
|
|
|
(file_name_is_absolute($config{openssldir}) ?
|
2017-10-04 15:42:23 +08:00
|
|
|
canonpath($config{openssldir})
|
2016-06-28 19:20:21 +08:00
|
|
|
: catdir($prefix, $config{openssldir}))
|
2017-10-04 15:42:23 +08:00
|
|
|
: canonpath("$win_commonroot\\SSL");
|
2016-06-28 19:20:21 +08:00
|
|
|
our ($openssldir_dev, $openssldir_dir, $openssldir_file) =
|
|
|
|
splitpath($openssldir, 1);
|
|
|
|
$openssldir_dev -}
|
2017-10-04 15:42:23 +08:00
|
|
|
OPENSSLDIR_dir={- canonpath($openssldir_dir) -}
|
2016-03-17 17:08:25 +08:00
|
|
|
LIBDIR={- our $libdir = $config{libdir} || "lib";
|
2018-02-23 19:10:42 +08:00
|
|
|
file_name_is_absolute($libdir) ? "" : $libdir -}
|
2019-03-13 20:24:17 +08:00
|
|
|
MODULESDIR_dev={- use File::Spec::Functions qw(:DEFAULT splitpath catpath);
|
2019-02-06 06:18:50 +08:00
|
|
|
our $modulesprefix = catdir($prefix,$libdir);
|
|
|
|
our ($modulesprefix_dev, $modulesprefix_dir,
|
|
|
|
$modulesprefix_file) =
|
|
|
|
splitpath($modulesprefix, 1);
|
|
|
|
our $modulesdir_dev = $modulesprefix_dev;
|
|
|
|
our $modulesdir_dir =
|
|
|
|
catdir($modulesprefix_dir, "ossl-modules");
|
|
|
|
our $modulesdir = catpath($modulesdir_dev, $modulesdir_dir);
|
|
|
|
our $enginesdir_dev = $modulesprefix_dev;
|
2019-03-13 20:24:17 +08:00
|
|
|
our $enginesdir_dir =
|
2019-02-06 06:18:50 +08:00
|
|
|
catdir($modulesprefix_dir, "engines-$sover_dirname");
|
|
|
|
our $enginesdir = catpath($enginesdir_dev, $enginesdir_dir);
|
|
|
|
$modulesdir_dev -}
|
|
|
|
MODULESDIR_dir={- canonpath($modulesdir_dir) -}
|
|
|
|
ENGINESDIR_dev={- $enginesdir_dev -}
|
2017-10-04 15:42:23 +08:00
|
|
|
ENGINESDIR_dir={- canonpath($enginesdir_dir) -}
|
2016-06-28 19:20:21 +08:00
|
|
|
!IF "$(DESTDIR)" != ""
|
|
|
|
INSTALLTOP=$(DESTDIR)$(INSTALLTOP_dir)
|
|
|
|
OPENSSLDIR=$(DESTDIR)$(OPENSSLDIR_dir)
|
|
|
|
ENGINESDIR=$(DESTDIR)$(ENGINESDIR_dir)
|
2019-02-06 06:18:50 +08:00
|
|
|
MODULESDIR=$(DESTDIR)$(MODULESDIR_dir)
|
2016-06-28 19:20:21 +08:00
|
|
|
!ELSE
|
|
|
|
INSTALLTOP=$(INSTALLTOP_dev)$(INSTALLTOP_dir)
|
|
|
|
OPENSSLDIR=$(OPENSSLDIR_dev)$(OPENSSLDIR_dir)
|
|
|
|
ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir)
|
2019-02-06 06:18:50 +08:00
|
|
|
MODULESDIR=$(MODULESDIR_dev)$(MODULESDIR_dir)
|
2016-06-28 19:20:21 +08:00
|
|
|
!ENDIF
|
2016-03-02 19:29:56 +08:00
|
|
|
|
2018-02-23 19:10:42 +08:00
|
|
|
# $(libdir) is chosen to be compatible with the GNU coding standards
|
|
|
|
libdir={- file_name_is_absolute($libdir)
|
|
|
|
? $libdir : '$(INSTALLTOP)\$(LIBDIR)' -}
|
|
|
|
|
Add exporters for CMake
CMake's older package finder, FindOpenSSL.cmake, does a best guess effort
and doesn't always get it right.
By CMake's own documentation, that's what such modules are (best effort
attempts), and package producers are (strongly) encouraged to help out by
producing and installing <PackageName>Config.cmake files to get a more
deterministic configuration.
The resulting OpenSSLConfig.cmake tries to mimic the result from CMake's
FindOpenSSL.cmake, by using the same variable and imported target names.
It also adds a few extra variables of its own, such as:
OPENSSL_MODULES_DIR Indicates the default installation directory
for OpenSSL loadable modules, such as providers.
OPENSSL_RUNTIME_DIR Indicates the default runtime directory, where
for example the openssl program is located.
OPENSSL_PROGRAM Is the full directory-and-filename of the
openssl program.
The imported targets OpenSSL::Crypto and OpenSSL::SSL are as precisely
specified as possible, so for example, they are specified with the both the
import library and the DLL on Windows, which should make life easier on that
platform.
For the moment, one of the following must be done in your CMake project for
this CMake configuration to take priority over CMake's FindOpenSSL.cmake:
- The variable CMAKE_FIND_PACKAGE_PREFER_CONFIG must be set to true prior
to the 'find_package(OpenSSL)' call.
- The 'find_package' call itself must use the "Full Signature". If you
don't know any better, simply add the 'CONFIG' option, i.e. from this
example:
find_package(OpenSSL 3.0 REQUIRED)
to this:
find_package(OpenSSL 3.0 REQUIRED CONFIG)
Just as with the 'pkg-config' exporters, two variants of the .cmake files
are produced:
- Those in 'exporters/' are installed in the location that 'pkg-config'
itself prefers for installed packages.
- Those in the top directory are to be used when it's desirable to build
directly against an OpenSSL build tree.
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20878)
2023-05-03 18:36:09 +08:00
|
|
|
CMAKECONFIGDIR=$(libdir)\cmake\OpenSSL
|
|
|
|
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
##### User defined commands and flags ################################
|
|
|
|
|
2019-12-07 16:44:16 +08:00
|
|
|
CC="{- $config{CC} -}"
|
2020-12-10 22:53:07 +08:00
|
|
|
CPP={- $config{CPP} -}
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
CPPFLAGS={- our $cppflags1 = join(" ",
|
|
|
|
(map { "-D".$_} @{$config{CPPDEFINES}}),
|
2020-11-07 22:11:05 +08:00
|
|
|
(map { " -I".$_} @{$config{CPPINCLUDES}}),
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
@{$config{CPPFLAGS}}) -}
|
|
|
|
CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
|
2019-12-07 16:44:16 +08:00
|
|
|
LD="{- $config{LD} -}"
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
LDFLAGS={- join(' ', @{$config{LDFLAGS}}) -}
|
|
|
|
EX_LIBS={- join(' ', @{$config{LDLIBS}}) -}
|
2016-03-02 19:29:56 +08:00
|
|
|
|
2018-07-08 18:00:06 +08:00
|
|
|
PERL={- $config{PERL} -}
|
2016-03-02 19:29:56 +08:00
|
|
|
|
2019-12-07 16:44:16 +08:00
|
|
|
AR="{- $config{AR} -}"
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
|
|
|
|
|
2019-12-07 16:44:16 +08:00
|
|
|
MT="{- $config{MT} -}"
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
MTFLAGS= {- join(' ', @{$config{MTFLAGS}}) -}
|
|
|
|
|
2019-12-07 16:44:16 +08:00
|
|
|
AS="{- $config{AS} -}"
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
|
2016-03-02 19:29:56 +08:00
|
|
|
|
2019-12-07 16:44:16 +08:00
|
|
|
RC="{- $config{RC} -}"
|
2019-04-21 19:14:34 +08:00
|
|
|
RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -}
|
2016-07-14 15:23:36 +08:00
|
|
|
|
2018-07-10 20:12:33 +08:00
|
|
|
ECHO="$(PERL)" "$(SRCDIR)\util\echo.pl"
|
|
|
|
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
##### Special command flags ##########################################
|
|
|
|
|
|
|
|
COUTFLAG={- $target{coutflag} -}$(OSSL_EMPTY)
|
|
|
|
LDOUTFLAG={- $target{ldoutflag} -}$(OSSL_EMPTY)
|
|
|
|
AROUTFLAG={- $target{aroutflag} -}$(OSSL_EMPTY)
|
|
|
|
MTINFLAG={- $target{mtinflag} -}$(OSSL_EMPTY)
|
|
|
|
MTOUTFLAG={- $target{mtoutflag} -}$(OSSL_EMPTY)
|
2016-07-15 18:57:27 +08:00
|
|
|
ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
RCOUTFLAG={- $target{rcoutflag} -}$(OSSL_EMPTY)
|
|
|
|
|
|
|
|
##### Project flags ##################################################
|
|
|
|
|
|
|
|
# Variables starting with CNF_ are common variables for all product types
|
|
|
|
|
|
|
|
CNF_ASFLAGS={- join(' ', $target{asflags} || (),
|
|
|
|
@{$config{asflags}}) -}
|
2023-11-19 06:40:33 +08:00
|
|
|
CNF_CPPFLAGS={- our $cppflags2 =
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
join(' ', $target{cppflags} || (),
|
2018-04-01 23:41:16 +08:00
|
|
|
(map { '-D'.quotify1($_) } @{$target{defines}},
|
|
|
|
@{$config{defines}}),
|
2020-04-12 03:00:17 +08:00
|
|
|
(map { '-I'.'"'.$_.'"' } @{$target{includes}},
|
|
|
|
@{$config{includes}}),
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
@{$config{cppflags}}) -}
|
|
|
|
CNF_CFLAGS={- join(' ', $target{cflags} || (),
|
|
|
|
@{$config{cflags}}) -}
|
|
|
|
CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
|
|
|
|
@{$config{cxxflags}}) -}
|
|
|
|
CNF_LDFLAGS={- join(' ', $target{lflags} || (),
|
|
|
|
@{$config{lflags}}) -}
|
|
|
|
CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
|
|
|
|
@{$config{ex_libs}}) -}
|
|
|
|
|
|
|
|
# Variables starting with LIB_ are used to build library object files
|
|
|
|
# and shared libraries.
|
|
|
|
# Variables starting with DSO_ are used to build DSOs and their object files.
|
|
|
|
# Variables starting with BIN_ are used to build programs and their object
|
|
|
|
# files.
|
|
|
|
|
|
|
|
LIB_ASFLAGS={- join(' ', $target{lib_asflags} || (),
|
|
|
|
@{$config{lib_asflags}},
|
|
|
|
'$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
|
2018-03-09 19:39:01 +08:00
|
|
|
LIB_CPPFLAGS={- our $lib_cppflags =
|
|
|
|
join(' ', $target{lib_cppflags} || (),
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
$target{shared_cppflag} || (),
|
2018-04-01 23:41:16 +08:00
|
|
|
(map { '-D'.quotify1($_) }
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
@{$target{lib_defines}},
|
|
|
|
@{$target{shared_defines}},
|
|
|
|
@{$config{lib_defines}},
|
2018-03-09 19:39:01 +08:00
|
|
|
@{$config{shared_defines}}),
|
2018-04-01 23:41:16 +08:00
|
|
|
(map { '-I'.quotify1($_) }
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
@{$target{lib_includes}},
|
|
|
|
@{$target{shared_includes}},
|
|
|
|
@{$config{lib_includes}},
|
|
|
|
@{$config{shared_includes}}),
|
|
|
|
@{$config{lib_cppflags}},
|
2018-03-09 19:39:01 +08:00
|
|
|
@{$config{shared_cppflag}});
|
|
|
|
join(' ', $lib_cppflags,
|
2018-04-01 23:41:16 +08:00
|
|
|
(map { '-D'.quotify1($_) }
|
2018-03-09 19:39:01 +08:00
|
|
|
"OPENSSLDIR=\"$openssldir\"",
|
2019-02-06 06:18:50 +08:00
|
|
|
"ENGINESDIR=\"$enginesdir\"",
|
|
|
|
"MODULESDIR=\"$modulesdir\""),
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
'$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
|
|
|
|
LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
|
|
|
|
$target{shared_cflag} || (),
|
|
|
|
@{$config{lib_cflags}},
|
|
|
|
@{$config{shared_cflag}},
|
|
|
|
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
|
|
|
|
LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
|
|
|
|
$config{shared_ldflag} || (),
|
|
|
|
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
|
|
|
|
LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
|
|
|
|
DSO_ASFLAGS={- join(' ', $target{dso_asflags} || (),
|
|
|
|
$target{module_asflags} || (),
|
|
|
|
@{$config{dso_asflags}},
|
|
|
|
@{$config{module_asflags}},
|
|
|
|
'$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
|
|
|
|
DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
|
2019-05-30 21:40:57 +08:00
|
|
|
$target{module_cppflag} || (),
|
|
|
|
(map { '-D'.quotify1($_) }
|
|
|
|
@{$target{dso_defines}},
|
|
|
|
@{$target{module_defines}},
|
|
|
|
@{$config{dso_defines}},
|
|
|
|
@{$config{module_defines}}),
|
|
|
|
(map { '-I'.quotify1($_) }
|
|
|
|
@{$target{dso_includes}},
|
|
|
|
@{$target{module_includes}},
|
|
|
|
@{$config{dso_includes}},
|
|
|
|
@{$config{module_includes}}),
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
@{$config{dso_cppflags}},
|
|
|
|
@{$config{module_cppflags}},
|
|
|
|
'$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
|
|
|
|
DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
|
|
|
|
$target{module_cflags} || (),
|
|
|
|
@{$config{dso_cflags}},
|
|
|
|
@{$config{module_cflags}},
|
|
|
|
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
|
|
|
|
DSO_LDFLAGS={- join(' ', $target{dso_lflags} || (),
|
|
|
|
$target{module_ldflags} || (),
|
|
|
|
@{$config{dso_lflags}},
|
|
|
|
@{$config{module_ldflags}},
|
|
|
|
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
|
|
|
|
DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
|
|
|
|
BIN_ASFLAGS={- join(' ', $target{bin_asflags} || (),
|
|
|
|
@{$config{bin_asflags}},
|
|
|
|
'$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
|
|
|
|
BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
|
2020-01-04 13:39:50 +08:00
|
|
|
(map { '-D'.$_ } @{$config{bin_defines} || ()}),
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
@{$config{bin_cppflags}},
|
|
|
|
'$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
|
|
|
|
BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
|
|
|
|
@{$config{bin_cflags}},
|
|
|
|
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
|
|
|
|
BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
|
|
|
|
@{$config{bin_lflags}},
|
|
|
|
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
|
|
|
|
BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
|
|
|
|
|
|
|
|
# CPPFLAGS_Q is used for one thing only: to build up buildinf.h
|
|
|
|
CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
|
|
|
|
$cppflags2 =~ s|([\\"])|\\$1|g;
|
2018-03-09 19:39:01 +08:00
|
|
|
join(' ', $lib_cppflags || (), $cppflags2 || (),
|
|
|
|
$cppflags1 || ()) -}
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
|
2016-03-02 19:29:56 +08:00
|
|
|
PERLASM_SCHEME= {- $target{perlasm_scheme} -}
|
|
|
|
|
|
|
|
PROCESSOR= {- $config{processor} -}
|
|
|
|
|
|
|
|
# The main targets ###################################################
|
|
|
|
|
2020-02-17 22:20:57 +08:00
|
|
|
{- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep copy-utils
|
2017-04-22 21:06:35 +08:00
|
|
|
{- dependmagic('build_libs'); -}: build_libs_nodep
|
2019-01-31 07:06:50 +08:00
|
|
|
{- dependmagic('build_modules'); -}: build_modules_nodep
|
2017-04-22 21:06:35 +08:00
|
|
|
{- dependmagic('build_programs'); -}: build_programs_nodep
|
2016-03-02 19:29:56 +08:00
|
|
|
|
2016-09-01 04:57:25 +08:00
|
|
|
build_docs: build_html_docs
|
|
|
|
build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
|
2020-11-17 06:52:44 +08:00
|
|
|
@
|
2017-04-22 21:06:35 +08:00
|
|
|
build_generated: $(GENERATED_MANDATORY)
|
2020-11-17 06:52:44 +08:00
|
|
|
@
|
2018-10-23 20:36:23 +08:00
|
|
|
build_libs_nodep: $(LIBS) {- join(" ",map { platform->sharedlib_import($_) // () } @{$unified_info{libraries}}) -}
|
2020-11-17 06:52:44 +08:00
|
|
|
@
|
2019-01-31 07:06:50 +08:00
|
|
|
build_modules_nodep: $(MODULES)
|
2020-11-17 06:52:44 +08:00
|
|
|
@
|
2016-07-08 23:58:36 +08:00
|
|
|
build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
|
2020-11-17 06:52:44 +08:00
|
|
|
@
|
2016-03-02 19:29:56 +08:00
|
|
|
|
2016-07-08 23:58:36 +08:00
|
|
|
# Kept around for backward compatibility
|
|
|
|
build_apps build_tests: build_programs
|
|
|
|
|
2017-06-16 09:46:41 +08:00
|
|
|
# Convenience target to prebuild all generated files, not just the mandatory
|
|
|
|
# ones
|
2016-09-01 04:57:25 +08:00
|
|
|
build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
|
2021-07-12 13:29:02 +08:00
|
|
|
@{- output_off() if $disabled{makedepend}; "\@rem" -}
|
2018-07-10 20:12:33 +08:00
|
|
|
@$(ECHO) "Warning: consider configuring with no-makedepend, because if"
|
|
|
|
@$(ECHO) " target system doesn't have $(PERL),"
|
|
|
|
@$(ECHO) " then make will fail..."
|
2021-07-12 13:29:02 +08:00
|
|
|
@{- output_on() if $disabled{makedepend}; "\@rem" -}
|
2017-06-16 09:46:41 +08:00
|
|
|
|
2023-06-19 19:43:35 +08:00
|
|
|
all: build_sw {- "build_docs" if !$disabled{docs}; -}
|
2016-09-01 04:57:25 +08:00
|
|
|
|
2016-04-18 20:09:36 +08:00
|
|
|
test: tests
|
2020-02-17 22:20:57 +08:00
|
|
|
{- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep copy-utils
|
2023-12-05 16:26:36 +08:00
|
|
|
$(MAKE) /$(MAKEFLAGS) run_tests
|
|
|
|
run_tests:
|
2021-07-12 13:29:02 +08:00
|
|
|
@{- output_off() if $disabled{tests}; "\@rem" -}
|
2020-11-26 23:38:40 +08:00
|
|
|
cmd /C "set "SRCTOP=$(SRCDIR)" & set "BLDTOP=$(BLDDIR)" & set "PERL=$(PERL)" & set "FIPSKEY=$(FIPSKEY)" & "$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)"
|
2018-07-11 17:05:15 +08:00
|
|
|
@{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
|
2018-07-10 20:12:33 +08:00
|
|
|
@$(ECHO) "Tests are not supported with your chosen Configure options"
|
2021-07-12 13:29:02 +08:00
|
|
|
@{- output_on() if !$disabled{tests}; "\@rem" -}
|
2016-03-02 19:29:56 +08:00
|
|
|
|
|
|
|
list-tests:
|
2021-07-12 13:29:02 +08:00
|
|
|
@{- output_off() if $disabled{tests}; "\@rem" -}
|
2020-11-26 23:38:40 +08:00
|
|
|
@cmd /C "set "SRCTOP=$(SRCDIR)" & "$(PERL)" "$(SRCDIR)\test\run_tests.pl" list"
|
2018-07-11 17:05:15 +08:00
|
|
|
@{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
|
2018-07-10 20:12:33 +08:00
|
|
|
@$(ECHO) "Tests are not supported with your chosen Configure options"
|
2021-07-12 13:29:02 +08:00
|
|
|
@{- output_on() if !$disabled{tests}; "\@rem" -}
|
2016-03-02 19:29:56 +08:00
|
|
|
|
2023-06-19 19:43:35 +08:00
|
|
|
install: install_sw install_ssldirs {- "install_docs" if !$disabled{docs}; -} {- $disabled{fips} ? "" : "install_fips" -}
|
2016-03-17 17:08:25 +08:00
|
|
|
|
2023-06-19 19:43:35 +08:00
|
|
|
uninstall: {- "uninstall_docs" if !$disabled{docs}; -} uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -}
|
2016-03-17 17:08:25 +08:00
|
|
|
|
2016-03-10 08:51:53 +08:00
|
|
|
libclean:
|
2018-03-23 05:55:35 +08:00
|
|
|
"$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """{.,apps,test,fuzz}/$$1.*"""; } @ARGV" $(SHLIBS)
|
|
|
|
-del /Q /F $(LIBS) libcrypto.* libssl.* ossl_static.pdb
|
2016-03-10 08:51:53 +08:00
|
|
|
|
|
|
|
clean: libclean
|
2021-11-24 18:11:45 +08:00
|
|
|
{- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS1) || "\@rem" -}
|
|
|
|
{- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS3) || "\@rem" -}
|
|
|
|
{- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS5) || "\@rem" -}
|
|
|
|
{- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS7) || "\@rem" -}
|
2021-07-12 13:29:02 +08:00
|
|
|
{- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) || "\@rem" -}
|
|
|
|
{- join("\n\t", map { "-del /Q /F $_" } @MODULES) || "\@rem" -}
|
|
|
|
{- join("\n\t", map { "-del /Q /F $_" } @SCRIPTS) || "\@rem" -}
|
|
|
|
{- join("\n\t", map { "-del /Q /F $_" } @GENERATED_MANDATORY) || "\@rem" -}
|
|
|
|
{- join("\n\t", map { "-del /Q /F $_" } @GENERATED) || "\@rem" -}
|
2018-05-06 23:34:04 +08:00
|
|
|
-del /Q /S /F *.d *.obj *.pdb *.ilk *.manifest
|
|
|
|
-del /Q /S /F engines\*.lib engines\*.exp
|
|
|
|
-del /Q /S /F apps\*.lib apps\*.rc apps\*.res apps\*.exp
|
|
|
|
-del /Q /S /F test\*.exp
|
2021-06-03 22:28:21 +08:00
|
|
|
-rd /Q /S test\test-runs
|
2016-03-10 08:51:53 +08:00
|
|
|
|
2016-06-14 04:02:11 +08:00
|
|
|
distclean: clean
|
2022-05-24 23:20:52 +08:00
|
|
|
-del /Q /F include\openssl\configuration.h
|
2016-06-14 04:02:11 +08:00
|
|
|
-del /Q /F configdata.pm
|
|
|
|
-del /Q /F makefile
|
|
|
|
|
2022-02-23 18:00:39 +08:00
|
|
|
depend: makefile
|
2021-07-12 13:29:02 +08:00
|
|
|
@ {- output_off() if $disabled{makedepend}; "\@rem" -}
|
Configuration: rework how dependency making is handled
Previously, we had dependency making pretty much hard coded in the
build file templates, with a bit of an exception for Unix family
platforms, where we had different cases depending on what dependency
making program was found.
With the Embarcadero C++ builder, a separate scheme appeared, with a
different logic.
This change merges the two, and introduces two config target
attributes:
makedepcmd The program to use, where this is relevant.
This replaces the earlier configuration
attribute 'makedepprog'.
makedep_scheme This is a keyword that can be used by build
files templates to produce different sorts of
commands, but most importantly, to pass as
argument to util/add-depend.pl, which uses
this keyword as a "producer" for the
dependency lines.
If the config target doesn't define the 'makedep_scheme' attribute,
Configure tries to figure it out by looking for GCC compatible
compilers or for the 'makedepend' command.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/15006)
2021-04-26 15:17:05 +08:00
|
|
|
@ "$(PERL)" "$(SRCDIR)\util\add-depends.pl" "{- $target{makedep_scheme} -}"
|
2021-07-12 13:29:02 +08:00
|
|
|
@ {- output_on() if $disabled{makedepend}; "\@rem" -}
|
2016-03-02 19:29:56 +08:00
|
|
|
|
2016-03-17 17:08:25 +08:00
|
|
|
# Install helper targets #############################################
|
|
|
|
|
2020-04-17 21:38:45 +08:00
|
|
|
install_sw: install_dev install_engines install_modules install_runtime
|
2016-03-17 17:08:25 +08:00
|
|
|
|
2020-04-17 21:38:45 +08:00
|
|
|
uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev
|
2016-03-17 17:08:25 +08:00
|
|
|
|
2016-06-17 06:23:43 +08:00
|
|
|
install_docs: install_html_docs
|
2016-03-17 17:08:25 +08:00
|
|
|
|
2016-06-17 06:23:43 +08:00
|
|
|
uninstall_docs: uninstall_html_docs
|
2016-03-17 17:08:25 +08:00
|
|
|
|
2021-04-26 06:14:59 +08:00
|
|
|
{- output_off() if $disabled{fips}; "" -}
|
2021-08-03 17:35:58 +08:00
|
|
|
install_fips: build_sw $(INSTALL_FIPSMODULECONF)
|
2021-01-08 01:47:01 +08:00
|
|
|
# @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
|
2022-07-27 01:38:02 +08:00
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(MODULESDIR)"
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)"
|
2021-01-08 01:47:01 +08:00
|
|
|
@$(ECHO) "*** Installing FIPS module"
|
2021-05-24 20:24:32 +08:00
|
|
|
@$(ECHO) "install $(INSTALL_FIPSMODULE) -> $(MODULESDIR)\$(FIPSMODULENAME)"
|
2021-08-03 18:23:43 +08:00
|
|
|
@"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(INSTALL_FIPSMODULE)" "$(MODULESDIR)"
|
2020-09-30 00:31:44 +08:00
|
|
|
@$(ECHO) "*** Installing FIPS module configuration"
|
2021-05-24 20:24:32 +08:00
|
|
|
@$(ECHO) "install $(INSTALL_FIPSMODULECONF) -> $(OPENSSLDIR)\fipsmodule.cnf"
|
2021-08-03 18:23:43 +08:00
|
|
|
@"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(INSTALL_FIPSMODULECONF)" "$(OPENSSLDIR)"
|
2020-09-30 00:31:44 +08:00
|
|
|
|
2021-01-08 01:47:01 +08:00
|
|
|
uninstall_fips:
|
2020-09-30 00:31:44 +08:00
|
|
|
@$(ECHO) "*** Uninstalling FIPS module configuration"
|
2020-12-16 05:44:32 +08:00
|
|
|
$(RM) "$(OPENSSLDIR)\fipsmodule.cnf"
|
2021-01-08 01:47:01 +08:00
|
|
|
@$(ECHO) "*** Uninstalling FIPS module"
|
|
|
|
$(RM) "$(MODULESDIR)\$(FIPSMODULENAME)"
|
2021-04-26 06:14:59 +08:00
|
|
|
{- if ($disabled{fips}) { output_on(); } else { output_off(); } "" -}
|
|
|
|
install_fips:
|
|
|
|
@$(ECHO) "The 'install_fips' target requires the 'enable-fips' option"
|
|
|
|
|
|
|
|
uninstall_fips:
|
|
|
|
@$(ECHO) "The 'uninstall_fips' target requires the 'enable-fips' option"
|
|
|
|
{- output_on() if !$disabled{fips}; "" -}
|
2020-09-30 00:31:44 +08:00
|
|
|
|
2016-03-17 17:08:25 +08:00
|
|
|
install_ssldirs:
|
2016-06-28 19:20:21 +08:00
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\certs"
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\private"
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\misc"
|
2016-05-25 17:58:19 +08:00
|
|
|
@"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \
|
2016-08-02 05:18:25 +08:00
|
|
|
"$(OPENSSLDIR)\openssl.cnf.dist"
|
|
|
|
@IF NOT EXIST "$(OPENSSLDIR)\openssl.cnf" \
|
|
|
|
"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \
|
|
|
|
"$(OPENSSLDIR)\openssl.cnf"
|
2019-12-07 16:44:16 +08:00
|
|
|
@if not "$(MISC_SCRIPTS)"=="" \
|
|
|
|
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(MISC_SCRIPTS) \
|
2016-06-28 19:20:21 +08:00
|
|
|
"$(OPENSSLDIR)\misc"
|
2016-09-10 06:05:41 +08:00
|
|
|
@"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \
|
|
|
|
"$(OPENSSLDIR)\ct_log_list.cnf.dist"
|
|
|
|
@IF NOT EXIST "$(OPENSSLDIR)\ct_log_list.cnf" \
|
|
|
|
"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \
|
|
|
|
"$(OPENSSLDIR)\ct_log_list.cnf"
|
2016-03-17 17:08:25 +08:00
|
|
|
|
2018-10-25 15:09:20 +08:00
|
|
|
install_dev: install_runtime_libs
|
2018-07-10 20:12:33 +08:00
|
|
|
@if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 )
|
|
|
|
@$(ECHO) "*** Installing development files"
|
2016-06-28 19:20:21 +08:00
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\include\openssl"
|
2021-09-10 12:42:24 +08:00
|
|
|
@{- output_off() if $disabled{uplink}; "" -}
|
2016-07-15 03:11:46 +08:00
|
|
|
@"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\ms\applink.c" \
|
|
|
|
"$(INSTALLTOP)\include\openssl"
|
2021-09-10 12:42:24 +08:00
|
|
|
@{- output_on() if $disabled{uplink}; "" -}
|
2018-05-19 13:09:19 +08:00
|
|
|
@"$(PERL)" "$(SRCDIR)\util\copy.pl" "-exclude_re=/__DECC_" \
|
|
|
|
"$(SRCDIR)\include\openssl\*.h" \
|
2016-06-28 19:20:21 +08:00
|
|
|
"$(INSTALLTOP)\include\openssl"
|
2018-07-05 21:38:28 +08:00
|
|
|
@"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(BLDDIR)\include\openssl\*.h" \
|
2016-06-28 19:20:21 +08:00
|
|
|
"$(INSTALLTOP)\include\openssl"
|
2018-02-23 19:10:42 +08:00
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(libdir)"
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) "$(libdir)"
|
2016-05-13 00:08:21 +08:00
|
|
|
@if "$(SHLIBS)"=="" \
|
2018-02-23 19:10:42 +08:00
|
|
|
"$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb "$(libdir)"
|
Add exporters for CMake
CMake's older package finder, FindOpenSSL.cmake, does a best guess effort
and doesn't always get it right.
By CMake's own documentation, that's what such modules are (best effort
attempts), and package producers are (strongly) encouraged to help out by
producing and installing <PackageName>Config.cmake files to get a more
deterministic configuration.
The resulting OpenSSLConfig.cmake tries to mimic the result from CMake's
FindOpenSSL.cmake, by using the same variable and imported target names.
It also adds a few extra variables of its own, such as:
OPENSSL_MODULES_DIR Indicates the default installation directory
for OpenSSL loadable modules, such as providers.
OPENSSL_RUNTIME_DIR Indicates the default runtime directory, where
for example the openssl program is located.
OPENSSL_PROGRAM Is the full directory-and-filename of the
openssl program.
The imported targets OpenSSL::Crypto and OpenSSL::SSL are as precisely
specified as possible, so for example, they are specified with the both the
import library and the DLL on Windows, which should make life easier on that
platform.
For the moment, one of the following must be done in your CMake project for
this CMake configuration to take priority over CMake's FindOpenSSL.cmake:
- The variable CMAKE_FIND_PACKAGE_PREFER_CONFIG must be set to true prior
to the 'find_package(OpenSSL)' call.
- The 'find_package' call itself must use the "Full Signature". If you
don't know any better, simply add the 'CONFIG' option, i.e. from this
example:
find_package(OpenSSL 3.0 REQUIRED)
to this:
find_package(OpenSSL 3.0 REQUIRED CONFIG)
Just as with the 'pkg-config' exporters, two variants of the .cmake files
are produced:
- Those in 'exporters/' are installed in the location that 'pkg-config'
itself prefers for installed packages.
- Those in the top directory are to be used when it's desirable to build
directly against an OpenSSL build tree.
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20878)
2023-05-03 18:36:09 +08:00
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(CMAKECONFIGDIR)"
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_EXPORTERS_CMAKE) "$(CMAKECONFIGDIR)"
|
2016-03-17 17:08:25 +08:00
|
|
|
|
|
|
|
uninstall_dev:
|
|
|
|
|
2020-04-17 21:38:45 +08:00
|
|
|
_install_modules_deps: install_runtime_libs build_modules
|
|
|
|
|
|
|
|
install_engines: _install_modules_deps
|
2018-07-10 20:12:33 +08:00
|
|
|
@if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 )
|
2020-04-17 21:38:45 +08:00
|
|
|
@$(ECHO) "*** Installing engines"
|
2016-06-28 19:20:21 +08:00
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(ENGINESDIR)"
|
2019-01-31 07:06:50 +08:00
|
|
|
@if not "$(INSTALL_ENGINES)"=="" \
|
2016-07-08 20:52:09 +08:00
|
|
|
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINES) "$(ENGINESDIR)"
|
2019-01-31 07:06:50 +08:00
|
|
|
@if not "$(INSTALL_ENGINES)"=="" \
|
2016-07-08 20:52:09 +08:00
|
|
|
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINEPDBS) "$(ENGINESDIR)"
|
2016-03-17 17:08:25 +08:00
|
|
|
|
|
|
|
uninstall_engines:
|
|
|
|
|
2020-04-17 21:38:45 +08:00
|
|
|
install_modules: _install_modules_deps
|
|
|
|
@if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 )
|
|
|
|
@$(ECHO) "*** Installing modules"
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(MODULESDIR)"
|
|
|
|
@if not "$(INSTALL_MODULES)"=="" \
|
|
|
|
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_MODULES) "$(MODULESDIR)"
|
|
|
|
@if not "$(INSTALL_MODULES)"=="" \
|
|
|
|
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_MODULEPDBS) "$(MODULESDIR)"
|
|
|
|
|
|
|
|
uninstall_modules:
|
|
|
|
|
2018-10-25 15:09:20 +08:00
|
|
|
install_runtime: install_programs
|
|
|
|
|
2018-11-07 23:13:57 +08:00
|
|
|
install_runtime_libs: build_libs
|
2018-07-10 20:12:33 +08:00
|
|
|
@if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 )
|
2018-10-25 15:09:20 +08:00
|
|
|
@$(ECHO) "*** Installing runtime libraries"
|
2016-06-28 19:20:21 +08:00
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin"
|
2016-03-17 17:08:25 +08:00
|
|
|
@if not "$(SHLIBS)"=="" \
|
2016-07-08 20:52:09 +08:00
|
|
|
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBS) "$(INSTALLTOP)\bin"
|
2016-05-13 00:08:21 +08:00
|
|
|
@if not "$(SHLIBS)"=="" \
|
2016-07-08 20:52:09 +08:00
|
|
|
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBPDBS) \
|
2016-06-28 19:20:21 +08:00
|
|
|
"$(INSTALLTOP)\bin"
|
2018-10-25 15:09:20 +08:00
|
|
|
|
2018-11-07 23:13:57 +08:00
|
|
|
install_programs: install_runtime_libs build_programs
|
2018-10-25 15:09:20 +08:00
|
|
|
@if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 )
|
|
|
|
@$(ECHO) "*** Installing runtime programs"
|
2019-12-07 16:44:16 +08:00
|
|
|
@if not "$(INSTALL_PROGRAMS)"=="" \
|
|
|
|
"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin"
|
|
|
|
@if not "$(INSTALL_PROGRAMS)"=="" \
|
|
|
|
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \
|
2016-06-28 19:20:21 +08:00
|
|
|
"$(INSTALLTOP)\bin"
|
2019-12-07 16:44:16 +08:00
|
|
|
@if not "$(INSTALL_PROGRAMS)"=="" \
|
|
|
|
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \
|
2016-06-28 19:20:21 +08:00
|
|
|
"$(INSTALLTOP)\bin"
|
2019-12-07 16:44:16 +08:00
|
|
|
@if not "$(INSTALL_PROGRAMS)"=="" \
|
|
|
|
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BIN_SCRIPTS) \
|
2016-06-28 19:20:21 +08:00
|
|
|
"$(INSTALLTOP)\bin"
|
2016-03-17 17:08:25 +08:00
|
|
|
|
|
|
|
uninstall_runtime:
|
|
|
|
|
2021-05-21 13:24:57 +08:00
|
|
|
install_html_docs: install_image_docs build_html_docs
|
2016-09-01 04:57:25 +08:00
|
|
|
@if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
|
|
|
|
@echo *** Installing HTML docs
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man1"
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man3"
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man5"
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man7"
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man1\*.html \
|
|
|
|
"$(INSTALLTOP)\html\man1"
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man3\*.html \
|
|
|
|
"$(INSTALLTOP)\html\man3"
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man5\*.html \
|
|
|
|
"$(INSTALLTOP)\html\man5"
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man7\*.html \
|
|
|
|
"$(INSTALLTOP)\html\man7"
|
2016-06-17 06:23:43 +08:00
|
|
|
|
2021-05-21 13:24:57 +08:00
|
|
|
uninstall_html_docs: uninstall_image_docs
|
|
|
|
|
|
|
|
install_image_docs:
|
|
|
|
@if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
|
|
|
|
@echo *** Installing HTML images
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man7\img"
|
|
|
|
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(SRCDIR)\doc\man7\img\*.png \
|
|
|
|
"$(INSTALLTOP)\html\man7\img"
|
|
|
|
|
|
|
|
uninstall_image_docs:
|
2016-06-17 06:23:43 +08:00
|
|
|
|
2020-02-17 22:20:57 +08:00
|
|
|
# Helper targets #####################################################
|
|
|
|
|
2021-06-16 16:32:43 +08:00
|
|
|
copy-utils: $(BLDDIR)\apps\openssl.cnf
|
2020-02-17 22:20:57 +08:00
|
|
|
|
2022-02-23 18:00:39 +08:00
|
|
|
$(BLDDIR)\apps\openssl.cnf: makefile
|
2021-02-09 07:16:55 +08:00
|
|
|
@if NOT EXIST "$(BLDDIR)\apps" mkdir "$(BLDDIR)\apps"
|
|
|
|
@if NOT "$(SRCDIR)"=="$(BLDDIR)" copy "$(SRCDIR)\apps\$(@F)" "$(BLDDIR)\apps"
|
|
|
|
|
2016-03-02 19:29:56 +08:00
|
|
|
# Building targets ###################################################
|
|
|
|
|
2022-02-23 18:00:39 +08:00
|
|
|
makefile: configdata.pm {- join(" ", map { '"'.$_.'"' } @{$config{build_file_templates}}) -}
|
|
|
|
@$(ECHO) "Detected changed: $?"
|
|
|
|
"$(PERL)" configdata.pm
|
|
|
|
@$(ECHO) "**************************************************"
|
|
|
|
@$(ECHO) "*** ***"
|
|
|
|
@$(ECHO) "*** Please run the same make command again ***"
|
|
|
|
@$(ECHO) "*** ***"
|
|
|
|
@$(ECHO) "**************************************************"
|
|
|
|
@exit 1
|
|
|
|
|
|
|
|
configdata.pm: "$(SRCDIR)\Configure" {- join(" ", map { '"'.$_.'"' } @{$config{build_infos}}, @{$config{conf_files}}) -}
|
2018-07-10 20:12:33 +08:00
|
|
|
@$(ECHO) "Detected changed: $?"
|
2018-02-03 03:33:13 +08:00
|
|
|
"$(PERL)" configdata.pm -r
|
2018-07-10 20:12:33 +08:00
|
|
|
@$(ECHO) "**************************************************"
|
|
|
|
@$(ECHO) "*** ***"
|
|
|
|
@$(ECHO) "*** Please run the same make command again ***"
|
|
|
|
@$(ECHO) "*** ***"
|
|
|
|
@$(ECHO) "**************************************************"
|
2016-03-24 03:33:29 +08:00
|
|
|
@exit 1
|
2016-03-02 19:29:56 +08:00
|
|
|
|
2018-01-30 06:17:43 +08:00
|
|
|
reconfigure reconf:
|
2018-02-03 03:33:13 +08:00
|
|
|
"$(PERL)" configdata.pm -r
|
2018-01-30 06:17:43 +08:00
|
|
|
|
2016-03-02 19:29:56 +08:00
|
|
|
{-
|
|
|
|
use File::Basename;
|
2020-11-16 04:57:49 +08:00
|
|
|
use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs file_name_is_absolute/;
|
2016-03-02 19:29:56 +08:00
|
|
|
|
2021-05-24 20:19:38 +08:00
|
|
|
# Helper function to convert dependencies in platform agnostic form to
|
|
|
|
# dependencies in platform form.
|
|
|
|
sub compute_platform_depends {
|
|
|
|
map { my $x = $_;
|
|
|
|
|
|
|
|
grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x)
|
|
|
|
or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x)
|
|
|
|
or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x)
|
|
|
|
or platform->convertext($x); } @_;
|
|
|
|
}
|
|
|
|
|
2016-03-02 19:29:56 +08:00
|
|
|
# Helper function to figure out dependencies on libraries
|
|
|
|
# It takes a list of library names and outputs a list of dependencies
|
|
|
|
sub compute_lib_depends {
|
|
|
|
if ($disabled{shared}) {
|
2018-10-23 20:36:23 +08:00
|
|
|
return map { platform->staticlib($_) } @_;
|
2016-03-02 19:29:56 +08:00
|
|
|
}
|
2018-10-23 20:36:23 +08:00
|
|
|
return map { platform->sharedlib_import($_) // platform->staticlib($_) } @_;
|
2016-03-02 19:29:56 +08:00
|
|
|
}
|
|
|
|
|
2021-02-25 23:55:39 +08:00
|
|
|
sub generatetarget {
|
|
|
|
my %args = @_;
|
2021-05-24 20:19:38 +08:00
|
|
|
my $deps = join(" ", compute_platform_depends(@{$args{deps}}));
|
2021-02-25 23:55:39 +08:00
|
|
|
return <<"EOF";
|
|
|
|
$args{target}: $deps
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2020-11-27 22:22:38 +08:00
|
|
|
# This function (and the next) avoids quoting paths of generated dependencies
|
|
|
|
# (in the build tree), but quotes paths of non-generated dependencies (in the
|
|
|
|
# source tree). This is a workaround for a limitation of C++Builder's make.exe
|
|
|
|
# in handling quoted paths: https://quality.embarcadero.com/browse/RSP-31756
|
2016-03-07 21:12:45 +08:00
|
|
|
sub generatesrc {
|
|
|
|
my %args = @_;
|
2021-02-26 00:43:57 +08:00
|
|
|
my $gen0 = $args{generator}->[0];
|
|
|
|
my $gen_args = join('', map { " $_" }
|
|
|
|
@{$args{generator}}[1..$#{$args{generator}}]);
|
2020-11-07 22:11:05 +08:00
|
|
|
my $gen_incs = join("", map { " -I\"$_\"" } @{$args{generator_incs}});
|
|
|
|
my $incs = join("", map { " -I\"$_\"" } @{$args{incs}});
|
2019-10-20 15:09:56 +08:00
|
|
|
my $defs = join("", map { " -D".$_ } @{$args{defs}});
|
2021-05-24 20:19:38 +08:00
|
|
|
my $deps = join(' ',
|
|
|
|
map { file_name_is_absolute($_) || ($_ =~ m|^../|) ? "\"$_\"" : $_ }
|
|
|
|
compute_platform_depends(@{$args{generator_deps}},
|
|
|
|
@{$args{deps}}));
|
2016-03-07 21:12:45 +08:00
|
|
|
|
2016-09-01 04:57:25 +08:00
|
|
|
if ($args{src} =~ /\.html$/) {
|
2021-02-26 00:43:57 +08:00
|
|
|
#
|
|
|
|
# HTML generator
|
|
|
|
#
|
|
|
|
my $title = basename($args{src}, ".html");
|
|
|
|
my $pod = $gen0;
|
|
|
|
return <<"EOF";
|
2020-01-15 15:28:46 +08:00
|
|
|
$args{src}: "$pod"
|
2021-04-29 18:50:33 +08:00
|
|
|
"\$(PERL)" "\$(SRCDIR)/util/mkpod2html.pl" -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
|
2016-09-01 04:57:25 +08:00
|
|
|
EOF
|
|
|
|
} elsif (platform->isdef($args{src})) {
|
2021-02-26 00:43:57 +08:00
|
|
|
#
|
|
|
|
# Linker script-ish generator
|
|
|
|
#
|
2018-10-23 20:36:23 +08:00
|
|
|
my $target = platform->def($args{src});
|
2018-09-30 20:44:59 +08:00
|
|
|
my $mkdef = abs2rel(rel2abs(catfile($config{sourcedir},
|
|
|
|
"util", "mkdef.pl")),
|
|
|
|
rel2abs($config{builddir}));
|
2021-09-08 15:40:37 +08:00
|
|
|
my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : '';
|
2018-10-04 23:41:12 +08:00
|
|
|
my $ord_name =
|
2022-07-06 12:54:49 +08:00
|
|
|
$args{generator}->[1] || basename(platform->dsoname($args{product}));
|
2018-09-30 20:44:59 +08:00
|
|
|
return <<"EOF";
|
2021-02-26 00:43:57 +08:00
|
|
|
$target: $gen0 $deps $mkdef
|
2022-05-10 20:39:19 +08:00
|
|
|
"\$(PERL)" "$mkdef"$ord_ver --type $args{intent} --ordinals $gen0 --name $ord_name --OS windows > $target
|
2016-06-14 04:02:11 +08:00
|
|
|
EOF
|
2022-11-03 22:24:52 +08:00
|
|
|
} elsif (platform->isasm($args{src})
|
|
|
|
|| platform->iscppasm($args{src})) {
|
2021-02-26 00:43:57 +08:00
|
|
|
#
|
|
|
|
# Assembler generator
|
|
|
|
#
|
2019-09-13 05:58:07 +08:00
|
|
|
my $cppflags = {
|
|
|
|
shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
|
|
|
|
lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
|
|
|
|
dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
|
|
|
|
bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
|
|
|
|
} -> {$args{intent}};
|
2022-11-03 22:24:52 +08:00
|
|
|
my $target = platform->isasm($args{src})
|
|
|
|
? platform->asm($args{src})
|
|
|
|
: $args{src};
|
2019-09-13 05:58:07 +08:00
|
|
|
|
2021-02-26 00:43:57 +08:00
|
|
|
my $generator;
|
|
|
|
if ($gen0 =~ /\.pl$/) {
|
2022-04-14 06:14:33 +08:00
|
|
|
$generator = '"$(PERL)"'.$gen_incs.' "'.$gen0.'"'.$gen_args
|
2023-05-09 17:50:06 +08:00
|
|
|
.' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)';
|
2021-02-26 00:43:57 +08:00
|
|
|
} elsif ($gen0 =~ /\.S$/) {
|
2016-03-07 21:12:45 +08:00
|
|
|
$generator = undef;
|
|
|
|
} else {
|
2021-02-26 00:43:57 +08:00
|
|
|
die "Generator type for $src unknown: $gen0\n";
|
2016-03-07 21:12:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (defined($generator)) {
|
|
|
|
return <<"EOF";
|
2021-02-26 00:43:57 +08:00
|
|
|
$target: "$gen0" $deps
|
2020-11-26 23:38:40 +08:00
|
|
|
cmd /C "set "ASM=\$(AS)" & $generator \$@"
|
2016-03-07 21:12:45 +08:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
return <<"EOF";
|
2021-02-26 00:43:57 +08:00
|
|
|
$target: "$gen0" $deps
|
2022-10-28 02:07:48 +08:00
|
|
|
\$(CPP) /D__ASSEMBLER__ $incs $cppflags $defs "$gen0" > \$@.i
|
2020-11-07 20:52:30 +08:00
|
|
|
move /Y \$@.i \$@
|
2021-02-26 00:43:57 +08:00
|
|
|
EOF
|
|
|
|
} elsif ($gen0 =~ m|^.*\.in$|) {
|
|
|
|
#
|
|
|
|
# "dofile" generator (file.in -> file)
|
|
|
|
#
|
|
|
|
my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
|
|
|
|
"util", "dofile.pl")),
|
|
|
|
rel2abs($config{builddir}));
|
build.info: Introduce special syntax for dependencies on script modules
The DEPEND statement, when applied on files generated with GENERATE, may
be used to specify script modules that the template to be generated from
depends on. In short, this sort of depend:
DEPEND[generated]=util/perl/OpenSSL/something.pm
... would generate a perl run that has the inclusion directory
'util/perl/OpenSSL' and 'something' as the module to be loaded. However,
the package name for this module is 'OpenSSL::something', so to load it the
way it's expected, the inclusion directory should be 'util/perl', and the
module to be loaded should be specified as 'OpenSSL/something' (to be
massaged into a proper module name by the build file template).
To allow this, we introduce a file syntax, where a single '|' is used as a
directory separator, to delineate what part should be used as the inclustion
directory, and which part the module name to be loaded should be derived
from:
DEPEND[generated]=util/perl|OpenSSL/something.pm
Fixes #21112
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21117)
2023-06-02 20:32:07 +08:00
|
|
|
my @perlmodules = ();
|
|
|
|
my %perlmoduleincs = ();
|
|
|
|
my %perlmoduledeps = ();
|
|
|
|
foreach my $x (('configdata.pm', @{$args{deps}})) {
|
|
|
|
# Compute (i)nclusion directory, (m)odule name and (d)ependency
|
|
|
|
my $i, $m, $d;
|
|
|
|
if ($x =~ /\|/) {
|
|
|
|
$i = $`;
|
|
|
|
$d = $';
|
|
|
|
|
|
|
|
# Massage the module part to become a real perl module spec
|
|
|
|
$m = $d;
|
|
|
|
$m =~ s|\.pm$||;
|
|
|
|
# Directory specs are :: in perl package names
|
|
|
|
$m =~ s|/|::|g;
|
|
|
|
|
|
|
|
# Full file name of the dependency
|
|
|
|
$d = catfile($i, $d) if $i;
|
|
|
|
} elsif ($x =~ /\.pm$/) {
|
|
|
|
$i = dirname($x);
|
|
|
|
$m = basename($x, '.pm');
|
|
|
|
$d = $x;
|
|
|
|
} else {
|
|
|
|
# All other dependencies are simply collected
|
|
|
|
$d = $x;
|
|
|
|
}
|
|
|
|
push @perlmodules, '"-M'.$m.'"' if $m;
|
|
|
|
$perlmoduledeps{$d} = 1;
|
|
|
|
$perlmoduleincs{'"-I'.$i.'"'} = 1 if $i;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Because of the special treatment of dependencies, we need to
|
|
|
|
# recompute $deps completely
|
|
|
|
my $deps
|
|
|
|
= join(" ", compute_platform_depends(@{$args{generator_deps}},
|
|
|
|
sort keys %perlmoduledeps));
|
|
|
|
my $perlmodules = join(' ', '', ( sort keys %perlmoduleincs ), @perlmodules);
|
|
|
|
|
2021-02-26 00:43:57 +08:00
|
|
|
return <<"EOF";
|
|
|
|
$args{src}: "$gen0" $deps
|
2021-05-24 20:19:38 +08:00
|
|
|
"\$(PERL)"$perlmodules "$dofile" "-o$target{build_file}" "$gen0"$gen_args > \$@
|
2021-02-26 00:43:57 +08:00
|
|
|
EOF
|
|
|
|
} elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
|
|
|
|
#
|
|
|
|
# Generic generator using OpenSSL programs
|
|
|
|
#
|
|
|
|
|
2021-05-24 20:19:38 +08:00
|
|
|
# Redo $gen0, to ensure that we have the proper extension.
|
2021-02-26 00:43:57 +08:00
|
|
|
$gen0 = platform->bin($gen0);
|
|
|
|
return <<"EOF";
|
2021-04-15 02:23:43 +08:00
|
|
|
$args{src}: $gen0 $deps "\$(BLDDIR)\\util\\wrap.pl"
|
2022-04-14 06:14:33 +08:00
|
|
|
"\$(PERL)" "\$(BLDDIR)\\util\\wrap.pl" "$gen0"$gen_args > \$@
|
2021-02-26 00:43:57 +08:00
|
|
|
EOF
|
|
|
|
} else {
|
|
|
|
#
|
|
|
|
# Generic generator using Perl
|
|
|
|
#
|
|
|
|
return <<"EOF";
|
|
|
|
$args{src}: "$gen0" $deps
|
2022-04-14 06:14:33 +08:00
|
|
|
"\$(PERL)"$gen_incs "$gen0"$gen_args > \$@
|
2016-03-07 21:12:45 +08:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-02 19:29:56 +08:00
|
|
|
sub src2obj {
|
2019-03-19 21:43:31 +08:00
|
|
|
my $asmext = platform->asmext();
|
2016-03-02 19:29:56 +08:00
|
|
|
my %args = @_;
|
2019-03-19 21:43:31 +08:00
|
|
|
my @srcs =
|
|
|
|
map { my $x = $_;
|
|
|
|
(platform->isasm($x) && grep { $x eq $_ } @generated)
|
|
|
|
? platform->asm($x) : $x }
|
|
|
|
( @{$args{srcs}} );
|
2016-05-25 17:58:19 +08:00
|
|
|
my $srcs = '"'.join('" "', @srcs).'"';
|
2020-11-16 04:57:49 +08:00
|
|
|
my $deps = join(' ',
|
|
|
|
map { file_name_is_absolute($_) || ($_ =~ m|^../|) ? "\"$_\"" : $_ }
|
|
|
|
(@srcs, @{$args{deps}}));
|
2020-11-07 22:11:05 +08:00
|
|
|
my $incs = join("", map { ' -I"'.$_.'"' } @{$args{incs}});
|
2019-10-20 15:09:56 +08:00
|
|
|
my $defs = join("", map { " -D".$_ } @{$args{defs}});
|
2018-09-10 08:28:39 +08:00
|
|
|
my $cflags = { shlib => ' $(LIB_CFLAGS)',
|
|
|
|
lib => ' $(LIB_CFLAGS)',
|
Harmonize the make variables across all known platforms families
The make variables LIB_CFLAGS, DSO_CFLAGS and so on were used in
addition to CFLAGS and so on. This works without problem on Unix and
Windows, where options with different purposes (such as -D and -I) can
appear anywhere on the command line and get accumulated as they come.
This is not necessarely so on VMS. For example, macros must all be
collected and given through one /DEFINE, and the same goes for
inclusion directories (/INCLUDE).
So, to harmonize all platforms, we repurpose make variables starting
with LIB_, DSO_ and BIN_ to be all encompassing variables that
collects the corresponding values from CFLAGS, CPPFLAGS, DEFINES,
INCLUDES and so on together with possible config target values
specific for libraries DSOs and programs, and use them instead of the
general ones everywhere.
This will, for example, allow VMS to use the exact same generators for
generated files that go through cpp as all other platforms, something
that has been impossible to do safely before now.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5357)
2018-02-14 03:32:42 +08:00
|
|
|
dso => ' $(DSO_CFLAGS)',
|
|
|
|
bin => ' $(BIN_CFLAGS)' } -> {$args{intent}};
|
2018-01-23 20:54:55 +08:00
|
|
|
$cflags .= $incs;
|
2018-09-10 08:28:39 +08:00
|
|
|
$cflags .= { shlib => ' $(LIB_CPPFLAGS)',
|
|
|
|
lib => ' $(LIB_CPPFLAGS)',
|
2018-01-23 20:54:55 +08:00
|
|
|
dso => ' $(DSO_CPPFLAGS)',
|
|
|
|
bin => ' $(BIN_CPPFLAGS)' } -> {$args{intent}};
|
2018-09-10 08:28:39 +08:00
|
|
|
my $asflags = { shlib => ' $(LIB_ASFLAGS)',
|
|
|
|
lib => ' $(LIB_ASFLAGS)',
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
dso => ' $(DSO_ASFLAGS)',
|
|
|
|
bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}};
|
Configuration: rework how dependency making is handled
Previously, we had dependency making pretty much hard coded in the
build file templates, with a bit of an exception for Unix family
platforms, where we had different cases depending on what dependency
making program was found.
With the Embarcadero C++ builder, a separate scheme appeared, with a
different logic.
This change merges the two, and introduces two config target
attributes:
makedepcmd The program to use, where this is relevant.
This replaces the earlier configuration
attribute 'makedepprog'.
makedep_scheme This is a keyword that can be used by build
files templates to produce different sorts of
commands, but most importantly, to pass as
argument to util/add-depend.pl, which uses
this keyword as a "producer" for the
dependency lines.
If the config target doesn't define the 'makedep_scheme' attribute,
Configure tries to figure it out by looking for GCC compatible
compilers or for the 'makedepend' command.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/15006)
2021-04-26 15:17:05 +08:00
|
|
|
my $makedepcmd = $config{makedepcmd} unless $disabled{makedepend};
|
2017-12-04 21:27:58 +08:00
|
|
|
if ($srcs[0] =~ /\.rc$/) {
|
2018-10-23 20:36:23 +08:00
|
|
|
my $res = platform->res($args{obj});
|
2017-12-04 21:27:58 +08:00
|
|
|
return <<"EOF";
|
2018-10-23 20:36:23 +08:00
|
|
|
$res: $deps
|
2019-04-21 19:14:34 +08:00
|
|
|
\$(RC) \$(RCFLAGS) \$(RCOUTFLAG)\$\@ $srcs
|
2017-12-04 21:27:58 +08:00
|
|
|
EOF
|
|
|
|
}
|
2018-10-23 20:36:23 +08:00
|
|
|
my $obj = platform->obj($args{obj});
|
2019-01-22 19:17:36 +08:00
|
|
|
my $dep = platform->dep($args{obj});
|
2019-03-19 21:43:31 +08:00
|
|
|
if ($srcs[0] =~ /\Q${asmext}\E$/) {
|
2016-03-02 19:29:56 +08:00
|
|
|
return <<"EOF";
|
2018-10-23 20:36:23 +08:00
|
|
|
$obj: $deps
|
Make "make variables" config attributes for overridable flags
With the support of "make variables" comes the possibility for the
user to override them. However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).
Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.
We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
2018-03-07 03:35:30 +08:00
|
|
|
\$(AS) $asflags \$(ASOUTFLAG)\$\@ $srcs
|
2018-04-11 16:11:07 +08:00
|
|
|
EOF
|
|
|
|
} elsif ($srcs[0] =~ /.S$/) {
|
|
|
|
return <<"EOF";
|
2018-10-23 20:36:23 +08:00
|
|
|
$obj: $deps
|
2020-11-07 20:52:30 +08:00
|
|
|
\$(CC) /EP -D__ASSEMBLER__ $cflags $defs $srcs > \$@.asm
|
|
|
|
\$(AS) $asflags \$(ASOUTFLAG)\$\@ \$@.asm
|
2016-03-02 19:29:56 +08:00
|
|
|
EOF
|
|
|
|
}
|
2018-10-23 16:35:48 +08:00
|
|
|
my $recipe = <<"EOF";
|
2018-10-23 20:36:23 +08:00
|
|
|
$obj: $deps
|
2016-10-14 23:10:05 +08:00
|
|
|
\$(CC) $cflags $defs -c \$(COUTFLAG)\$\@ $srcs
|
2016-03-02 19:29:56 +08:00
|
|
|
EOF
|
2018-10-23 16:35:48 +08:00
|
|
|
$recipe .= <<"EOF" unless $disabled{makedepend};
|
Configuration: rework how dependency making is handled
Previously, we had dependency making pretty much hard coded in the
build file templates, with a bit of an exception for Unix family
platforms, where we had different cases depending on what dependency
making program was found.
With the Embarcadero C++ builder, a separate scheme appeared, with a
different logic.
This change merges the two, and introduces two config target
attributes:
makedepcmd The program to use, where this is relevant.
This replaces the earlier configuration
attribute 'makedepprog'.
makedep_scheme This is a keyword that can be used by build
files templates to produce different sorts of
commands, but most importantly, to pass as
argument to util/add-depend.pl, which uses
this keyword as a "producer" for the
dependency lines.
If the config target doesn't define the 'makedep_scheme' attribute,
Configure tries to figure it out by looking for GCC compatible
compilers or for the 'makedepend' command.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/15006)
2021-04-26 15:17:05 +08:00
|
|
|
cmd /C "$makedepcmd $cflags $defs $srcs > $dep 2>&1"
|
2018-10-23 16:35:48 +08:00
|
|
|
EOF
|
|
|
|
return $recipe;
|
2016-03-02 19:29:56 +08:00
|
|
|
}
|
|
|
|
|
2018-10-21 17:03:02 +08:00
|
|
|
# We *know* this routine is only called when we've configure 'shared'.
|
|
|
|
# Also, note that even though the import library built here looks like
|
|
|
|
# a static library, it really isn't.
|
2018-09-12 16:59:06 +08:00
|
|
|
sub obj2shlib {
|
2016-03-02 19:29:56 +08:00
|
|
|
my %args = @_;
|
|
|
|
my $lib = $args{lib};
|
2018-10-23 20:36:23 +08:00
|
|
|
my @objs = map { platform->convertext($_) }
|
2020-12-09 08:29:14 +08:00
|
|
|
grep { platform->isobj($_) }
|
|
|
|
@{$args{objs}};
|
|
|
|
my @ress = map { platform->convertext($_) }
|
|
|
|
grep { platform->isres($_) }
|
2017-12-04 21:27:58 +08:00
|
|
|
@{$args{objs}};
|
2018-10-23 20:36:23 +08:00
|
|
|
my @defs = map { platform->def($_) }
|
|
|
|
grep { platform->isdef($_) }
|
2018-09-30 20:44:59 +08:00
|
|
|
@{$args{objs}};
|
2017-12-04 21:27:58 +08:00
|
|
|
my @deps = compute_lib_depends(@{$args{deps}});
|
|
|
|
die "More than one exported symbols list" if scalar @defs > 1;
|
2020-11-20 01:57:46 +08:00
|
|
|
my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps);
|
|
|
|
my $objs = join($target{ld_resp_delim}, @objs);
|
2020-12-09 08:29:14 +08:00
|
|
|
my $ress = join($target{ld_resp_delim}, @ress);
|
|
|
|
my $deps = join(" ", @objs, @ress, @defs, @deps);
|
2018-10-23 20:36:23 +08:00
|
|
|
my $import = platform->sharedlib_import($lib);
|
|
|
|
my $dll = platform->sharedlib($lib);
|
2020-12-09 08:29:14 +08:00
|
|
|
my $shared_def = $target{lddefflag} . join("", @defs);
|
2020-12-07 07:04:45 +08:00
|
|
|
my $implib_rule = $target{ld_implib_rule} || "";
|
|
|
|
my $implib_flag = $target{ld_implib_flag}
|
|
|
|
? "$target{ld_implib_flag}$import"
|
|
|
|
: "";
|
2016-03-02 19:29:56 +08:00
|
|
|
return <<"EOF"
|
2018-10-21 17:03:02 +08:00
|
|
|
# The import library may look like a static library, but it is not.
|
|
|
|
# We MUST make the import library depend on the DLL, in case someone
|
|
|
|
# mistakenly removes the latter.
|
|
|
|
$import: $dll
|
2020-12-07 07:04:45 +08:00
|
|
|
$implib_rule
|
2018-10-21 17:03:02 +08:00
|
|
|
$dll: $deps
|
|
|
|
IF EXIST $full.manifest DEL /F /Q $full.manifest
|
2018-05-14 23:06:04 +08:00
|
|
|
IF EXIST \$@ DEL /F /Q \$@
|
2020-12-14 02:01:46 +08:00
|
|
|
cmd /C "\$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) @<< $implib_flag || (DEL /Q \$(\@B).* $import & EXIT 1)"
|
2020-12-09 08:29:14 +08:00
|
|
|
$objs$target{ld_resp_delim}\$(LDOUTFLAG)$dll$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(LIB_EX_LIBS)$target{ld_resp_delim}$shared_def$target{ldresflag}$ress
|
2016-03-02 19:29:56 +08:00
|
|
|
<<
|
2018-10-21 17:03:02 +08:00
|
|
|
IF EXIST $dll.manifest \\
|
|
|
|
\$(MT) \$(MTFLAGS) \$(MTINFLAG)$dll.manifest \$(MTOUTFLAG)$dll
|
|
|
|
IF EXIST apps\\$dll DEL /Q /F apps\\$dll
|
|
|
|
IF EXIST test\\$dll DEL /Q /F test\\$dll
|
|
|
|
IF EXIST fuzz\\$dll DEL /Q /F fuzz\\$dll
|
|
|
|
COPY $dll apps
|
|
|
|
COPY $dll test
|
|
|
|
COPY $dll fuzz
|
2016-03-02 19:29:56 +08:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
sub obj2dso {
|
|
|
|
my %args = @_;
|
2019-10-04 05:30:58 +08:00
|
|
|
my $dso = platform->dso($args{module});
|
|
|
|
my $dso_n = platform->dsoname($args{module});
|
2018-10-23 20:36:23 +08:00
|
|
|
my @objs = map { platform->convertext($_) }
|
2020-12-09 08:29:14 +08:00
|
|
|
grep { platform->isobj($_) }
|
|
|
|
@{$args{objs}};
|
|
|
|
my @ress = map { platform->convertext($_) }
|
|
|
|
grep { platform->isres($_) }
|
2018-10-04 23:41:12 +08:00
|
|
|
@{$args{objs}};
|
2018-10-23 20:36:23 +08:00
|
|
|
my @defs = map { platform->def($_) }
|
|
|
|
grep { platform->isdef($_) }
|
2018-10-04 23:41:12 +08:00
|
|
|
@{$args{objs}};
|
2017-12-04 21:27:58 +08:00
|
|
|
my @deps = compute_lib_depends(@{$args{deps}});
|
2020-12-09 08:29:14 +08:00
|
|
|
die "More than one exported symbols list" if scalar @defs > 1;
|
2020-11-20 01:57:46 +08:00
|
|
|
my $objs = join($target{ld_resp_delim}, @objs);
|
2020-12-09 08:29:14 +08:00
|
|
|
my $ress = join($target{ld_resp_delim}, @ress);
|
2020-11-20 01:57:46 +08:00
|
|
|
my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps);
|
2020-12-09 08:29:14 +08:00
|
|
|
my $deps = join(" ", @objs, @ress, @defs, @deps);
|
|
|
|
my $shared_def = $target{lddefflag} . join("", @defs);
|
2016-03-02 19:29:56 +08:00
|
|
|
return <<"EOF";
|
2018-10-23 20:36:23 +08:00
|
|
|
$dso: $deps
|
|
|
|
IF EXIST $dso.manifest DEL /F /Q $dso.manifest
|
2020-12-14 02:01:46 +08:00
|
|
|
cmd /C "\$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) @<< || (DEL /Q \$(\@B).* $dso_n.* & EXIT 1)"
|
2020-12-09 08:29:14 +08:00
|
|
|
$objs$target{ld_resp_delim}\$(LDOUTFLAG)$dso$target{ldpostoutflag}$target{ld_resp_delim}$linklibs \$(DSO_EX_LIBS)$target{ld_resp_delim}$shared_def$target{ldresflag}$ress
|
2016-03-02 19:29:56 +08:00
|
|
|
<<
|
2018-10-23 20:36:23 +08:00
|
|
|
IF EXIST $dso.manifest \\
|
|
|
|
\$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso.manifest \$(MTOUTFLAG)$dso
|
2016-03-02 19:29:56 +08:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
sub obj2lib {
|
2017-04-18 22:24:23 +08:00
|
|
|
my %args = @_;
|
2018-10-23 20:36:23 +08:00
|
|
|
my $lib = platform->staticlib($args{lib});
|
|
|
|
my @objs = map { platform->obj($_) } @{$args{objs}};
|
2020-11-08 04:49:47 +08:00
|
|
|
my $objs = join($target{ar_resp_delim}, @objs);
|
2017-12-04 21:27:58 +08:00
|
|
|
my $deps = join(" ", @objs);
|
2016-03-02 19:29:56 +08:00
|
|
|
return <<"EOF";
|
2018-10-25 21:55:15 +08:00
|
|
|
$lib: $deps
|
|
|
|
\$(AR) \$(ARFLAGS) \$(AROUTFLAG)$lib @<<
|
2017-12-04 21:27:58 +08:00
|
|
|
$objs
|
2016-03-02 19:29:56 +08:00
|
|
|
<<
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
sub obj2bin {
|
|
|
|
my %args = @_;
|
2018-10-23 20:36:23 +08:00
|
|
|
my $bin = platform->bin($args{bin});
|
|
|
|
my @objs = map { platform->convertext($_) }
|
2020-12-09 08:29:14 +08:00
|
|
|
grep { platform->isobj($_) }
|
|
|
|
@{$args{objs}};
|
|
|
|
my @ress = map { platform->convertext($_) }
|
|
|
|
grep { platform->isres($_) }
|
2018-10-23 20:36:23 +08:00
|
|
|
@{$args{objs}};
|
2017-12-04 21:27:58 +08:00
|
|
|
my @deps = compute_lib_depends(@{$args{deps}});
|
2020-11-20 01:57:46 +08:00
|
|
|
my $objs = join($target{ld_resp_delim}, @objs);
|
2021-10-21 15:35:07 +08:00
|
|
|
my $ress = join($target{ld_resp_delim}, @ress);
|
2020-11-20 01:57:46 +08:00
|
|
|
my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps);
|
2020-12-09 08:29:14 +08:00
|
|
|
my $deps = join(" ", @objs, @ress, @deps);
|
2016-03-02 19:29:56 +08:00
|
|
|
return <<"EOF";
|
2018-10-23 20:36:23 +08:00
|
|
|
$bin: $deps
|
|
|
|
IF EXIST $bin.manifest DEL /F /Q $bin.manifest
|
2020-11-20 01:57:46 +08:00
|
|
|
\$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) @<<
|
2020-12-09 08:29:14 +08:00
|
|
|
$objs$target{ld_resp_delim}\$(LDOUTFLAG)$bin$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(BIN_EX_LIBS)$target{ldresflag}$target{ldresflag}$ress
|
2016-03-02 19:29:56 +08:00
|
|
|
<<
|
2018-10-23 20:36:23 +08:00
|
|
|
IF EXIST $bin.manifest \\
|
|
|
|
\$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin.manifest \$(MTOUTFLAG)$bin
|
2016-03-02 19:29:56 +08:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
sub in2script {
|
|
|
|
my %args = @_;
|
|
|
|
my $script = $args{script};
|
2016-05-25 17:58:19 +08:00
|
|
|
my $sources = '"'.join('" "', @{$args{sources}}).'"';
|
2016-03-02 19:29:56 +08:00
|
|
|
my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
|
|
|
|
"util", "dofile.pl")),
|
|
|
|
rel2abs($config{builddir}));
|
|
|
|
return <<"EOF";
|
2021-06-16 16:49:31 +08:00
|
|
|
$script: $sources configdata.pm
|
2016-05-25 17:58:19 +08:00
|
|
|
"\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
|
2020-11-20 07:25:22 +08:00
|
|
|
"-o$target{build_file}" $sources > \$@
|
2016-04-03 04:26:38 +08:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
sub generatedir {
|
|
|
|
my %args = @_;
|
|
|
|
my $dir = $args{dir};
|
2018-10-23 20:36:23 +08:00
|
|
|
my @deps = map { platform->convertext($_) } @{$args{deps}};
|
2016-04-03 04:26:38 +08:00
|
|
|
my @actions = ();
|
2018-10-23 20:36:23 +08:00
|
|
|
my %extinfo = ( dso => platform->dsoext(),
|
|
|
|
lib => platform->libext(),
|
|
|
|
bin => platform->binext() );
|
2016-04-03 04:26:38 +08:00
|
|
|
|
2018-10-21 17:11:04 +08:00
|
|
|
# We already have a 'test' target, and the top directory is just plain
|
|
|
|
# silly
|
|
|
|
return if $dir eq "test" || $dir eq ".";
|
|
|
|
|
2016-04-03 04:26:38 +08:00
|
|
|
foreach my $type (("dso", "lib", "bin", "script")) {
|
|
|
|
next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
|
2016-06-28 20:02:44 +08:00
|
|
|
# For lib object files, we could update the library. However,
|
|
|
|
# LIB on Windows doesn't work that way, so we won't create any
|
|
|
|
# actions for it, and the dependencies are already taken care of.
|
|
|
|
if ($type ne "lib") {
|
2016-04-03 04:26:38 +08:00
|
|
|
foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
|
|
|
|
if (dirname($prod) eq $dir) {
|
|
|
|
push @deps, $prod.$extinfo{$type};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
my $deps = join(" ", @deps);
|
|
|
|
my $actions = join("\n", "", @actions);
|
|
|
|
return <<"EOF";
|
2018-10-21 17:11:04 +08:00
|
|
|
$dir $dir\\ : $deps$actions
|
2016-03-02 19:29:56 +08:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
"" # Important! This becomes part of the template result.
|
|
|
|
-}
|