changeset 29003:c6b108555dfa stable

make: alter how we compute compiler flags for setup.py This is portable between BSD and GNU make. I'm not thrilled with how it worked out, but it's portable and solves the problem.
author Augie Fackler <augie@google.com>
date Thu, 21 Apr 2016 10:05:14 -0400
parents ea794f2eb19d
children 145cdc45b0df
files Makefile
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sat Apr 23 16:11:05 2016 +0900
+++ b/Makefile	Thu Apr 21 10:05:14 2016 -0400
@@ -19,6 +19,10 @@
 # Set this to e.g. "mingw32" to use a non-default compiler.
 COMPILER=
 
+COMPILERFLAG_tmp_ =
+COMPILERFLAG_tmp_${COMPILER} ?= -c $(COMPILER)
+COMPILERFLAG=${COMPILERFLAG_tmp_${COMPILER}}
+
 help:
 	@echo 'Commonly used make targets:'
 	@echo '  all          - build program and documentation'
@@ -43,16 +47,16 @@
 local:
 	$(PYTHON) setup.py $(PURE) \
 	  build_py -c -d . \
-	  build_ext $(COMPILER:%=-c %) -i \
-	  build_hgexe $(COMPILER:%=-c %) -i \
+	  build_ext $(COMPILERFLAG) -i \
+	  build_hgexe $(COMPILERFLAG) -i \
 	  build_mo
 	env HGRCPATH= $(PYTHON) hg version
 
 build:
-	$(PYTHON) setup.py $(PURE) build $(COMPILER:%=-c %)
+	$(PYTHON) setup.py $(PURE) build $(COMPILERFLAG)
 
 wheel:
-	FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILER:%=-c %)
+	FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILERFLAG)
 
 doc:
 	$(MAKE) -C doc