1

I want to print out all #define macros when compiling u-boot using ARM cross compiler.

According to GCC dump preprocessor defines link I can add -dM -E flags to achieve this. However using

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- CFLAGS=-dM

does not print out any #define macros.

Is there way to achieve this and print out all #define macros to a txt file?

Community
  • 1
  • 1
Dragonight
  • 1,033
  • 2
  • 10
  • 20
  • You forgot the `-E`. However, if you add the `-E`, you are telling gcc to perform preprocessing only, so it will perform not *compilation*, and your build will presumably fail. – Mike Kinghan Mar 26 '17 at 11:25
  • Close to a duplicate. You might find the discussion interesting in http://stackoverflow.com/questions/42844545/evaluate-all-macros-in-a-c-header-file/42940455#42940455 and http://stackoverflow.com/questions/40652595/make-preprocessor-trace-the-source-of-a-definition#comment73146796_40652595. – Yunnosch Apr 05 '17 at 06:09
  • Both of them do not include an answer to my problem. I want to print out all #define macros when I run make command. How to do it? – Dragonight Apr 10 '17 at 02:08
  • I have the same issue. `-dM -E` seems to work with gcc don't work with the cross-compile gcc version, I'm not sure why. I've also tried passing `-dM` using `-Wp,-dM` and `-Xpreprocessor -dM` but that hasn't helped. – Codebling Jan 01 '19 at 22:57

0 Answers0