SOURCE := ../Src/Folder1/source.a66
OBJ := ../Src/Folder1/source._ia
OUT := ../Obj
all: $(OBJ)
echo "DONE"
# 1) Works
%._ia: %.a66
echo "Test" > $@
# 2) Don't work
$(OUT)/%._ia: %.a66
echo "Test" > $@
../Src/Folder1
make: *** No rule to make target '../Src/Folder1/Os_cpu_a._ia', needed by '../Obj/target'. Stop.
答案 0 :(得分:2)
至少你必须修改all
的先决条件(值$(OBJ)
):
OBJ := ../Obj/Folder1/source._ia
然后按如下方式修改模式规则:
../Obj/%._ia: ../Src/%.a66
echo "Test" > $@
最后,在将../Obj
和../Src
提取到变量之后,你会得到类似的内容:
SRC_DIR := ../Src
OBJ_DIR := ../Obj
SRC := $(SRC_DIR)/Folder1/source.a66
OBJ := $(SRC:$(SRC_DIR)/%.a66=$(OBJ_DIR)/%._ia)
$(OBJ_DIR)/%._ia: $(SRC_DIR)/%.a66
echo "Test" > $@