summaryrefslogtreecommitdiffstats
path: root/Configurations/descrip.mms.tmpl
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2018-01-23 13:54:55 +0100
committerRichard Levitte <levitte@openssl.org>2018-01-28 07:26:10 +0100
commit8c3bc594e0c74926bfefb84b8bae8a2fac82e465 (patch)
tree7875c47a8ecd68f42f701e6f3602a8cc0c4fe0dc /Configurations/descrip.mms.tmpl
parentdf05f155a69b96b174e0e47bc689bf729de684b6 (diff)
Processing GNU-style "make variables" - separate CPP flags from C flags
C preprocessor flags get separated from C flags, which has the advantage that we don't get loads of macro definitions and inclusion directory specs when linking shared libraries, DSOs and programs. This is a step to add support for "make variables" when configuring. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5177)
Diffstat (limited to 'Configurations/descrip.mms.tmpl')
-rw-r--r--Configurations/descrip.mms.tmpl33
1 files changed, 26 insertions, 7 deletions
diff --git a/Configurations/descrip.mms.tmpl b/Configurations/descrip.mms.tmpl
index 924dd9e869..9995b43b9f 100644
--- a/Configurations/descrip.mms.tmpl
+++ b/Configurations/descrip.mms.tmpl
@@ -172,11 +172,20 @@ OPENSSLDIR_C={- $osslprefix -}DATAROOT:[000000]
ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
CC= {- $target{cc} -}
-CFLAGS= /DEFINE=({- join(",", @{$target{defines}}, @{$config{defines}},"OPENSSLDIR=\"\"\"\$(OPENSSLDIR_C)\"\"\"","ENGINESDIR=\"\"\"\$(ENGINESDIR_C)\"\"\"") -}) {- $target{cflags} -} {- $config{cflags} -}
-CFLAGS_Q=$(CFLAGS)
-DEPFLAG= /DEFINE=({- join(",", @{$config{depdefines}}) -})
+DEFINES={- our $defines = join(",",
+ '__dummy', # To make comma processing easier
+ @{$target{defines}}, @{$config{defines}}) -}
+CPPFLAGS={- our $cppflags = join('', $target{cppflags}, $config{cppflags}) -}
+CPPFLAGS_Q={- $cppflags =~ s|"|""|g; $defines =~ s|"|""|g;
+ $cppflags."/DEFINE($defines)" -}
+CFLAGS={- $target{cflags} -} {- $config{cflags} -}
LDFLAGS= {- $target{lflags} -}
EX_LIBS= {- $target{ex_libs} ? ",".$target{ex_libs} : "" -}{- $config{ex_libs} ? ",".$config{ex_libs} : "" -}
+LIB_DEFINES={- join("",
+ (map { ",$_" }
+ @{$target{shared_defines}},
+ 'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
+ 'ENGINESDIR="""$(ENGINESDIR_C)"""')) -}
LIB_CFLAGS={- $target{lib_cflags} // "" -}
DSO_CFLAGS={- $target{dso_cflags} // "" -}
BIN_CFLAGS={- $target{bin_cflags} // "" -}
@@ -605,16 +614,26 @@ EOF
my $srcs =
join(", ",
map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
- my $ecflags;
+ my $cflags = '$(CFLAGS)';
if ($args{installed}) {
- $ecflags = { lib => '$(LIB_CFLAGS)',
+ $cflags .= { lib => '$(LIB_CFLAGS)',
dso => '$(DSO_CFLAGS)',
bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
} else {
- $ecflags = { lib => '$(NO_INST_LIB_CFLAGS)',
+ $cflags .= { lib => '$(NO_INST_LIB_CFLAGS)',
dso => '$(NO_INST_DSO_CFLAGS)',
bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
}
+ $cflags .= '$(CPPFLAGS)';
+ $cflags .= { lib => '$(LIB_CPPFLAGS)',
+ dso => '$(DSO_CPPFLAGS)',
+ bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
+ my $defines = '$(DEFINES)';
+ $defines .= { lib => '$(LIB_DEFINES)',
+ dso => '$(DSO_DEFINES)',
+ bin => '$(BIN_DEFINES)' } -> {$args{intent}};
+ $cflags .= '/DEFINE=('.$defines.')';
+
my $incs_on = "\@ !";
my $incs_off = "\@ !";
my $incs = "";
@@ -645,7 +664,7 @@ $obj.OBJ : $deps
${before}
SET DEFAULT $forward
$incs_on
- \$(CC) \$(CFLAGS)${ecflags}${incs}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
+ \$(CC) ${cflags}${incs}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
$incs_off
SET DEFAULT $backward
${after}