]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Avoid quoting dependency filepaths in build tree
authorTanzinul Islam <tanzinul.islam@gmail.com>
Sun, 15 Nov 2020 20:57:49 +0000 (20:57 +0000)
committerDmitry Belyavskiy <beldmit@gmail.com>
Mon, 19 Apr 2021 09:05:54 +0000 (11:05 +0200)
C++Builder's `make.exe` has a bug in finding the rule of a quoted
dependency that doesn't exist in the filesystem. So for example:

    A: "src\B" "out\C"
     touch $@
    out\C:
     mkdir out
     touch $@

leads to:
    Fatal: '"out\C"' does not exist - don't know how to make it

This happens even with the `-N` option, and is different behavior from
Microsoft NMake which documents the feature of [quoted filepaths][1].

Commit cb663908 quoted all dependency filepaths, in case they are used
in a out-of-source build. The quoting is not done for target names,
however, which implies that the build directory is still expected to not
have spaces. It follows that we only need to quote non-generated source
files in dependency lists, since generated source files will be created
in the build directory.

Change the logic accordingly as a workaround, so that it works at least
for in-source builds with C++Builder's `make.exe`.

[1]: https://docs.microsoft.com/cpp/build/reference/long-filenames-in-a-makefile?view=msvc-160

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)

Configurations/windows-makefile.tmpl

index 5d1d77b3d2481796ce147a757ac75682e921cf6b..73ddcc8bd58499840cc7d6956256eb0ed99f9151 100644 (file)
@@ -621,7 +621,7 @@ reconfigure reconf:
 
 {-
  use File::Basename;
- use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
+ use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs file_name_is_absolute/;
 
  # Helper function to figure out dependencies on libraries
  # It takes a list of library names and outputs a list of dependencies
@@ -649,7 +649,10 @@ EOF
       my $incs = join("", map { " -I\"$_\"" } @{$args{incs}});
       my $defs = join("", map { " -D".$_ } @{$args{defs}});
       my $deps = @{$args{deps}} ?
-          '"'.join('" "', @{$args{generator_deps}}, @{$args{deps}}).'"' : '';
+          join(' ',
+               map { file_name_is_absolute($_) || ($_ =~ m|^../|) ? "\"$_\"" : $_ }
+               (@{$args{generator_deps}}, @{$args{deps}}))
+          : '';
 
       if ($args{src} =~ /\.html$/) {
           #
@@ -787,7 +790,9 @@ EOF
                ? platform->asm($x) : $x }
          ( @{$args{srcs}} );
      my $srcs = '"'.join('" "',  @srcs).'"';
-     my $deps = '"'.join('" "', @srcs, @{$args{deps}}).'"';
+     my $deps = join(' ',
+                     map { file_name_is_absolute($_) || ($_ =~ m|^../|) ? "\"$_\"" : $_ }
+                     (@srcs, @{$args{deps}}));
      my $incs = join("", map { ' -I"'.$_.'"' } @{$args{incs}});
      my $defs = join("", map { " -D".$_ } @{$args{defs}});
      my $cflags = { shlib => ' $(LIB_CFLAGS)',