> ===========================================
> 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