make inference rule for files in a folder
Posted
by Gauthier
on Stack Overflow
See other posts from Stack Overflow
or by Gauthier
Published on 2010-04-23T09:12:59Z
Indexed on
2010/04/23
9:23 UTC
Read the original article
Hit count: 341
I use GNU make, I want my source files and object files to be in different folders.
As a first step, I want the source files at the root of my project folder, and the object files in a subfolder (say Debug/
).
The inference rule would be:
.ss.obj:
echo Assembling $*.ss...
$(ASSEMBLY) $(2210_ASSEMBLY_FLAGS) $*.ss -o Debug\$*.obj
but in that case, make rebuilds all files all the time, since there are no .obj in the root folder.
Is there a way to include a folder for the target in the line .ss.obj
?
I also tried:
$(OBJS_WITH_PATH):$(SRC)
echo Assembling $<...
$(ASSEMBLY) $(ASSEMBLY_FLAGS) $< -o $@
with $(SRC)
as a list of all my sources, $(OBJS_WITH_PATH)
built that way:
OBJS_WITH_PATH = $(patsubst %.ss,Debug\\%.obj,$(SRC))
but that builds a dependency on all source files for all object files.
What I would like is to modify the inference rule I wrote first, to take Debug/*.obj
files. What it says now is no rule to make target Debug/asdfasdf.obj
.
© Stack Overflow or respective owner