makefile - making source in subfolder question -
makefile - making source in subfolder question -
i have makefile compiles *.c files in subfolder:
objects := $(patsubst %.c,%.o,$(wildcard *.c)) cobj: $(objects) $(objects): %.o: %.c $(cc) -c $< -o $@
i having problem trying same parent folder. lets .c files in folder 'csrc'
objects := $(addprefix, csrc/, $(patsubst %.c,%.o,$(wildcard *.c))) cobj: $(objects) $(objects): csrc/%.o: %.c $(cc) -c $< -o $@
i see "nothing cobj... ideas?
your pattern rule csrc/%.o: %.c
translates e.g. csrc/foo.o
foo.c
, not csrc/foo.c
. presumably, not want.
why not %.o: %.c
?
makefile gnu-make
Comments
Post a Comment