怎么查看makefile编译依赖关系

2025-03-25 05:43:41
推荐回答(2个)
回答1:

具体描述:
test.c的内容为:
#include "test.h"
#include "test1.h"
/*
之后为程序内容。
*/

在由test.c生成的test.d内容为:

test.d tset.o: test.c test.h test1.h

现在因为代码变化,把test.c文件中所包含的“test1.h”去掉,同时在目录下也把test1.h这个文件删掉了,即新的
test.c的内容为:
#include "test.h"
/*
之后为程序内容。
*/

回答2:

目标,依赖,命令(规则),第一项目标,然后会有个:号,后面的就是依赖了

例如 hello.o : hello.c, a.o, b.o
gcc hello.c hello.o

hello.c, a.o,b.o就都是依赖,就这样