Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
试图编写一个通用的Makefile,我发现隐式规则搜索还没有完成_Makefile - Fatal编程技术网

试图编写一个通用的Makefile,我发现隐式规则搜索还没有完成

试图编写一个通用的Makefile,我发现隐式规则搜索还没有完成,makefile,Makefile,您好,我正在尝试编写一个通用(基本)Makefile来编译基本的、实践的c程序。 我有一个src目录,我正在其中练习c编程。我的目录结构如下所示: practice/src/ex1.c ex2.c ex3.c practice/build blddir = ./build srcdir = ./src # RM="find $(blddir) -maxdepth 1 -executable -type f -name 'ex*'

您好,我正在尝试编写一个通用(基本)Makefile来编译基本的、实践的c程序。 我有一个src目录,我正在其中练习c编程。我的目录结构如下所示:

practice/src/ex1.c
             ex2.c
             ex3.c
practice/build
blddir = ./build
srcdir = ./src

# RM="find $(blddir) -maxdepth 1 -executable -type f -name 'ex*' -delete"

CFLAGS=-Wall -g

$(csrc): %.c
   $(CC) -o $(blddir)/$@  $(srcdir)/$^ # all prereqs

clean:
   find $(blddir) -maxdepth 1 -executable -type f -name 'ex*' -delete

我的Makefile如下所示:

practice/src/ex1.c
             ex2.c
             ex3.c
practice/build
blddir = ./build
srcdir = ./src

# RM="find $(blddir) -maxdepth 1 -executable -type f -name 'ex*' -delete"

CFLAGS=-Wall -g

$(csrc): %.c
   $(CC) -o $(blddir)/$@  $(srcdir)/$^ # all prereqs

clean:
   find $(blddir) -maxdepth 1 -executable -type f -name 'ex*' -delete

当我运行:
makeex6
时,我会遇到:
make:**没有规则将目标设置为“ex6”。停止。
当我运行时:
make-pex6 | less
…并搜索
ex6
我看到:

.DEFAULT_GOAL := src/ex6.c

src/ex6.c: %.c
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  recipe to execute (from 'Makefile', line 15):
    $(CC) -o $(blddir)/$@  $(srcdir)/$^ # all prereqs
我错过了什么

谢谢

…更多阅读更多测试,新(er)生成文件:

blddir = ./build
srcdir = ./src

CFLAGS=-Wall -g

% : $(srcdir)/%.c
   $(CC) -o $(blddir)/$@  $^ # all prereqs

制造ex6
…并且它可以工作

请检查Makefile:它不包括csrc的定义请检查Makefile:它不包括csrc的定义