用make编译生成可执行文件时,有时候想要知道具体用的是什么编译选项,链接了哪些库,下面是一些强制make输出编译信息的指令。
make SHELL='sh -x'
此命令需要shell是sh。
make VERBOSE=1
#or
make V=1
此命令适用于cmake生成的Makefiles。
其他命令还有:
make -n
make --trace
make --debug=j
make AM_DEFAULT_VERBOSITY=1
make --always-make --dry-run
make -Bn
make --dry-run
参考:makefile - How do I force make/GCC to show me the commands? - Stack Overflow
Using CMake with GNU Make: How can I see the exact commands? - Stack Overflow