summaryrefslogtreecommitdiffstats
path: root/Configurations/unix-Makefile.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'Configurations/unix-Makefile.tmpl')
-rw-r--r--Configurations/unix-Makefile.tmpl38
1 files changed, 31 insertions, 7 deletions
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index f5c1014cc6..4c4506bfb4 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -184,20 +184,33 @@ HTMLSUFFIX=html
ECHO = echo
CROSS_COMPILE= {- $config{cross_compile_prefix} -}
+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 -}
CC= $(CROSS_COMPILE){- $target{cc} -}
-CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -}
-CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
+CFLAGS={- $target{cflags} -} {- $config{cflags} -}
CXX= $(CROSS_COMPILE){- $target{cxx} -}
-CXXFLAGS={- our $cxxflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cxxflags} -} {- $config{cxxflags} -} -std=c++11
+CXXFLAGS={- $target{cxxflags} -} {- $config{cxxflags} -} -std=c++11
LDFLAGS= {- $config{lflags} -} {- $target{lflags} -}
PLIB_LDFLAGS= {- $target{plib_lflags} -}
EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
+LIB_CPPFLAGS={- join(" ",
+ (map { "-D".$_}
+ 'OPENSSLDIR="\"$(OPENSSLDIR)\""',
+ 'ENGINESDIR="\"$(ENGINESDIR)\""'),
+ $target{shared_cppflag} || "") -}
LIB_CFLAGS={- $target{shared_cflag} || "" -}
LIB_CXXFLAGS={- $target{shared_cxxflag} || "" -}
LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} -}
+DSO_CPPFLAGS={- $target{dso_cppflags} || "" -}
DSO_CFLAGS={- $target{dso_cflags} || "" -}
DSO_CXXFLAGS={- $target{dso_cxxflags} || "" -}
DSO_LDFLAGS={- $target{dso_lflags} || "" -}
+BIN_CPPFLAGS={- $target{bin_cppflags} || "" -}
BIN_CFLAGS={- $target{bin_cflags} || "" -}
BIN_CXXFLAGS={- $target{bin_cxxflags} || "" -}
BIN_LDFLAGS={- $target{bin_lflags} || "" -}
@@ -844,7 +857,7 @@ EOF
$target: $args{generator}->[0] $deps
( trap "rm -f \$@.*" INT 0; \\
$generator \$@.S; \\
- \$(CC) $incs \$(CFLAGS) -E \$@.S | \\
+ \$(CC) $incs \$(CFLAGS) \$(CPPFLAGS) -E \$@.S | \\
\$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\
mv -f \$@.i \$@ )
EOF
@@ -857,7 +870,7 @@ EOF
}
return <<"EOF";
$args{src}: $args{generator}->[0] $deps
- \$(CC) $incs \$(CFLAGS) -E $args{generator}->[0] | \\
+ \$(CC) $incs \$(CFLAGS) \$(CPPFLAGS) -E $args{generator}->[0] | \\
\$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
EOF
}
@@ -884,23 +897,34 @@ EOF
}
}
my $cmd = '$(CC)';
- my $cmdflags = '$(CFLAGS) -c';
+ my $cmdflags = '$(CFLAGS)';
+ my $cmdcompile = ' -c';
my $makedepprog = $disabled{makedepend} ? undef : $config{makedepprog};
if (grep /\.rc$/, @srcs) {
$cmd = '$(RC)';
$cmdflags = '$(RCFLAGS)';
+ $cmdcompile = '';
$makedepprog = undef;
} elsif (grep /\.(cc|cpp)$/, @srcs) {
$cmd = '$(CXX)';
- $cmdflags = '$(CXXFLAGS) -c';
+ $cmdflags = '$(CXXFLAGS)';
$cmdflags .= ' ' . { lib => '$(LIB_CXXFLAGS)',
dso => '$(DSO_CXXFLAGS)',
bin => '$(BIN_CXXFLAGS)' } -> {$args{intent}};
+ $cmdflags .= ' $(CPPFLAGS)';
+ $cmdflags .= ' ' . { lib => '$(LIB_CPPFLAGS)',
+ dso => '$(DSO_CPPFLAGS)',
+ bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
} else {
$cmdflags .= ' ' . { lib => '$(LIB_CFLAGS)',
dso => '$(DSO_CFLAGS)',
bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
+ $cmdflags .= ' $(CPPFLAGS)';
+ $cmdflags .= ' ' . { lib => '$(LIB_CPPFLAGS)',
+ dso => '$(DSO_CPPFLAGS)',
+ bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
}
+ $cmdflags .= $cmdcompile;
my $recipe = <<"EOF";
$obj$objext: $deps
EOF