AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题

问题[gnu-make](unix)

Martin Hope
Stan Huang at Taiwan
Asked: 2024-03-01 10:03:30 +0800 CST

为什么会出现“arm-linux-gcc:未找到”这样的错误?

  • 4

为了构建我的主板的 u-boot,我遵循了以下两个命令:

$ sudo make nanopi_h3_defconfig ARCH=arm CROSS_COMPILE=arm-linux-
$ sudo make ARCH=arm CROSS_COMPILE=arm-linux-

我从第一个命令得到结果:配置写入.config 这意味着成功。但从第二个命令得到以下内容:

make: arm-linux-gcc: No such file or directory
/bin/sh: 1: arm-linux-gcc: not found
dirname: missing operand
Try 'dirname --help' for more information.
scripts/kconfig/conf  --silentoldconfig Kconfig
./scripts/binutils-version.sh: line 18: arm-linux-as: command not found
  CHK     include/config.h
  CFG     u-boot.cfg
/bin/sh: 1: arm-linux-gcc: not found
make[1]: *** [scripts/Makefile.autoconf:79: u-boot.cfg] Error 1
make: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/uboot.release'.  Stop.

似乎来自arm-linux-gcc的麻烦,但我运行了命令“arm-linux-gcc”,它有效。那么,为什么第一个命令可以通过arm-linux-gcc,而第二个命令却失败了呢?

gnu-make
  • 1 个回答
  • 36 Views
Martin Hope
Dominick Pastore
Asked: 2022-04-28 20:52:50 +0800 CST

为什么 echo -e 在 Makefile 中表现得很奇怪?

  • 15

我正在编写一个 Makefile(在 Ubuntu 20.04 上,如果相关的话)并注意到echo. 使用这个简单的 Makefile:

test.txt:
        @echo -e 'hello\nworld'
        @echo -e 'hello\nworld' > test.txt

当我运行时make,我希望在 stdout 上看到与在 test.txt 中相同的内容,但实际上我没有。我在标准输出上得到了这个:

hello
world

但这在 test.txt 中:

-e hello
world

同时,如果我-e从 Makefile 的两行中删除,我会在标准输出上得到这个:

hello\nworld

这在 test.txt 中:

hello
world

这让我想知道是否echo检测到重定向并且行为不同,但是当我只是在 shell 中手动运行它时它不会/bin/echo -e 'hello\nworld' > test.txt(这会产生hello和world在单独的行上,正如我通常所期望的那样)。@echo --version我什至通过添加一行来确认 Makefile 正在使用 /bin/echo 而不是内置的 shell 。

这里发生了什么?

echo gnu-make
  • 1 个回答
  • 2323 Views
Martin Hope
Taylor
Asked: 2022-01-17 18:32:46 +0800 CST

为什么这个makefile命令运行如此频繁

  • 0

我有下面的makefile。

为什么data/vix.csv目标的规则总是在我运行时执行make?

在最近关于 SO 的回答中,有人向我展示了如何last_updated.txt每隔 24 小时更新一次,即使我make经常跑步。结果,@echo "\n\n##### updating last_updated.txt#####\n\n"我运行时很少打印make.

据我所知,这是唯一更新的东西last_updated.txt。但是还有其他东西在修改那个文件吗?其他东西似乎在更新它,因为它是第一条规则的唯一依赖项,并且@echo "\n\n######## downloading fresh data and updating vix.csv ##########\n\n"总是在打印。这不是很好,因为这是调用 web api 的 makefile 的一部分。

TS24 := .timestamp24
DUMMY := $(shell touch -d 'yesterday' "$(TS24)")

# update data if it has been 24 hours
data/vix.csv: last_updated.txt
    @echo "\n\n######## downloading fresh data and updating vix.csv ##########\n\n"
    Rscript update_csv.R

# signal that it's been >24 hours since data download
last_updated.txt: $(TS24)
    @echo "\n\n##### updating last_updated.txt#####\n\n"
    touch "$@"

.PHONY: run
run: 
    @echo "\n\n####### running shiny app ###########\n\n"
    R --quiet -e "shiny::runApp(launch.browser=TRUE)"

## remove all target, output and extraneous files
.PHONY: clean
clean:
    rm -f *~ *.Rout *.RData *.docx *.pdf *.html *-syntax.R *.RData
make gnu-make
  • 1 个回答
  • 52 Views
Martin Hope
Thesevs
Asked: 2021-10-06 14:15:04 +0800 CST

如果文件存在,我如何执行配方?

  • 1

我正在编写一个 Makefile 配方,如果且仅当某个文件存在时才需要执行...

这是我所拥有的:

clean:
    $(if $(shell test -s ${MFN_LSTF}), \
        $(foreach mfn, $(shell cat ${MFN_LSTF}), \
            $(MAKE) -f mfd/${mfn} clean;), )
.PHONY: clean

${MFN_LSTF} 包含一个文件名,该文件名包含一列生成文件名列表,假定与此生成文件配方位于同一本地目录中。

我遇到的问题是,foreach语句总是执行。我希望它仅在文件名${MFN_LSTF}存在时执行。

我也试过这个:

clean:
    [ test -s ${MFN_LSTF} ] &&
        for mfn in $(shell cat ${MFN_LSTF}); do
            $(MAKE) -f mfd/${mfn} clean
        done
.PHONY: clean
shell gnu-make
  • 2 个回答
  • 458 Views
Martin Hope
Sam Marinelli
Asked: 2018-08-05 23:39:25 +0800 CST

Make - 如何在不抑制其他输出的情况下抑制 make 错误消息

  • 4

我正在实现一个简单的构建系统,它实际上只是 Make 的一个包装器。由于这个构建系统已经发出了自己的错误消息,我不希望 Make 产生像这样的错误消息

make: *** [/cool/makefile:116: /fun/target.o] Error 1

关于失败。

我已经在使用该-s标志来抑制 Make 的大部分输出。而且我不希望 Make 忽略错误;我仍然希望它停止并以状态退出。我不能仅仅杀死所有错误输出,make 2> /dev/null因为我仍然希望看到stderrMake 正在运行的任务打印的消息。

有没有办法在不手动解析和清理 Make 输出的情况下做到这一点?我正在使用 GNU Make 4.2.1,我不介意 GNU Make 特定的解决方案。

make gnu-make
  • 1 个回答
  • 4042 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve