From 9a1394c54e9e5d21476ee6fb5d15d1d14dd4fdf5 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Mon, 7 Mar 2016 14:12:45 +0100 Subject: Adapt the Windows makefile template to source generation Reviewed-by: Rich Salz --- Configurations/windows-makefile.tmpl | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'Configurations') diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl index 6f3c8483e2..77cc377fce 100644 --- a/Configurations/windows-makefile.tmpl +++ b/Configurations/windows-makefile.tmpl @@ -167,6 +167,53 @@ configdata.pm: {- $config{build_file_template} -} $(SRCDIR)\Configure return map { shlib_import($_) } @_; } + sub generatesrc { + my %args = @_; + (my $target = $args{src}) =~ s/\.[sS]$/.asm/; + my $generator = join(" ", @{$args{generator}}); + + if ($target !~ /\.asm$/) { + return <<"EOF"; +$target: $args{generator}->[0] + \$(PERL) $generator > \$@ +EOF + } else { + if ($args{generator}->[0] =~ /\.pl$/) { + $generator = '$(PERL) '.$generator; + } elsif ($args{generator}->[0] =~ /\.S$/) { + $generator = undef; + } else { + die "Generator type for $src unknown: $generator\n"; + } + + if (defined($generator)) { + # If the target is named foo.S in build.info, we want to + # end up generating foo.s in two steps. + if ($args{src} =~ /\.S$/) { + return <<"EOF"; +$target: $args{generator}->[0] + set ASM=\$(AS) + set CC=\$(CC) + $generator \$@.S + \$(CC) \$(CFLAGS) /EP /C \$@.S > \$@ + del /Q \$@.S +EOF + } + # Otherwise.... + return <<"EOF"; +$target: $args{generator}->[0] + set ASM=\$(AS) + set CC=\$(CC) + $generator \$@ +EOF + } + return <<"EOF"; +$target: $args{generator}->[0] + \$(CC) \$(CFLAGS) /EP /C \$< > \$@ +EOF + } + } + sub src2obj { my %args = @_; my $obj = $args{obj}; -- cgit v1.2.3