[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU Make 4.2 Query
From: |
Kaz Kylheku (gmake) |
Subject: |
Re: GNU Make 4.2 Query |
Date: |
Sun, 01 Sep 2019 21:31:12 -0700 |
User-agent: |
Roundcube Webmail/0.9.2 |
Hi nihkil,
Try using a "macro":
# $(1) is retry count: integer constant in shell test syntax
# $(2) is command
#
define retry-times
i=0; while [ $$i -lt $(1) ]; do ($(2)) && exit 0; i=$$(( i + 1 ));
done ; exit 1
endef
target: prerequisite
$(call retry-times,5,your command here)
Fixed retries version:
# $(1) is command
#
define retry-3-times
($(1)) && exit 0 || ($(1)) && exit 0 || ($(1)) && exit 0 || exit 1
endef
target: prerequisite
$(call retry-3-times,your command here)
We insert the command in parentheses not just for syntactic hygiene but
to get it to run in a subshell. This way our command can contain
subcommands like "exit 1" without terminating the retry logic.
Cheers ...
On 2019-09-01 12:48, nikhil jain wrote:
Ok, thanks.
On Sat, 31 Aug 2019, 19:44 Paul Smith, <address@hidden> wrote:
On Fri, 2019-08-30 at 16:37 +0530, nikhil jain wrote:
> Does GMAKE has a retry option. If a command in a rule is failed, is
> there an option to retry it or I have to implement it ?
GNU make has no built-in facility to retry failed commands.
_______________________________________________
Help-make mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-make
- Re: GNU Make 4.2 Query, nikhil jain, 2019/09/01
- Re: GNU Make 4.2 Query,
Kaz Kylheku (gmake) <=
- Re: GNU Make 4.2 Query, nikhil jain, 2019/09/02
- Re: GNU Make 4.2 Query, Kaz Kylheku (gmake), 2019/09/02
- Re: GNU Make 4.2 Query, nikhil jain, 2019/09/02
- Re: GNU Make 4.2 Query, Paul Smith, 2019/09/02
- Re: GNU Make 4.2 Query, nikhil jain, 2019/09/02
- Re: GNU Make 4.2 Query, Paul Smith, 2019/09/02
- Re: GNU Make 4.2 Query, nikhil jain, 2019/09/02
- Re: GNU Make 4.2 Query, David Boyce, 2019/09/02
- Re: GNU Make 4.2 Query, nikhil jain, 2019/09/02
- Re: GNU Make 4.2 Query, David Boyce, 2019/09/02