I’ll explain myself, here is my scenario:
- Compile my target
- Do a first optimization based on the first compilation
- Do a second optimization based on the first optimization
- Do a third optimization based on the second optimization
So far I tried the following:
.SUFFIXES:
.SECONDARY:
OBJECTS := $(addsuffix .obj,$(SOURCES))
override OBJECTS := $(OBJECTS:$(SRC)/%.obj=$(OBJ)/%.obj)
OC1 := $(patsubst %.obj, %.oc1, $(filter %c.obj,$(OBJECTS)))
O1 := $(L166_CMD:%.lnp=%.o1)
all: $(TARGET) $(O1)
$(TARGET): $(OBJECTS)
@echo Linking $(TARGET)...
$(OBJ)/%.c.obj: $(SRC)/%.c
@echo Compiling $(<F) ...
# c.oc1 is a intermediate file
%.c.oc1: %.c.obj
@echo 1 - Optimize $<...
@touch $@
$(O1): $(OC1)
@touch $@
echo Linking O1
Result is, I modify a C file, the target will regenerate only the modified C file but the O1 pass will optimize all C files again like it was not done before (but it was).
How can I modify this behavior?
The reason is your last target,
$(O1): $(OC1). That is eachO1depends on everyOC1.What is the actual value of
$(O1)? Is it supposed to be a list or a single target?I would try to replace this rule by a pattern (if it possible).