From 2e535eb50aa9c6b73c796f668e1aef8bc17f14c4 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Mon, 26 Apr 2021 09:17:05 +0200 Subject: Configuration: rework how dependency making is handled Previously, we had dependency making pretty much hard coded in the build file templates, with a bit of an exception for Unix family platforms, where we had different cases depending on what dependency making program was found. With the Embarcadero C++ builder, a separate scheme appeared, with a different logic. This change merges the two, and introduces two config target attributes: makedepcmd The program to use, where this is relevant. This replaces the earlier configuration attribute 'makedepprog'. makedep_scheme This is a keyword that can be used by build files templates to produce different sorts of commands, but most importantly, to pass as argument to util/add-depend.pl, which uses this keyword as a "producer" for the dependency lines. If the config target doesn't define the 'makedep_scheme' attribute, Configure tries to figure it out by looking for GCC compatible compilers or for the 'makedepend' command. Reviewed-by: Tomas Mraz Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/15006) --- Configurations/unix-Makefile.tmpl | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'Configurations/unix-Makefile.tmpl') diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index be6036c227..e2df304061 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -3,7 +3,8 @@ ## ## {- join("\n## ", @autowarntext) -} {- - our $makedepprog = platform->makedepprog(); + our $makedep_scheme = $config{makedep_scheme}; + our $makedepcmd = platform->makedepcmd(); sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ } @@ -315,7 +316,7 @@ CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -} LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -} EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -} -MAKEDEPEND={- $config{makedepprog} -} +MAKEDEPEND={- $config{makedepcmd} -} PERL={- $config{PERL} -} @@ -570,9 +571,7 @@ distclean: clean # concatenate only if that is true. depend: @: {- output_off() if $disabled{makedepend}; "" -} - @$(PERL) $(SRCDIR)/util/add-depends.pl {- - defined $makedepprog && $makedepprog =~ /\/makedepend/ - ? 'makedepend' : 'gcc' -} + @$(PERL) $(SRCDIR)/util/add-depends.pl "{- $makedep_scheme -}" @: {- output_on() if $disabled{makedepend}; "" -} # Install helper targets ############################################# @@ -1516,8 +1515,7 @@ EOF $obj: $deps $cmd $incs $defs $cmdflags -c -o \$\@ $srcs EOF - } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/ - && !grep /\.rc$/, @srcs) { + } elsif ($makedep_scheme eq 'gcc' && !grep /\.rc$/, @srcs) { $recipe .= <<"EOF"; $obj: $deps $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs @@ -1533,7 +1531,7 @@ EOF $obj: $deps $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs EOF - if (defined $makedepprog && $makedepprog =~ /\/makedepend/) { + if ($makedep_scheme eq 'makedepend') { $recipe .= <<"EOF"; \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\ > $dep -- cgit v1.2.3