diff options
author | Richard Levitte <levitte@openssl.org> | 2018-01-23 13:54:55 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2018-01-28 07:26:10 +0100 |
commit | 8c3bc594e0c74926bfefb84b8bae8a2fac82e465 (patch) | |
tree | 7875c47a8ecd68f42f701e6f3602a8cc0c4fe0dc /Configurations/windows-makefile.tmpl | |
parent | df05f155a69b96b174e0e47bc689bf729de684b6 (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/windows-makefile.tmpl')
-rw-r--r-- | Configurations/windows-makefile.tmpl | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl index aee8e8874b..95d7334dc6 100644 --- a/Configurations/windows-makefile.tmpl +++ b/Configurations/windows-makefile.tmpl @@ -160,7 +160,14 @@ ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir) !ENDIF CC={- $target{cc} -} -CFLAGS={- join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}})) -} {- join(" ", quotify_l("-DENGINESDIR=\"$enginesdir\"", "-DOPENSSLDIR=\"$openssldir\"")) -} {- $target{cflags} -} {- $config{cflags} -} +CPPFLAGS={- our $cppflags = join(" ", + (map { "-D".$_} + @{$target{defines}}, @{$config{defines}}), + (map { " /I ".$_} + @{$target{includes}}, @{$config{includes}}), + $target{cppflags}, $config{cppflags}) -} +CPPFLAGS_Q={- $cppflags =~ s|([\\"])|\\$1|g; $cppflags -} +CFLAGS={- $target{cflags} -} {- $config{cflags} -} COUTFLAG={- $target{coutflag} || "/Fo" -}$(OSSL_EMPTY) RC={- $target{rc} || "rc" -} RCOUTFLAG={- $target{rcoutflag} || "/fo" -}$(OSSL_EMPTY) @@ -168,10 +175,17 @@ LD={- $target{ld} || "link" -} LDFLAGS={- $target{lflags} -} LDOUTFLAG={- $target{loutflag} || "/out:" -}$(OSSL_EMPTY) EX_LIBS={- $target{ex_libs} -} +LIB_CPPFLAGS={- join(" ", + $target{shared_cppflag} || "", + (map { quotiry_l("-D".$_) } + 'OPENSSLDIR="$(OPENSSLDIR)"', + 'ENGINESDIR="$(ENGINESDIR)"')) -} LIB_CFLAGS={- join(" ", $target{lib_cflags}, $target{shared_cflag}) || "" -} LIB_LDFLAGS={- $target{shared_ldflag} || "" -} +DSO_CPPFLAGS={- $target{dso_cppflags} || "" -} DSO_CFLAGS={- $target{dso_cflags} || "" -} DSO_LDFLAGS={- $target{dso_ldflag} || "" -} +BIN_CPPFLAGS={- $target{dso_cppflags} || "" -} BIN_CFLAGS={- $target{bin_cflags} -} BIN_LDFLAGS={- $target{bin_lflags} -} @@ -427,7 +441,7 @@ EOF $target: "$args{generator}->[0]" $deps set ASM=\$(AS) $generator \$@.S - \$(CC) $incs \$(CFLAGS) /EP /C \$@.S > \$@.i && move /Y \$@.i \$@ + \$(CC) $incs \$(CFLAGS) \$(CPPFLAGS) /EP /C \$@.S > \$@.i && move /Y \$@.i \$@ del /Q \$@.S EOF } @@ -440,7 +454,7 @@ EOF } return <<"EOF"; $target: "$args{generator}->[0]" $deps - \$(CC) $incs \$(CFLAGS) /EP /C "$args{generator}->[0]" > \$@.i && move /Y \$@.i \$@ + \$(CC) $incs \$(CFLAGS) \$(CPPFLAGS) /EP /C "$args{generator}->[0]" > \$@.i && move /Y \$@.i \$@ EOF } } @@ -457,9 +471,15 @@ EOF $incs .= ' /I "'.$withargs{zlib_include}.'"'; } } - my $ecflags = { lib => '$(LIB_CFLAGS)', - dso => '$(DSO_CFLAGS)', - bin => '$(BIN_CFLAGS)' } -> {$args{intent}}; + my $cflags = '$(CFLAGS)'; + $cflags .= { lib => ' $(LIB_CFLAGS)', + dso => ' $(DSO_CFLAGS)', + bin => ' $(BIN_CFLAGS)' } -> {$args{intent}}; + $cflags .= $incs; + $cflags .= ' $(CPPFLAGS)'; + $cflags .= { lib => ' $(LIB_CPPFLAGS)', + dso => ' $(DSO_CPPFLAGS)', + bin => ' $(BIN_CPPFLAGS)' } -> {$args{intent}}; my $makedepprog = $config{makedepprog}; if ($srcs[0] =~ /\.rc$/) { return <<"EOF"; @@ -476,7 +496,7 @@ EOF } return <<"EOF" if (!$disabled{makedepend}); $obj$depext: $deps - \$(CC) \$(CFLAGS) $ecflags$inc /Zs /showIncludes $srcs 2>&1 | \\ + \$(CC) $cflags /Zs /showIncludes $srcs 2>&1 | \\ "\$(PERL)" -n << > $obj$depext chomp; s/^Note: including file: *//; @@ -484,13 +504,13 @@ s/^Note: including file: *//; END { print '$obj$objext: ',join(" ", sort keys \%collect),"\\n" } << $obj$objext: $obj$depext - \$(CC) $incs \$(CFLAGS) $ecflags -c \$(COUTFLAG)\$\@ @<< + \$(CC) $cflags -c \$(COUTFLAG)\$\@ @<< $srcs << EOF return <<"EOF" if ($disabled{makedepend}); $obj$objext: $deps - \$(CC) $incs \$(CFLAGS) $ecflags -c \$(COUTFLAG)\$\@ $srcs + \$(CC) $cflags -c \$(COUTFLAG)\$\@ $srcs EOF } |