Commit 77adb75e authored by Richard Levitte's avatar Richard Levitte
Browse files

Build: Remove BEGINRAW / ENDRAW / OVERRIDE



It was an ugly hack to avoid certain problems that are no more.

Also added GENERATE lines for perlasm scripts that didn't have that
explicitly.

Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8125)
parent 77550dbf
Loading
Loading
Loading
Loading
+0 −42
Original line number Diff line number Diff line
@@ -486,48 +486,6 @@ be used in that case:

NOTE: GENERATE lines are limited to one command only per GENERATE.

As a last resort, it's possible to have raw build file lines, between
BEGINRAW and ENDRAW lines as follows:

    BEGINRAW[Makefile(unix)]
    haha.h: {- $builddir -}/Makefile
        echo "/* haha */" > haha.h
    ENDRAW[Makefile(unix)]

The word within square brackets is the build_file configuration item
or the build_file configuration item followed by the second word in the
build_scheme configuration item for the configured target within
parenthesis as shown above.  For example, with the following relevant
configuration items:

   build_file   => "build.ninja"
   build_scheme => [ "unified", "unix" ]

... these lines will be considered:

   BEGINRAW[build.ninja]
   build haha.h: echo "/* haha */" > haha.h
   ENDRAW[build.ninja]

   BEGINRAW[build.ninja(unix)]
   build hoho.h: echo "/* hoho */" > hoho.h
   ENDRAW[build.ninja(unix)]

Should it be needed because the recipes within a RAW section might
clash with those generated by Configure, it's possible to tell it
not to generate them with the use of OVERRIDES, for example:

    SOURCE[libfoo]=foo.c bar.c
    
    OVERRIDES=bar.o
    BEGINRAW[Makefile(unix)]
    bar.o: bar.c
    	$(CC) $(CFLAGS) -DSPECIAL -c -o $@ $<
    ENDRAW[Makefile(unix)]

See the documentation further up for more information on configuration
items.

Finally, you can have some simple conditional use of the build.info
information, looking like this:

+0 −11
Original line number Diff line number Diff line
@@ -112,9 +112,6 @@ Two things are worth an extra note:
'DEPEND[cversion.o]' mentions an object file.  DEPEND indexes is the
only location where it's valid to mention them

Lines in 'BEGINRAW'..'ENDRAW' sections must always mention files as
seen from the top directory, no exception.

    # ssl/build.info
    LIBS=../libssl
    SOURCE[../libssl]=tls.c
@@ -234,11 +231,6 @@ indexes:
  programs  => a list of programs.  These are directly inferred from
               the PROGRAMS variable in build.info files.

  rawlines  => a list of build-file lines.  These are a direct copy of
               the BEGINRAW..ENDRAW lines in build.info files.  Note:
               only the BEGINRAW..ENDRAW section for the current
               platform are copied, the rest are ignored.

  scripts   => a list of scripts.  There are directly inferred from
               the SCRIPTS variable in build.info files.

@@ -352,9 +344,6 @@ section above would be digested into a %unified_info table:
            [
                "apps/openssl",
            ],
        "rawlines" =>
            [
            ],
        "sources" =>
            {
                "apps/openssl" =>
+0 −4
Original line number Diff line number Diff line
@@ -217,8 +217,4 @@
 foreach (@{$unified_info{scripts}})   { doscript($_); }

 foreach (sort keys %{$unified_info{dirinfo}})  { dodir($_); }

 # Finally, should there be any applicable BEGINRAW/ENDRAW sections,
 # they are added here.
 $OUT .= $_."\n" foreach @{$unified_info{rawlines}};
-}
+2 −27
Original line number Diff line number Diff line
@@ -1714,9 +1714,7 @@ if ($builder eq "unified") {
        my @engines = ();
        my @scripts = ();
        my @extra = ();
        my @overrides = ();
        my @intermediates = ();
        my @rawlines = ();

        my %attributes = ();
        my %sources = ();
@@ -1872,9 +1870,6 @@ if ($builder eq "unified") {
            qr/^\s*EXTRA\s*=\s*(.*)\s*$/
            => sub { push @extra, tokenize($1)
                         if !@skip || $skip[$#skip] > 0 },
            qr/^\s*OVERRIDES\s*=\s*(.*)\s*$/
            => sub { push @overrides, tokenize($1)
                         if !@skip || $skip[$#skip] > 0 },

            qr/^\s*ORDINALS\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/,
            => sub { push @{$ordinals{$1}}, tokenize($2)
@@ -1901,23 +1896,6 @@ if ($builder eq "unified") {
            => sub { warn "RENAME is no longer supported\n" },
             qr/^\s*SHARED_NAME\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
            => sub { warn "SHARED_NAME is no longer supported\n" },
            qr/^\s*BEGINRAW\[((?:\\.|[^\\\]])+)\]\s*$/
            => sub {
                my $lineiterator = shift;
                my $target_kind = $1;
                while (defined $lineiterator->()) {
                    s|\R$||;
                    if (/^\s*ENDRAW\[((?:\\.|[^\\\]])+)\]\s*$/) {
                        die "ENDRAW doesn't match BEGINRAW"
                            if $1 ne $target_kind;
                        last;
                    }
                    next if @skip && $skip[$#skip] <= 0;
                    push @rawlines,  $_
                        if ($target_kind eq $target{build_file}
                            || $target_kind eq $target{build_file}."(".$builder_platform.")");
                }
            },
            qr/^\s*(?:#.*)?$/ => sub { },
            "OTHERWISE" => sub { die "Something wrong with this line:\n$_\nat $sourced/$f" },
            "BEFORE" => sub {
@@ -1953,8 +1931,7 @@ EOF
                          libraries => [ @libraries ],
                          engines   => [ @engines   ],
                          scripts   => [ @scripts   ],
                          extra     => [ @extra     ],
                          overrides => [ @overrides ] );
                          extra     => [ @extra     ] );
            foreach my $k (keys %infos) {
                foreach (@{$infos{$k}}) {
                    my $item = cleanfile($buildd, $_, $blddir);
@@ -1963,8 +1940,6 @@ EOF
            }
        }

        push @{$unified_info{rawlines}}, @rawlines;

        # Check that we haven't defined any library as both shared and
        # explicitly static.  That is forbidden.
        my @doubles = ();
@@ -2259,7 +2234,7 @@ EOF

    ### Make unified_info a bit more efficient
    # One level structures
    foreach (("programs", "libraries", "engines", "scripts", "extra", "overrides")) {
    foreach (("programs", "libraries", "modules", "scripts", "extra")) {
        $unified_info{$_} = [ sort keys %{$unified_info{$_}} ];
    }
    # Two level structures
+1 −10
Original line number Diff line number Diff line
@@ -52,13 +52,4 @@ INCLUDE[bsaes-armv7.o]=..
GENERATE[aes-s390x.S]=asm/aes-s390x.pl $(PERLASM_SCHEME)
INCLUDE[aes-s390x.o]=..

BEGINRAW[Makefile]
##### AES assembler implementations

# GNU make "catch all"
{- $builddir -}/aes-%.S:	{- $sourcedir -}/asm/aes-%.pl
	CC="$(CC)" $(PERL) $< $(PERLASM_SCHEME) $@
{- $builddir -}/bsaes-%.S:	{- $sourcedir -}/asm/bsaes-%.pl
	CC="$(CC)" $(PERL) $< $(PERLASM_SCHEME) $@

ENDRAW[Makefile]
GENERATE[aes-c64xplus.S]=asm/aes-c64xplus.pl $(PERLASM_SCHEME)
Loading