Hi,

I have the following two Makefiles. The difference between them are
that the commands are not the same. I don't understand why both rules
are executed in /tmp/double_targets_different_command and why only one
rule (always a, no matter what the order between a and b) is executed
in /tmp/double_targets_same_command. Would you please help me
understand it?

/tmp/double_targets_different_command$ make
a
touch a
b
touch b
/tmp/double_targets_different_command$ cat Makefile
.PHONY: all

all: a b

b: command.sh
        @echo b
        touch b

a: command.sh
        @echo a
        touch a

clean:
        $(RM) a b

/tmp/double_targets_same_command$ make
a
echo 'a' > a; sleep 1; echo 'b' > b
/tmp/double_targets_same_command$ cat Makefile
.PHONY: all

all: a b

b: command.sh
        @echo b
        echo 'a' > a; sleep 1; echo 'b' > b

a: command.sh
        @echo a
        echo 'a' > a; sleep 1; echo 'b' > b

clean:
        $(RM) a b

-- 
Regards,
Peng


_______________________________________________
Help-make mailing list
Help-make@gnu.org
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to