Quote the CFLAG in Unixly Makefiles, for buildinf.h
authorRichard Levitte <levitte@openssl.org>
Wed, 10 Feb 2016 18:09:05 +0000 (19:09 +0100)
committerRichard Levitte <levitte@openssl.org>
Wed, 10 Feb 2016 18:36:48 +0000 (19:36 +0100)
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 <rsalz@openssl.org>
Configurations/unix-Makefile.tmpl
Makefile.in
crypto/Makefile.in
crypto/build.info

index 4888dd0240603890a06cfc8cfb4ed0d43e5db449..65f179d486240b901c8b8c8207bdd1ae59aa2709 100644 (file)
@@ -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} -}
index 8083a54f7dfc6e1030b79140fcfacaad5893288f..a1c3252bc0a09beb9839e74adb904acb60a9e3b4 100644 (file)
@@ -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)'        \
index 4727e0aa75bf0caa2724f918029d9bdbec493f51..69556f8720480ac2503d8b1406677d1c5e7c717d 100644 (file)
@@ -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) > $@
index b3591a0fb8e5c51e11e823c91b6826d984a43d28..9d04ba8e0e5c1cc3635dd994f2ad1084460bdd1c 100644 (file)
@@ -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