Make an output rule for files in a folder

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 to be in the root of my project folder and in the object files in a subfolder (say Debug/).

Inference Rule:

.ss.obj:
    echo Assembling $*.ss...
    $(ASSEMBLY) $(2210_ASSEMBLY_FLAGS) $*.ss -o Debug\$*.obj 

but in this case, it is necessary to constantly rebuild all the files, since there is no .obj in the root folder.

Is there a way to include a folder for a target in a string .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 in this way:

OBJS_WITH_PATH = $(patsubst %.ss,Debug\\%.obj,$(SRC))

but this creates a dependency on all source files for all object files.

I would like to change the output rule that I wrote at the beginning to take files Debug/*.obj. Now he is speaking no rule to make target Debug/asdfasdf.obj.

+3
1

:

Debug/%.obj : %.ss
+3

Source: https://habr.com/ru/post/1742422/


All Articles