开源改变世界

Makefile 不检查 .h 文件 #64

推推 grbl 3年前 (2023-02-10) 217次浏览
关闭
J-Dunn 打开了这个问题 2021 年 5 月 23 日 · 2 条评论
关闭

Makefile 不检查 .h 文件#64

J-Dunn 打开了这个问题 2021 年 5 月 23 日 · 2 条评论

评论

Makefile 不检查 .h 文件 #64
J-邓恩 评论了 2021 年 5 月 23 日  

Makefile 不考虑任何 .h 文件中的更改


touch grbl/System.h

bash-5.1$ make
make[1]: '/~/GRBL-Advanced/GRBL_Advanced.elf' is up to date.
make[1]: '/~/GRBL-Advanced/GRBL_Advanced.bin' is up to date.
make[1]: '/~/GRBL-Advanced/GRBL_Advanced.hex' is up to date.
make[1]: '/~/GRBL-Advanced/GRBL_Advanced.lst' is up to date.
   text    data     bss     dec     hex filename
  66868     492   12164   79524   136a4 /~/GRBL-Advanced/GRBL_Advanced.elf


#---------------------------------------------------------------------------------
# This rule links in binary data with the .c extension
#---------------------------------------------------------------------------------
%.c.o : %.c
#---------------------------------------------------------------------------------
  @echo $(notdir $<)
  @$(CC) $(FLAGS) $(CFLAGS) $(DEFINES) -c $^ -o $@



# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:

清除隐式规则后,它看起来需要 %.co(嗯?)到 %.h 的显式依赖规则,并且可能在 Config.h 上的所有内容中

这是您的 Makefile 还是您从其他地方放入的样板文件。cpp 和 .S 文件似乎有一些未使用的东西。

Makefile 不检查 .h 文件 #64
作者
J-邓恩 评论了 2021 年 5 月 24 日  

我一直在研究如何做到这一点,实现这样一个简单而明显的要求是非常神秘和深奥的。

事实上,这个样板似乎是为了生成依赖文件并包含它们,但是缺少 .d 文件的依赖规则。

DEPENDS     :=  $(OFILES:.o=.d)
......
-include $(DEPENDS)

此处提供了相关的咒语和象形文字:

http://www.gnu.org/software/make/manual/make.html#Automatic-Prerequisites

Makefile 不检查 .h 文件 #64

我知道存在这个问题,但我远不是 makefile 方面的专家。完全重建只需要 2-3 秒,所以这对我来说不是真正的问题。
如果你有一个可行的解决方案,你可以告诉我