Makefiles、符号链接文件夹和相对路径

发布于 2024-08-26 23:08:54 字数 223 浏览 7 评论 0原文

假设我有以下文件夹:

/A/C

/D/B/E

/D/B/C (这是由 ln -s 创建的 /A/C 的符号链接)

当其中一个 makefile 尝试使用该路径时/D/B/C/../E 它收到“没有文件或目录”错误。我明白为什么会发生这种情况; /A/E 不存在。但是我必须使用符号链接来填充 B 文件夹并创建构建树(很长的故事)。

有什么想法吗?

Let say I have the following folders:

/A/C

/D/B/E

/D/B/C (this is a symlink to /A/C created by ln -s)

When one of the makefiles tries to use the path /D/B/C/../E it gets a "no file or directory" error. I understand why this happens; /A/E does not exist. However I have to use symlinks to populate the B folder and create the build tree (very long story).

Any ideas?

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

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

发布评论

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

评论(2

擦肩而过的背影 2024-09-02 23:08:54

我更改了链接文件夹的方式:

/D/B/C 现在是指向 ../../A/C 的链接,而不是 /A/C

I have changed the way I link the folders:

/D/B/C is now a link to ../../A/C insted of /A/C

窗影残 2024-09-02 23:08:54

我无法想象你如何构建像“D/B/C/../E”这样的路径,但你可以进行一些文本处理来清理它。

使用 Make 函数可以做到这一点,但有点难看。我建议将其委托给 shell:

PATH := $(shell echo $(PATH) | sed '|/[^/]*/\.\.||g')

I can't imagine how you constructed a path like "D/B/C/../E", but you could do some text processing to clean it up.

Doing it with the Make functions is possible, but kind of ugly. I recommend delegating it to the shell:

PATH := $(shell echo $(PATH) | sed '|/[^/]*/\.\.||g')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文