Build: Make it possible to have defines assigned to end products as well
authorRichard Levitte <levitte@openssl.org>
Fri, 2 Nov 2018 12:08:38 +0000 (13:08 +0100)
committerRichard Levitte <levitte@openssl.org>
Mon, 5 Nov 2018 07:13:05 +0000 (08:13 +0100)
This simple fix allows the following construct:

    PROGRAMS=foo
    SOURCE[foo]=foo.c bar.c
    DEFINE[foo]=FOO=1 BAR=0

These will trickle down to the build of object files, so building
foo.o and bar.o will be done with these options: -DFOO=1 -DBAR=0
(exact syntax depending on platform, of course)

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7553)

Configurations/common.tmpl

index b7d2a0777e011753cb38e1064914c6f68f791555..bf440d9d88b1ee642282854490c32d2e15f22619 100644 (file)
@@ -85,7 +85,8 @@
                              deps => $unified_info{depends}->{$src},
                              incs => [ @{$unified_info{includes}->{$obj}},
                                        @{$unified_info{includes}->{$bin}} ],
-                             defs => $unified_info{defines}->{$obj},
+                             defs => [ @{$unified_info{defines}->{$obj}},
+                                       @{$unified_info{defines}->{$bin}} ],
                              %opts);
          foreach (@{$unified_info{depends}->{$src}}) {
              dogenerate($_, $obj, $bin, %opts);
                          deps => $unified_info{depends}->{$obj},
                          incs => [ @{$unified_info{includes}->{$obj}},
                                    @{$unified_info{includes}->{$bin}} ],
-                         defs => $unified_info{defines}->{$obj},
+                         defs => [ @{$unified_info{defines}->{$obj}},
+                                   @{$unified_info{defines}->{$bin}} ],
                          %opts);
          foreach ((@{$unified_info{sources}->{$obj}},
                    @{$unified_info{depends}->{$obj}})) {