On 2011-07-09 17:13Z, Can Finner wrote:
>
> TEST_OBJ = $(patsubst %.c,%.o,$(TEST_SRC))
> %.o : %.c
> gcc -c -o ${@} ${<}
> %.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'.
_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make