首先我们要下载两个压缩包, 可以从下面的网站上下载, 也可以从文章的附件下载。
压缩包下载完之后解压。
- 把gmd压缩包下的gmd文件
- 把gmsl压缩包下的gmsl和__gmsl文件拿出来
上面一共三个文件,放到当前Makefile文件夹下面, 下面是当前文件夹下的内容
-rw-r--r-- 1 root root 9.8K Apr 27 09:37 gmd
-rw-r--r-- 1 root root 45K Apr 27 09:37 __gmsl
-rw-r--r-- 1 root root 3.0K Apr 27 09:37 gmsl
-rw-r--r-- 1 root root 93 Apr 27 09:38 Makefile
Makeile修改
- 引入
include gmd
- 在合适的位置插入断点
$(__BREAKPOINT)
运行makefile时,程序会在断点处停止,等待输入指令
include gmd
name=1
$(__BREAKPOINT)
test1:
@echo test1
test2:
@echo test2
test: test1 test2
运行Makefile之后,会进入等待输出阶段:
- 输入h, 按回车,显示帮助信息
- 输入v VAR, 显示变量的值,例子中v name, 就是打印name的值,可以看出打印了变量1
Makefile:3: GNU Make Debugger Break
1> h
Makefile:3: c: continue
Makefile:3: q: quit
Makefile:3: v VAR: print value of $(VAR)
Makefile:3: o VAR: print origin of $(VAR)
Makefile:3: d VAR: print definition of $(VAR)
Makefile:3: b TAR: set a breakpoint on target TAR
Makefile:3: r TAR: unset breakpoint on target TAR
Makefile:3: l: list all target breakpoints
2> v name
Makefile:3: name has value '1'