mirror of
https://github.com/openssl/openssl.git
synced 2025-01-30 14:01:55 +08:00
Generate dependency information
The Clang-based `bcc32c.exe` doesn't implement the `-Hp` option, so we have to use [`cpp32.exe`][1] instead. Therefore, change the dependency- emitting command to use `$(CPP)` instead of `$(CC)`, which which also uncovered the [existing bug of `2>&1` before `> $dep`][2]. Also C++Builder's `make.exe` doesn't implement `2>&1` in its command runner, so wrap the whole line in a `cmd /C`. [1]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/CPP32.EXE,_the_C_Compiler_Preprocessor [2]: https://ss64.com/nt/syntax-redirection.html Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/13540)
This commit is contained in:
parent
96d4ec6724
commit
16f2a44435
@ -1275,9 +1275,10 @@ my %targets = (
|
||||
inherit_from => [ "BASE_Windows" ],
|
||||
template => 1,
|
||||
CC => "cl",
|
||||
CPP => '$(CC) /EP /C',
|
||||
CPP => '"$(CC)" /EP /C',
|
||||
CFLAGS => "/W3 /wd4090 /nologo",
|
||||
coutflag => "/Fo",
|
||||
cpp_depend_flags => "/Zs /showIncludes",
|
||||
LD => "link",
|
||||
LDFLAGS => "/nologo /debug",
|
||||
ldoutflag => "/out:",
|
||||
|
@ -5,6 +5,7 @@ my %targets = (
|
||||
bn_ops => "BN_LLONG",
|
||||
thread_scheme => "winthreads",
|
||||
cc => "bcc32c",
|
||||
CPP => "cpp32 -oCON -Sc -Sr",
|
||||
defines => add("WIN32_LEAN_AND_MEAN", "OPENSSL_SYS_WIN32",
|
||||
"L_ENDIAN", "DSO_WIN32", "_stricmp=stricmp",
|
||||
"_strnicmp=strnicmp", "_malloca=malloc",
|
||||
@ -17,6 +18,7 @@ my %targets = (
|
||||
bin_cflags => "-tWC",
|
||||
lib_cflags => shared("-tWD -D_WINDLL -D_DLL"),
|
||||
coutflag => "-o",
|
||||
cpp_depend_flags => "-Hp",
|
||||
LD => "ilink32",
|
||||
LDFLAGS => picker(default => "-ap -x -Gn -q",
|
||||
debug => '-j"$(BDS)\lib\win32c\debug" ' .
|
||||
|
@ -226,7 +226,7 @@ libdir={- file_name_is_absolute($libdir)
|
||||
##### User defined commands and flags ################################
|
||||
|
||||
CC="{- $config{CC} -}"
|
||||
CPP="{- $config{CPP} -}"
|
||||
CPP={- $config{CPP} -}
|
||||
CPPFLAGS={- our $cppflags1 = join(" ",
|
||||
(map { "-D".$_} @{$config{CPPDEFINES}}),
|
||||
(map { " -I".$_} @{$config{CPPINCLUDES}}),
|
||||
@ -836,7 +836,7 @@ $obj: $deps
|
||||
\$(CC) $cflags $defs -c \$(COUTFLAG)\$\@ $srcs
|
||||
EOF
|
||||
$recipe .= <<"EOF" unless $disabled{makedepend};
|
||||
\$(CC) $cflags $defs /Zs /showIncludes $srcs 2>&1 > $dep
|
||||
cmd /C "\$(CPP) $cflags $defs $target{cpp_depend_flags} $srcs > $dep 2>&1"
|
||||
EOF
|
||||
return $recipe;
|
||||
}
|
||||
|
@ -1533,10 +1533,10 @@ unless ($disabled{asm}) {
|
||||
|
||||
# Check for makedepend capabilities.
|
||||
if (!$disabled{makedepend}) {
|
||||
if ($config{target} =~ /^(VC|vms)-/) {
|
||||
# For VC- and vms- targets, there's nothing more to do here. The
|
||||
if ($config{target} =~ /^(VC|BC|vms)-/) {
|
||||
# For VC-, BC- and vms- targets, there's nothing more to do here. The
|
||||
# functionality is hard coded in the corresponding build files for
|
||||
# cl (Windows) and CC/DECC (VMS).
|
||||
# cl/cpp32 (Windows) and CC/DECC (VMS).
|
||||
} elsif (($predefined_C{__GNUC__} // -1) >= 3
|
||||
&& !($predefined_C{__APPLE_CC__} && !$predefined_C{__clang__})) {
|
||||
# We know that GNU C version 3 and up as well as all clang
|
||||
|
@ -161,8 +161,7 @@ my %procedures = (
|
||||
},
|
||||
'VC' =>
|
||||
sub {
|
||||
# For the moment, we only support Visual C on native Windows, or
|
||||
# compatible compilers. With those, the flags /Zs /showIncludes
|
||||
# On Windows, with Microsoft Visual C the flags /Zs /showIncludes
|
||||
# give us the necessary output to be able to create dependencies
|
||||
# that nmake (or any 'make' implementation) should be able to read,
|
||||
# with a bit of help. The output we're interested in looks like
|
||||
@ -170,6 +169,15 @@ my %procedures = (
|
||||
#
|
||||
# Note: including file: {whatever header file}
|
||||
#
|
||||
# With Embarcadero C++Builder's preprocessor (cpp32.exe) the -Hp
|
||||
# flag gives us the preprocessed output annotated with the following
|
||||
# note whenever a #include file is read:
|
||||
#
|
||||
# Including ->->{whatever header file}
|
||||
#
|
||||
# where each "->" indicates the nesting level of the #include. The
|
||||
# logic here is otherwise the same as the 'VC' case.
|
||||
#
|
||||
# Since there's no object file name at all in that information,
|
||||
# we must construct it ourselves.
|
||||
|
||||
@ -180,13 +188,14 @@ my %procedures = (
|
||||
# warnings, so we simply discard anything that doesn't start with
|
||||
# the Note:
|
||||
|
||||
if (/^Note: including file: */) {
|
||||
if (/^Note: including file: */ or /^Including (->)*/) {
|
||||
(my $tail = $') =~ s/\s*\R$//;
|
||||
|
||||
# VC gives us absolute paths for all include files, so to
|
||||
# remove system header dependencies, we need to check that
|
||||
# they don't match $abs_srcdir or $abs_blddir.
|
||||
$tail = canonpath($tail);
|
||||
# they don't match $abs_srcdir or $abs_blddir. C++Builder gives
|
||||
# us relative paths when possible, so convert to absolute paths.
|
||||
$tail = rel2abs($tail);
|
||||
|
||||
unless (defined $depconv_cache{$tail}) {
|
||||
my $dep = $tail;
|
||||
|
Loading…
Reference in New Issue
Block a user