build - Multiple wildcards in GNU Makefile Pattern -
my filetree looks this:
makefile src/foo/foo.c src/bar/bar.c build/bin/ build/libs/ each sub-directory contains other files related source, want structure. since have many foos , more bars, thought of pattern rule:
progs=foo bar : $(progs) % :: src/%/%.c @echo $@ $< unfortunately make not recognize valid pattern:
make: *** no rule make target `foo', needed `all'. stop. however, if keep files in src/ directory, single % works expected:
% :: src/%.c @echo $@ $< output: foo src/foo bar src/bar is there way without giving structure?
use vpath:
progs=foo bar : $(progs) % : %.c @echo $@ $< vpath %.c src/foo src/bar and if want put binaries in build/bin/,
progs = build/bin/foo build/bin/bar : $(progs) build/bin/% : %.c @echo $@ $< vpath %.c src/foo src/bar
Comments
Post a Comment