summaryrefslogtreecommitdiffstats
path: root/util/add-depends.pl
diff options
context:
space:
mode:
authorTanzinul Islam <tanzinul.islam@gmail.com>2020-12-10 14:53:07 +0000
committerDmitry Belyavskiy <beldmit@gmail.com>2021-04-19 11:05:55 +0200
commit16f2a44435fccbd7466b0659220c765a17e5d0c0 (patch)
tree0cd711a3618e0935b5a48a5b037802d83b17a6cd /util/add-depends.pl
parent96d4ec6724a9ecc5d193172d0cf1a347f428372a (diff)
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)
Diffstat (limited to 'util/add-depends.pl')
-rw-r--r--util/add-depends.pl19
1 files changed, 14 insertions, 5 deletions
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;