bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "make -jN" requires mechanical changes to a Makefile [SOLVED]


From: Bruno Haible
Subject: Re: "make -jN" requires mechanical changes to a Makefile [SOLVED]
Date: Sun, 13 Sep 2020 21:11:23 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-189-generic; KDE/5.18.0; x86_64; ; )

> ===========================================
> all : copy1 copy2 copy3 copy4
> 
> copy1: Makefile
>       { test -f copy1 && test ! copy1 -ot Makefile; } || { rm -f copy4; 
> $(MAKE) copies; }
> copy2: copy1
>       { test -f copy2 && test ! copy2 -ot copy1; } || { rm -f copy4; $(MAKE) 
> copies; }
> copy3: copy2
>       { test -f copy3 && test ! copy3 -ot copy2; } || { rm -f copy4; $(MAKE) 
> copies; }
> copy4: copy3
>       { test -f copy4 && test ! copy4 -ot copy3; } || { rm -f copy4; $(MAKE) 
> copies; }
> 
> copies:
>       install -c -m 644 Makefile copy1
>       install -c -m 644 Makefile copy2
>       install -c -m 644 Makefile copy3
>       install -c -m 644 Makefile copy4
> .PHONY: copies
> ===========================================
> 
> This solution fulfils all the requirements.

It can be simplified a bit. And remove verbosity:

===========================================
all : copy1 copy2 copy3 copy4

copy1: Makefile
        @{ test -f copy1 && test ! copy1 -ot Makefile; } || $(MAKE) copies
copy2: copy1
        @{ test -f copy2 && test ! copy2 -ot copy1; } || $(MAKE) copies
copy3: copy2
        @{ test -f copy3 && test ! copy3 -ot copy2; } || $(MAKE) copies
copy4: copy3
        @{ test -f copy4 && test ! copy4 -ot copy3; } || $(MAKE) copies

copies:
        install -c -m 644 Makefile copy1
        install -c -m 644 Makefile copy2
        install -c -m 644 Makefile copy3
        install -c -m 644 Makefile copy4
.PHONY: copies
===========================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]