使不选择所需的目标

Make not picking the needed target

我已经为

下的程序编写了一个make文件
Panther!simpleguy:~/Code [62]$ cat make.def

CC = gcc
LIBS = -lpthread
CODE_FILE = Code_In_C.c
EXECUTABLE = Code_In_C

all : ${CODE_FILE}
        ${CC} -o ${EXECUTABLE} ${LIBS} ${CODE_FILE}

我试着用下面的命令来制作它

Panther!simpleguy:~/Code [63]$ make all make.def
make: *** No rule to make target `all'.  Stop.

为什么不选择 make 文件 (make.def) 中定义的 'all'?

根据 online GNU Make manual

Normally you should call your makefile either makefile or Makefile.

If you want to use a nonstandard name for your makefile, you can specify the makefile name with the -f or --file option. The arguments -f name or --file=name tell make to read the file name as the makefile.

因此,您应该使用以下语法指定具有非标准名称

的生成文件
make -f make.def all