diff options
-rw-r--r-- | Configurations/10-main.conf | 3 | ||||
-rw-r--r-- | Configurations/50-cppbuilder.conf | 2 | ||||
-rw-r--r-- | Configurations/windows-makefile.tmpl | 4 | ||||
-rwxr-xr-x | Configure | 6 | ||||
-rw-r--r-- | util/add-depends.pl | 19 |
5 files changed, 23 insertions, 11 deletions
diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf index 4d42c7fae8..f5e5754b3a 100644 --- a/Configurations/10-main.conf +++ b/Configurations/10-main.conf @@ -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:", diff --git a/Configurations/50-cppbuilder.conf b/Configurations/50-cppbuilder.conf index 40b89b403e..7ca972956a 100644 --- a/Configurations/50-cppbuilder.conf +++ b/Configurations/50-cppbuilder.conf @@ -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" ' . diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl index 521f72d7b7..bcb092d045 100644 --- a/Configurations/windows-makefile.tmpl +++ b/Configurations/windows-makefile.tmpl @@ -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 diff --git a/util/add-depends.pl b/util/add-depends.pl index 1a87cdd364..6fdc5e5ef4 100644 --- a/util/add-depends.pl +++ b/util/add-depends.pl @@ -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; |