ifeq 问题我尝试理解
这是我的第一个问题,也是我第一次管理 GNU Make,所以我想解释一下我的问题。也许你可以帮助我找到隧道尽头的光明。
我想做的就是在我的路径中检查一个单词,并在检查路径后执行一些操作,
我已经在 make 上得到了该代码:
WORD=GNUMAKE; \
FOUND=1; \
echo "$$FOUND"; \
PWD=$(PWD); \
ifeq ($(findstring $$WORD,$$PWD),) \
$(warning list contains "$$WORD") \
endif
但是当我运行 $make 时,我收到此错误,对我来说很奇怪,找不到解决方案 请你帮助我好吗?
/bin/sh: syntax error at line 1: `ifeq' unexpected
make: *** [all] Error 2
谢谢
is my first question here and first time I manage GNU Make so I want to explain my problem.perhaps you could help me to find a light at the end of this tunnel.
That thing Im trying to do is to check a word into my path and do something after check path
I've got that code on make:
WORD=GNUMAKE; \
FOUND=1; \
echo "$FOUND"; \
PWD=$(PWD); \
ifeq ($(findstring $WORD,$PWD),) \
$(warning list contains "$WORD") \
endif
but when I run $make I get this error, for me so strange and can't find a solution
could you please help me?
/bin/sh: syntax error at line 1: `ifeq' unexpected
make: *** [all] Error 2
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Gnu make 将使用
\
连接的行视为单行。 ifeq 等。等人。需要在自己的行上,就像 C 中的#ifdef
(如果这对您有帮助的话)。您似乎对 make 的作用感到相当困惑。
Make 在三个不同的阶段执行 makefile:
您可以让 make 在读取 makefile 时执行您的命令,
或者您可以让 make 在将命令传递到 shell 时执行此操作(即,之前 > shell 被执行):
或者确实让 shell 执行它。
Gnu make treats lines joined with
\
as a single line.ifeq
et. al. need to be on their own line, rather like#ifdef
in C (if that's any help to you).You seem rather confused over what make does.
Make executes a makefile in three distinct phases:
You can get make to do your bidding as it reads the makefile
Or you can get make to do this just as it is making the command to pass to the shell (i.e., before the shell is executed):
Or indeed get the shell to do it.
您将 make 命令与 shell 命令混为一谈。 ifeq 显然属于 make,但不知何故进入了 shell。
这将在当前路径中找到 GNUMAKE 单词的出现,即它将是父目录之一。将其放入 Makefile 并调用 make。
You are messing make commands with shell commands. ifeq is apparently belongs to make but got into shell somehow.
This will find occurance of GNUMAKE word in current path, i.e. it will be one of parent directories. Put this into Makefile and call make.
这正是我所设定的
希望有帮助
that is exactly what I have been set
hope it helps