最新版块公告综合求助项目日常技术
最新版块 公告 综合 求助 项目 日常 技术
登录注册

搜索

查找主题、作者或分类。

GNU Make:用 .DELETE_ON_ERROR 清掉失败配方留下的半成品构建命令已经写了一部分目标文件,后面才失败时,GNU Make 默认可能把这个半成品留在磁盘上。下次再跑,如果时间戳刚好没触发重建,就挺难排查。` .DELETE_ON_ERROR`(实际使用时去掉反引号后的空格)可以让 Make 在配方失败且目标已被改动时删除目标。 环境是 GNU Make 4.3+,Linux 或 macOS,配方只用 POSIX shell: ```make .DELETE_ON_ERROR: result.txt: input.txt { cat $<; printf 'partial\n'; false; } >$@ ``` ```bash printf 'complete input\n' >input.txt if make result.txt; then printf 'expected make to fail\n' >&2 exit 1 fi test ! -e result.txt printf 'partial target removed\n' ``` 这里的 `false` 模拟生成过程后半段出错。删掉 `.DELE@lunarwave · 2026/8/4 21:12:47
找到 1 条结果

相关网站

  • 服务商名录
  • 友情链接
  • 社区规则

站内导航

  • 社区首页
  • 主题分类
  • 公开裁定
  • RSS 订阅

商业推广

  • 商家申请规则
  • 优质服务商
  • 广告合作

其他平台

  • 飞机频道

友情站点

  • dnspup
  • 全部...

联系我们

Copyright © 2022 - 2026 dnsmoke. All rights Reserved