Patchwork [1,of,3,bsdmake] Makefile: switch from GNUMake-ism to shell evaluation

login
register
mail settings
Submitter Augie Fackler
Date April 21, 2016, 2:16 p.m.
Message ID <962950235062ec2e80c7.1461248201@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/14760/
State Changes Requested
Headers show

Comments

Augie Fackler - April 21, 2016, 2:16 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1461247514 14400
#      Thu Apr 21 10:05:14 2016 -0400
# Branch stable
# Node ID 962950235062ec2e80c73f20083bb20c2773d681
# Parent  8b6b6513c09f26df600b522773fef734e59816a8
Makefile: switch from GNUMake-ism to shell evaluation

This is portable between BSD and GNU make.
Augie Fackler - April 21, 2016, 2:19 p.m.
Discard these for now, this $(COMPILER) one is slightly busted.

On Thu, Apr 21, 2016 at 10:16 AM, Augie Fackler <raf@durin42.com> wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1461247514 14400
> #      Thu Apr 21 10:05:14 2016 -0400
> # Branch stable
> # Node ID 962950235062ec2e80c73f20083bb20c2773d681
> # Parent  8b6b6513c09f26df600b522773fef734e59816a8
> Makefile: switch from GNUMake-ism to shell evaluation
>
> This is portable between BSD and GNU make.
>
> diff --git a/Makefile b/Makefile
> --- a/Makefile
> +++ b/Makefile
> @@ -19,6 +19,8 @@ TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
>  # Set this to e.g. "mingw32" to use a non-default compiler.
>  COMPILER=
>
> +COMPILERFLAG != [ -z "$(COMPILER)" ] || echo "-c $(COMPILER)"
> +
>  help:
>         @echo 'Commonly used make targets:'
>         @echo '  all          - build program and documentation'
> @@ -43,16 +45,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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,8 @@  TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
 # Set this to e.g. "mingw32" to use a non-default compiler.
 COMPILER=
 
+COMPILERFLAG != [ -z "$(COMPILER)" ] || echo "-c $(COMPILER)"
+
 help:
 	@echo 'Commonly used make targets:'
 	@echo '  all          - build program and documentation'
@@ -43,16 +45,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