From 076e596ffb75e69c9f1aad5e06cabdd37595d695 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 10 Feb 2016 19:09:05 +0100 Subject: [PATCH] Quote the CFLAG in Unixly Makefiles, for buildinf.h Because the command line definitions of OPENSSLDIR and ENGINESDIR contain quotes, we need a variant of CFLAG where backslashes and quotes are escaped when we produce buildinf.h Reviewed-by: Rich Salz --- Configurations/unix-Makefile.tmpl | 3 ++- Makefile.in | 5 +++-- crypto/Makefile.in | 2 +- crypto/build.info | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index 4888dd0240..65f179d486 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -92,7 +92,8 @@ HTMLSUFFIX=html CROSS_COMPILE= {- $config{cross_compile_prefix} -} CC= $(CROSS_COMPILE){- $target{cc} -} -CFLAGS={- join(" ",(map { "-D".$_} @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $config{cflags} -} +CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $config{cflags} -} +CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -} DEPFLAGS= {- join(" ",map { "-D".$_} @{$config{depdefines}}) -} LDFLAGS= {- $config{lflags} -} PLIB_LDFLAGS= {- $config{plib_lflags} -} diff --git a/Makefile.in b/Makefile.in index 8083a54f7d..a1c3252bc0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -90,7 +90,8 @@ ENGINESDIR={- use File::Spec::Functions; CROSS_COMPILE= {- $config{cross_compile_prefix} -} CC= $(CROSS_COMPILE){- $target{cc} -} -CFLAG={- join(" ",(map { "-D".$_} @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $config{cflags} -} +CFLAG={- our $cflags2 = join(" ",(map { "-D".$_} @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $config{cflags} -} +CFLAG_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -} DEPFLAG= {- join(" ",map { "-D".$_} @{$config{depdefines}}) -} LDFLAG= {- $config{lflags} -} PLIB_LDFLAG= {- $config{plib_lflags} -} @@ -243,7 +244,7 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \ # LC_ALL=C ensures that error [and other] messages are delivered in # same language for uniform treatment. BUILDENV= LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\ - CC='$(CC)' CFLAG='$(CFLAG)' \ + CC='$(CC)' CFLAG='$(CFLAG)' CFLAG_Q='$(CFLAG_Q)' \ AS='$(CC)' ASFLAG='$(CFLAG) -c' \ AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)' \ CROSS_COMPILE='$(CROSS_COMPILE)' \ diff --git a/crypto/Makefile.in b/crypto/Makefile.in index 4727e0aa75..69556f8720 100644 --- a/crypto/Makefile.in +++ b/crypto/Makefile.in @@ -58,7 +58,7 @@ fips: cryptlib.o thr_id.o uid.o $(CPUID_OBJ) done; buildinf.h: ../Makefile - $(PERL) $(TOP)/util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)" >buildinf.h + $(PERL) $(TOP)/util/mkbuildinf.pl "$(CC) $(CFLAGS_Q)" "$(PLATFORM)" >buildinf.h x86cpuid.s: x86cpuid.pl perlasm/x86asm.pl $(PERL) x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ diff --git a/crypto/build.info b/crypto/build.info index b3591a0fb8..9d04ba8e0e 100644 --- a/crypto/build.info +++ b/crypto/build.info @@ -17,7 +17,7 @@ ENDRAW[descrip.mms] BEGINRAW[Makefile] crypto/buildinf.h : Makefile - $(PERL) $(SRCDIR)/util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)" > crypto/buildinf.h + $(PERL) $(SRCDIR)/util/mkbuildinf.pl "$(CC) $(CFLAGS_Q)" "$(PLATFORM)" > crypto/buildinf.h ##### APPLINK, UPLINK and CPUID assembler implementations -- 2.25.1