]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Improve safety of caching from r289659 by only importing of none of the
authorbdrewery <bdrewery@FreeBSD.org>
Tue, 20 Oct 2015 20:37:00 +0000 (20:37 +0000)
committerbdrewery <bdrewery@FreeBSD.org>
Tue, 20 Oct 2015 20:37:00 +0000 (20:37 +0000)
variables are already set.  This should cover odd cases such as the
COMPILER_TYPE override in lib/csu/powerpc64.

X-MFC-With: r289659
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division

share/mk/bsd.compiler.mk

index 46cc8c37d1982a62ddc57cc3cd80e1c21924804d..3ba5130b81f3c4535b0be9958eebcf69c6968700 100644 (file)
@@ -31,11 +31,20 @@ __<bsd.compiler.mk>__:
 _exported_vars=        COMPILER_TYPE COMPILER_VERSION
 _cc_hash=      ${CC}${MACHINE}${PATH}
 _cc_hash:=     ${_cc_hash:hash}
+# Only import if none of the vars are set somehow else.
+_can_export=   yes
+.for var in ${_exported_vars}
+.if defined(${var})
+_can_export=   no
+.endif
+.endfor
+.if ${_can_export} == yes
 .for var in ${_exported_vars}
 .if defined(${var}.${_cc_hash})
 ${var}=        ${${var}.${_cc_hash}}
 .endif
 .endfor
+.endif
 
 .if ${MACHINE} == "common"
 # common is a pseudo machine for architecture independent