From bdf18e4c5b7762ebfa027d275ba1012662732168 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Thu, 15 Jun 2017 11:29:35 -0400 Subject: [PATCH] nitc: use ccache again c02e04291807cf97228068cc5b52f453d84ab37b unexpectedly disable ccache. Since CC is set by default[1], the ?= attempt did never assign anything[2]. The solution is to assign unless if CC is set by another mean. This can be done thanks to the origin function[3]. [1]: https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html [2]: https://www.gnu.org/software/make/manual/html_node/Flavors.html [3]: https://www.gnu.org/software/make/manual/html_node/Origin-Function.html Signed-off-by: Jean Privat --- src/compiler/abstract_compiler.nit | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/compiler/abstract_compiler.nit b/src/compiler/abstract_compiler.nit index 31795fc..a3a0bc8 100644 --- a/src/compiler/abstract_compiler.nit +++ b/src/compiler/abstract_compiler.nit @@ -360,8 +360,12 @@ class MakefileToolchain var debug = toolcontext.opt_debug.value makefile.write """ -CC ?= ccache cc -CXX ?= ccache c++ +ifeq ($(origin CC), default) + CC = ccache cc +endif +ifeq ($(origin CXX), default) + CXX = ccache c++ +endif CFLAGS ?= -g {{{if not debug then "-O2" else ""}}} -Wno-unused-value -Wno-switch -Wno-attributes -Wno-trigraphs CINCL = LDFLAGS ?= -- 1.7.9.5