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:",
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",
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" ' .
##### 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}}),
\$(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;
}
# 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
},
'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
#
# 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.
# 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;