【发布时间】:2017-09-22 21:14:49
【问题描述】:
我在这个目录下写了一个 Makefile:
.
├── bin
│ └── obj
├── include
│ ├── globals.h
│ ├── ma.h
│ ├── mb.h
│ ├── mc.h
│ └── md.h
├── Makefile
├── Makefile.save
├── src
│ ├── ma.c
│ ├── main.c
│ ├── mb.c
│ ├── mc.c
│ └── md.c
└── test
├── main.c
└── main.o
我的 Makefile 如下:
CFLAGS := -Wall -g -pedantic --std=c99
objs := bin/obj/ma.o bin/obj/mb.o bin/obj/mc.o bin/obj/md.o bin/obj/main.o
all: $(objs)
%.o: %.c
gcc -c $< -o $@ $(CFLAGS)
但我无法使用 make 命令执行;程序给了我这个错误:
make: *** No rule to make target 'bin/obj/ma.o', needed by 'all'. Stop.
有人有想法吗?
【问题讨论】:
-
您的 c 文件在 src 文件夹中,为什么是 bin ?你可以使用 obj/*