[PATCH 1 of 3 bsdmake stable?] Makefile: alter how we compute compiler flags for setup.py

Augie Fackler raf at durin42.com
Thu Apr 21 15:30:04 UTC 2016


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1461247514 14400
#      Thu Apr 21 10:05:14 2016 -0400
# Branch stable
# Node ID 15b4ba1151e581c1e4b9833ce96a57bb6c468d9f
# Parent  8b6b6513c09f26df600b522773fef734e59816a8
Makefile: 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.

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,10 @@ TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
 # 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 @@ all: build doc
 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


More information about the Mercurial-devel mailing list