我写了一个makefile,其中的命令序列在我的makefile中如下
.PHONY: all clean distclean run
run : $(program_NAME)
./$(program_NAME) > output.txt #runs my program and stotre output in output.txt
all: $(program_NAME)
$(program_NAME): $(program_OBJS)
$(LINK.cc) $(program_OBJS) -o $(program_NAME)
如果我将其顺序更改为以下一个,它对我不起作用:-
.PHONY: all clean distclean run
$(program_NAME): $(program_OBJS)
$(LINK.cc) $(program_OBJS) -o $(program_NAME)
all: $(program_NAME)
run : $(program_NAME)
./$(program_NAME) > output.txt #runs my program and stotre output in output.txt
这doesnot generate any output.txt
对我来说。我觉得run :
取决于 $(program_NAME) 所以$(program_NAME): $(program_OBJS)
$(LINK.cc) $(program_OBJS) -o $(program_NAME)s
应该run :
在makefile之前出现。但反过来它工作正常。有人可以在这里发光吗?(谢谢)