I have the following two files. Whenever I call 'make', 'gzip' will be
called again. I'm wondering what is the correct way to write the
makefile such that gzip will not be called as long as test.txt.gz is
newer than test.sh.

$ cat Makefile
.PHONY: all

all: test.txt.gz

test.txt.gz: test.txt
        gzip $<

test.txt: test.sh
        ./$< > $@
$ cat test.sh
#!/usr/bin/env bash

echo test
$ make
./test.sh > test.txt
gzip test.txt
gzip: test.txt.gz already exists; do you wish to overwrite (y or n)? y


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to