makefile调用makefile错误

发布于 2024-07-09 09:01:19 字数 1088 浏览 8 评论 0原文

我有一个可用的品牌,我有平台代码以及文件夹中每个操作系统的多个品牌。 现在我有一个可以工作的 makefile。 我将其重命名为 Makefile.ws 并将其写入 Makefile

all:
    make -f Makefile.w32

clean:
    make -f Makefile.w32 clean

我运行它并收到此错误

> "make" 
make -f Makefile.w32
make[1]: Entering directory `/c/nightly/test'
make -f Makefile.w32
make[3]: Makefile.w32: No such file or directory
make[3]: *** No rule to make target `Makefile.w32'.  Stop.
make[2]: *** [all] Error 2
make[1]: *** [build] Error 2
make[1]: Leaving directory `/c/nightly/test'
"make": *** [all] Error 2

奇怪的是 clean 工作完美。 然后我决定编写“make -f Makefile.w32 mingw32”,但它无法正常工作。 事实上,它创建了一个名为 mingw32 的文件夹,我认为这很奇怪。

至于 mingw32 规则,我只是复制构建,我怀疑这是用于构建

$(BUILD):
    @[ -d $@ ] || mkdir -p $@
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

mingw32:
    @[ -d $@ ] || mkdir -p $@
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

完整 .w32 源的主要/正常规则,在这里 http://pastie.org/320035

I have a working make, I have platform code and like several makes for each os in the folder. Right now I have one makefile which works. I renamed it to Makefile.ws and wrote this in Makefile

all:
    make -f Makefile.w32

clean:
    make -f Makefile.w32 clean

I ran it and got this error

> "make" 
make -f Makefile.w32
make[1]: Entering directory `/c/nightly/test'
make -f Makefile.w32
make[3]: Makefile.w32: No such file or directory
make[3]: *** No rule to make target `Makefile.w32'.  Stop.
make[2]: *** [all] Error 2
make[1]: *** [build] Error 2
make[1]: Leaving directory `/c/nightly/test'
"make": *** [all] Error 2

Oddly enough the clean works perfectly. Then I decided to write "make -f Makefile.w32 mingw32" and that did not work correctly. In fact it made a folder called mingw32 which I thought was very strange.

As for the mingw32 rule I just copy build which I suspect is the main/normal rule that is used to build

$(BUILD):
    @[ -d $@ ] || mkdir -p $@
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

mingw32:
    @[ -d $@ ] || mkdir -p $@
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

full .w32 source is here http://pastie.org/320035

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

动听の歌 2024-07-16 09:01:20

我想我在你的第二个例子中看到了问题。 应更改 mingw32 行,使其不包含 $(BUILD) 变量:

mingw32:
    @[ -d $@ ] || mkdir -p $@
    @make --no-print-directory -C mingw32 -f $(CURDIR)/Makefile

I think I see the problem in your second example. The mingw32 line should be changed so that it does not include the $(BUILD) variable:

mingw32:
    @[ -d $@ ] || mkdir -p $@
    @make --no-print-directory -C mingw32 -f $(CURDIR)/Makefile
翻了热茶 2024-07-16 09:01:20
  1. 很明显他创建了这个目录,
    你给定的 2 条规则中的第一个命令,包括一个带有对象名称的 mkdir,即 build 或 mingw32
  2. 之后,他更改为当前目录(即根本没有 cd)并执行 Makefile。 但正如您所写,您将 Makefile 重命名为 Makefile.ws,因此您当然会收到 File-Not-Found-error。

从这些问题来看,我只能建议您看一下简短的介绍,甚至更好的 make 手册。

  1. It is clear that he created the directory,
    your first command in your given 2 rules, include a mkdir with the object name, i.e. either build or mingw32
  2. Afterwards he changes into the current directory (i.e. no cd at all) and execute Makefile. But as you wrote you renamed Makefile into Makefile.ws, so offcourse you are getting File-Not-Found-error.

From the questions I can only recommend you to have a look at an short introduction or even better the manual for make.

太傻旳人生 2024-07-16 09:01:20

make -f ...调用辅助 makefile

您是否尝试过使用$(MAKE) -f ...

而不是

Have you tried calling the secondary makefile using

$(MAKE) -f ...

instead of

make -f ...?

仲春光 2024-07-16 09:01:19

首先,你运行什么品牌? Cygwin 或 MinGW,还是其他什么?

make -f Makefile.w32
make[1]: Entering directory `/c/nightly/test'
make -f Makefile.w32 
make[3]: Makefile.w32: No such file or directory

“进入目录”是一个提示。 为什么进入/c/nightly/test? 那里有 Makefile.w32 吗?

至于创建目录“mingw32”,该规则

mingw32:
        @[ -d $@ ] || mkdir -p $@
        ...

正是这样做的。 如果“mingw32”不存在,则会创建它。

如果您有一个更短的示例并清楚地解释您想要完成的任务以及您期望发生的事情,那么会更容易为您提供帮助。

First, what make are you running? Cygwin or MinGW, or something else?

make -f Makefile.w32
make[1]: Entering directory `/c/nightly/test'
make -f Makefile.w32 
make[3]: Makefile.w32: No such file or directory

"Entering directory" is a hint. Why is it entering /c/nightly/test? Is there a Makefile.w32 there?

As to creating the directory "mingw32", the rule

mingw32:
        @[ -d $@ ] || mkdir -p $@
        ...

does exactly that. If "mingw32" does not exist, it creates it.

It would be easier to help you if you had a shorter example and clearly explain what you want to accomplish and what you expect to happen.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文