Skip to content

Commit

Permalink
Make "make variables" config attributes for overridable flags
Browse files Browse the repository at this point in the history
With the support of "make variables" comes the possibility for the
user to override them.  However, we need to make a difference between
defaults that we use (and that should be overridable by the user) and
flags that are crucial for building OpenSSL (should not be
overridable).

Typically, overridable flags are those setting optimization levels,
warnings levels, that kind of thing, while non-overridable flags are,
for example, macros that indicate aspects of how the config target
should be treated, such as L_ENDIAN and B_ENDIAN.

We do that differentiation by allowing upper case attributes in the
config targets, named exactly like the "make variables" we support,
and reserving the lower case attributes for non-overridable project
flags.

Reviewed-by: Andy Polyakov <[email protected]>
(Merged from openssl#5534)
  • Loading branch information
levitte committed Mar 8, 2018
1 parent 48dcca2 commit abe256e
Show file tree
Hide file tree
Showing 15 changed files with 787 additions and 459 deletions.
42 changes: 21 additions & 21 deletions Configurations/00-base-templates.conf
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ my %targets=(
build_scheme => [ "unified", "unix" ],
build_file => "Makefile",

ar => "ar",
arflags => "r",
cc => "cc",
hashbangperl => "/usr/bin/env perl",
ranlib => sub { which("$config{cross_compile_prefix}ranlib")
AR => "ar",
ARFLAGS => "r",
CC => "cc",
HASHBANGPERL => "/usr/bin/env perl",
RANLIB => sub { which("$config{cross_compile_prefix}ranlib")
? "ranlib" : "" },
rc => "windres",
RC => "windres",

#### THESE WILL BE ENABLED IN OpenSSL 1.2
#hashbangperl => "PERL", # Only Unix actually cares
#HASHBANGPERL => "PERL", # Only Unix actually cares
},

BASE_common => {
Expand Down Expand Up @@ -84,19 +84,19 @@ my %targets=(
inherit_from => [ "BASE_common" ],
template => 1,

ar => "ar",
arflags => "r",
cc => "cc",
AR => "ar",
ARFLAGS => "r",
CC => "cc",
lflags =>
sub { $withargs{zlib_lib} ? "-L".$withargs{zlib_lib} : () },
ex_libs =>
sub { !defined($disabled{zlib})
&& defined($disabled{"zlib-dynamic"})
? "-lz" : () },
hashbangperl => "/usr/bin/env perl", # Only Unix actually cares
ranlib => sub { which("$config{cross_compile_prefix}ranlib")
HASHBANGPERL => "/usr/bin/env perl", # Only Unix actually cares
RANLIB => sub { which("$config{cross_compile_prefix}ranlib")
? "ranlib" : "" },
rc => "windres",
RC => "windres",

build_scheme => [ "unified", "unix" ],
build_file => "Makefile",
Expand All @@ -116,16 +116,16 @@ my %targets=(
return ();
},

ld => "link",
lflags => "/nologo",
loutflag => "/out:",
ar => "lib",
arflags => "/nologo",
LD => "link",
LDFLAGS => "/nologo",
ldoutflag => "/out:",
AR => "lib",
ARFLAGS => "/nologo",
aroutflag => "/out:",
rc => "rc",
RC => "rc",
rcoutflag => "/fo",
mt => "mt",
mtflags => "-nologo",
MT => "mt",
MTFLAGS => "-nologo",
mtinflag => "-manifest ",
mtoutflag => "-outputresource:",

Expand Down
514 changes: 270 additions & 244 deletions Configurations/10-main.conf

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Configurations/50-djgpp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
my %targets = (
"DJGPP" => {
inherit_from => [ asm("x86_asm") ],
cc => "gcc",
cflags => "-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall",
CC => "gcc",
CFLAGS => "-fomit-frame-pointer -O2 -Wall",
cflags => "-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN",
sys_id => "MSDOS",
lflags => add("-L/dev/env/WATT_ROOT/lib"),
ex_libs => add("-lwatt"),
Expand Down
9 changes: 5 additions & 4 deletions Configurations/50-haiku.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
my %targets = (
"haiku-common" => {
template => 1,
cc => "cc",
cflags => add_before(picker(default => "-DL_ENDIAN -Wall -include \$(SRCDIR)/os-dep/haiku.h",
CC => "cc",
CFLAGS => add_before(picker(default => "-Wall",
debug => "-g -O0",
release => "-O2"),
release => "-O2")),
cflags => add_before("-DL_ENDIAN -include \$(SRCDIR)/os-dep/haiku.h",
threads("-D_REENTRANT")),
sys_id => "HAIKU",
ex_libs => "-lnetwork",
Expand All @@ -18,7 +19,7 @@ my %targets = (
},
"haiku-x86" => {
inherit_from => [ "haiku-common", asm("x86_elf_asm") ],
cflags => add(picker(release => "-fomit-frame-pointer")),
CFLAGS => add(picker(release => "-fomit-frame-pointer")),
bn_ops => "BN_LLONG",
},
"haiku-x86_64" => {
Expand Down
5 changes: 3 additions & 2 deletions Configurations/50-masm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ my %targets = (
"VC-WIN64A-masm" => {
inherit_from => [ "VC-WIN64-common", asm("x86_64_asm"),
sub { $disabled{shared} ? () : "x86_64_uplink" } ],
as => "ml64",
asflags => "/nologo /c /Cp /Cx /Zi",
AS => "ml64",
ASFLAGS => "/nologo /Zi",
asoutflag => "/Fo",
asflags => "/c /Cp /Cx",
sys_id => "WIN64A",
bn_asm_src => sub { return undef unless @_;
my $r=join(" ",@_); $r=~s|asm/x86_64-gcc|bn_asm|; $r; },
Expand Down
6 changes: 3 additions & 3 deletions Configurations/90-team.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ my %targets = (
"purify" => {
inherit_from => [ 'BASE_unix' ],
cc => "purify gcc",
cflags => "-g -Wall",
CFLAGS => "-g -Wall",
thread_scheme => "(unknown)",
ex_libs => add(" ","-lsocket -lnsl"),
},
Expand Down Expand Up @@ -81,8 +81,8 @@ my %targets = (
},
"dist" => {
inherit_from => [ 'BASE_unix' ],
cc => "cc",
cflags => "-O",
CC => "cc",
CFLAGS => "-O",
thread_scheme => "(unknown)",
},
"debug-test-64-clang" => {
Expand Down
Loading

0 comments on commit abe256e

Please sign in to comment.