[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: weird rm command caused by pattern rules?
From: |
Greg Chicares |
Subject: |
Re: weird rm command caused by pattern rules? |
Date: |
Sun, 10 Jul 2011 11:51:26 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 |
On 2011-07-09 17:13Z, Can Finner wrote:
>
> TEST_OBJ = $(patsubst %.c,%.o,$(TEST_SRC))
> %.o : %.c
> gcc -c -o address@hidden ${<}
> %.exe : ${TEST_OBJ}
> gcc $^ -o $@
> .PHONY: all clean
> all: a.exe
[...]
> Then I ran following command in cmd:
> $ make TEST_SRC=src/a.c all
> the out put is like:
>
> gcc -c -o src/a.o src/a.c
> gcc src/a.o -o a.exe
> rm src/a.o
>
> I am very curious where the last rm command comes from? seems some
> kind of relate to the pattern rules.
See "Chains of Implicit Rules" in the 'make' manual. If you want to
preserve the intermediate '.o' file, you can add '.PRECIOUS: %.o'.