summaryrefslogtreecommitdiffstats
path: root/Configurations
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-04-21 14:30:08 +0200
committerRichard Levitte <levitte@openssl.org>2016-04-25 18:06:06 +0200
commit8d34daf0ce3bd2fc08dda0f1b0d1213dec452a1d (patch)
treebddf80d3549bba3a35ffabe413e4ec150f78528d /Configurations
parent79356a83b78a2d936dcd022847465d9ebf6c67b1 (diff)
Build system: add include directories and dependencies for generators
In the case of generating a file like this: GENERATE[foo.S]=mkfoo.pl arg1 arg2 the 'mkfoo.pl' generator itself might need to include other files, such as perl modules within our source tree. We can reuse already existing syntax for it, like this: INCLUDE[mkfoo.pl]=module/path or: DEPEND[mkfoo.pl]=modules/mymodule.pm This change implements the support for such constructs, and for the DEPEND statement, for any value that indicates a perl module (.pm file), it will automatically infer an INCLUDE statement for its directory, just like it does for C header files, so you won't have do write this: DEPEND[mkfoo.pl]=modules/mymodule.pm INCLUDE[mkfoo.pl]=modules Reviewed-by: Emilia Käsper <emilia@openssl.org>
Diffstat (limited to 'Configurations')
-rw-r--r--Configurations/common.tmpl3
-rw-r--r--Configurations/descrip.mms.tmpl5
-rw-r--r--Configurations/unix-Makefile.tmpl9
-rw-r--r--Configurations/windows-makefile.tmpl7
4 files changed, 15 insertions, 9 deletions
diff --git a/Configurations/common.tmpl b/Configurations/common.tmpl
index cdcaf5320f..af1746a144 100644
--- a/Configurations/common.tmpl
+++ b/Configurations/common.tmpl
@@ -42,8 +42,11 @@
my $bin = shift;
my %opts = @_;
if ($unified_info{generate}->{$src}) {
+ my $script = $unified_info{generate}->{$src}->[0];
$OUT .= generatesrc(src => $src,
generator => $unified_info{generate}->{$src},
+ generator_incs => $unified_info{includes}->{$script},
+ generator_deps => $unified_info{depends}->{$script},
deps => $unified_info{depends}->{$src},
incs => [ @{$unified_info{includes}->{$bin}},
@{$unified_info{includes}->{$obj}} ],
diff --git a/Configurations/descrip.mms.tmpl b/Configurations/descrip.mms.tmpl
index 2e58b1af9d..416f0ed52e 100644
--- a/Configurations/descrip.mms.tmpl
+++ b/Configurations/descrip.mms.tmpl
@@ -441,12 +441,13 @@ configdata.pm : {- join(" ", sourcefile("Configurations", "descrip.mms.tmpl"), s
sub generatesrc {
my %args = @_;
my $generator = join(" ", @{$args{generator}});
- my $deps = join(", -\n\t\t", @{$args{deps}});
+ my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
+ my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
if ($args{src} !~ /\.[sS]$/) {
return <<"EOF";
$args{src} : $args{generator}->[0] $deps
- \$(PERL) $generator > \$@
+ \$(PERL)$generator_incs $generator > \$@
EOF
} else {
die "No method to generate assembler source present.\n";
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index 1676b71b42..900c09fc1d 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -808,19 +808,20 @@ configdata.pm: $(SRCDIR)/Configurations/unix-Makefile.tmpl $(SRCDIR)/Configurati
sub generatesrc {
my %args = @_;
my $generator = join(" ", @{$args{generator}});
+ my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
my $incs = join("", map { " -I".$_ } @{$args{incs}});
- my $deps = join(" ", @{$args{deps}});
+ my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
if ($args{src} !~ /\.[sS]$/) {
return <<"EOF";
$args{src}: $args{generator}->[0] $deps
- \$(PERL) $generator > \$@
+ \$(PERL)$generator_incs $generator > \$@
EOF
} else {
if ($args{generator}->[0] =~ /\.pl$/) {
- $generator = 'CC="$(CC)" $(PERL) '.$generator;
+ $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
} elsif ($args{generator}->[0] =~ /\.m4$/) {
- $generator = 'm4 -B 8192 '.$generator.' >'
+ $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
} elsif ($args{generator}->[0] =~ /\.S$/) {
$generator = undef;
} else {
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index c3233eeb08..159d57c931 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -252,17 +252,18 @@ configdata.pm: {- $config{build_file_template} -} $(SRCDIR)\Configure
my %args = @_;
(my $target = $args{src}) =~ s/\.[sS]$/.asm/;
my $generator = join(" ", @{$args{generator}});
+ my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
my $incs = join("", map { " /I ".$_ } @{$args{incs}});
- my $deps = join(" ", @{$args{deps}});
+ my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
if ($target !~ /\.asm$/) {
return <<"EOF";
$target: $args{generator}->[0] $deps
- \$(PERL) $generator > \$@
+ \$(PERL)$generator_incs $generator > \$@
EOF
} else {
if ($args{generator}->[0] =~ /\.pl$/) {
- $generator = '$(PERL) '.$generator;
+ $generator = '$(PERL)'.$generator_incs.' '.$generator;
} elsif ($args{generator}->[0] =~ /\.S$/) {
$generator = undef;
} else {