On Fri, 2012-11-09 at 19:22 +0200, Oleksandr Gavenko wrote:
> %.o: %.c
>         COMPILE...
> 
> and handle complete build by:
> 
> C_FILES := $(wildcard */*.c */*/*.c */*/*/*.c)
> O_FILES := $(C_FILES:.c=.o)
> 
> %.o: %.c
>         COMPILE...
> 
> $(APP): $(O_FILES)
>         LINK...
> 
> The only difference - all .o files put to corresponding subdirs instead root
> dir.
> 
> If you still want put it to any dir write:
> 
> .PHONY: copy-to-root
> copy-to-root: $(O_FILES)
>       cp $^ .
> 
> but you loose make dependencies tracking...

Simpler than this is to use VPATH; that's what it's for.

        VPATH = test/a test/b
        
        %.o : %.c
                COMPILE ...
        
        all: a.o b.o



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

Reply via email to