[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "make -jN" requires mechanical changes to a Makefile
From: |
Henrik Carlqvist |
Subject: |
Re: "make -jN" requires mechanical changes to a Makefile |
Date: |
Sun, 12 May 2019 23:15:53 +0200 |
On Sun, 12 May 2019 22:23:12 +0200
Bruno Haible <address@hidden> wrote:
> Now, when my use-case is:
> - one rule that produces N files (N > 1),
> - I want "make" to execute the rule only once, not N times,
> even with parallel make.
> What is the solution?
I think that the only good solution is to make sure than only 1 of the N
created files is a known target for the Makefile. If you write single
rules that on one call creates multiple targets your Makefile will not be
compatible with parallel make.
Example with one rule creating 4 files:
all : copy1
copy1: Makefile
install -c -m 644 Makefile copy1
install -c -m 644 Makefile copy2
install -c -m 644 Makefile copy3
install -c -m 644 Makefile copy4
A better way would be to have one rule to create multiple targets, but
only on target for each call, example:
all: copy1 copy2 copy3 copy4
copy%: Makefile
install -c -m 644 Makefile $@
The above simple Makefile would be fully compatible with parallel make.
regards Henrik
- "make -jN" requires mechanical changes to a Makefile, Bruno Haible, 2019/05/10
- Re: "make -jN" requires mechanical changes to a Makefile, Bruno Haible, 2019/05/12
- Re: "make -jN" requires mechanical changes to a Makefile, Paul Smith, 2019/05/12
- Re: "make -jN" requires mechanical changes to a Makefile, Bruno Haible, 2019/05/12
- Re: "make -jN" requires mechanical changes to a Makefile,
Henrik Carlqvist <=
- Re: "make -jN" requires mechanical changes to a Makefile, Bruno Haible, 2019/05/12
- Re: "make -jN" requires mechanical changes to a Makefile, Howard Chu, 2019/05/12
- Re: "make -jN" requires mechanical changes to a Makefile, Bruno Haible, 2019/05/12
- Re: "make -jN" requires mechanical changes to a Makefile, Henrik Carlqvist, 2019/05/13
- Re: "make -jN" requires mechanical changes to a Makefile, Edward Welbourne, 2019/05/13