From 8c3bc594e0c74926bfefb84b8bae8a2fac82e465 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 23 Jan 2018 13:54:55 +0100 Subject: 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 Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/5177) --- Configurations/descrip.mms.tmpl | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'Configurations/descrip.mms.tmpl') 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} -- cgit v1.2.3