【发布时间】:2020-02-27 10:49:33
【问题描述】:
我正在玩弄 GNU GCC makefile,并制作了这个简单的文件来构建“Hello, world!”。程序。
CC=gcc
SOURCES=./Source/main.c
BUILD_DIR=./Build
TARGET=main
all: $(BUILD_DIR)/$(TARGET).exe
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(SOURCES:.c=.o)))
vpath %.c $(sort $(dir $(SOURCES)))
$(BUILD_DIR)/%.o: %.c
$(CC) -c $< -o $@
$(BUILD_DIR)/%.exe: $(OBJECTS)
$(CC) $< -o $@
当我删除或评论这一行时,我不明白为什么
vpath %.c $(sort $(dir $(SOURCES))),make 停止并返回此错误:
> Executing task: D:\Servers\Compilers\MinGW\bin\mingw32-make.exe GCC_PATH=D:\Servers\Compilers\gcc-arm-none-eabi\bin <
mingw32-make: *** No rule to make target 'Build/main.exe', needed by 'all'. Stop.
你能解释一下为什么吗?
【问题讨论】:
-
将
--debug传递给make以查看更多信息。 -
我已经这样做了,但仍然没有找到有用的信息