GCC Compiler Option 2 : Preprocessor Options
-Mxxx¶
-M
option is designed for auto-generate Makefile rules from g++ command.- 默认包含
-E
option to STOP after preprocessor during the compilation - 默认包含
-w
option to DISABLE/suppress all warnings.
Using a complex g++ command as an example:
g++ -Wall -Werror -Wno-unknown-pragmas -DPIN_CRT=1 -fno-stack-protector -fno-exceptions -funwind-tables -fasynchronous-unwind-tables -fno-rtti -DTARGET_IA32E -DHOST_IA32E -fPIC -DTARGET_LINUX -fabi-version=2 -faligned-new -I../../../source/include/pin -I../../../source/include/pin/gen -isystem /staff/shaojiemike/Download/pin-3.28-98749-g6643ecee5-gcc-linux/extras/cxx/include -isystem /staff/shaojiemike/Download/pin-3.28-98749-g6643ecee5-gcc-linux/extras/crt/include -isystem /staff/shaojiemike/Download/pin-3.28-98749-g6643ecee5-gcc-linux/extras/crt/include/arch-x86_64 -isystem /staff/shaojiemike/Download/pin-3.28-98749-g6643ecee5-gcc-linux/extras/crt/include/kernel/uapi -isystem /staff/shaojiemike/Download/pin-3.28-98749-g6643ecee5-gcc-linux/extras/crt/include/kernel/uapi/asm-x86 -I../../../extras/components/include -I../../../extras/xed-intel64/include/xed -I../../../source/tools/Utils -I../../../source/tools/InstLib -O3 -fomit-frame-pointer -fno-strict-aliasing -Wno-dangling-pointer
-M inscount0.cpp -o Makefile_bk
In Makefile_bk
inscount0.o: inscount0.cpp \
# sys header
/usr/include/stdc-predef.h \
/staff/shaojiemike/Download/pin-3.28-98749-g6643ecee5-gcc-linux/extras/cxx/include/iostream \
/usr/lib/gcc/x86_64-linux-gnu/11/include/float.h
# usr header
../../../source/include/pin/pin.H \
../../../extras/xed-intel64/include/xed/xed-interface.h \
... more header files
-MM
not include sys header file- e.g., the first 3 header will be disapear.
-MF filename
config the Makefile rules write to which file instead of to stdout.-M -MG
is designed to generate Makefile rules when there is header file missing, treated it as generated in normal.-M -MP
will generated M-rules for dependency between header files- e.g.,
header1.h
includesheader2.h
. Soheader1.h: header2.h
in Makefile -MD
==-M -MF file
without default option-E
- the default
file
has a suffix of.d
, e.g.,inscount0.d
for-c inscount0.cpp
-MMD
==-MD
not include sys header file
需要进一步的研究学习¶
暂无
遇到的问题¶
暂无
开题缘由、总结、反思、吐槽~~¶
参考文献¶
上面回答部分来自ChatGPT-3.5,没有进行正确性的交叉校验。
无