Re: How to get the preprocessor output as part of the compilation process?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> On Sun, Dec 8, 2019 at 2:06 PM Frank A. Cancio Bello <frank@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>> Hi,
>> I know that with gcc -E you can get the output of the preprocessor, but what I have to do to get that output for every source code file in the Linux Lernel as part of the compilation process?
>>
>> thanks
>> frank a.

Hi Frank,

There are two options you can use with gcc to get the processor output as part of the kernel compilation process.
  -save-temps               
  -save-temps=<arg>    

1 - Open the top level Makefile in your favorite text editor.
2 - Search for KBUILD_CFLAGS
    My Makefile which is at /home/aruna/linux-5.4.2/Makefile shows me at line 458
    KBUILD_CFLAGS   := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs

3 - Now plugin   -save-temps=<arg> but replace <arg> with obj like shown below:
   KBUILD_CFLAGS   := -Wall  -save-temps=obj  -Wundef -Werror=strict-prototypes -Wno-trigraphs

4 - Save the Makefile.
5 - Run make and we are done !

Each directory will have the preprocessor output in *.i and *.s files.

Good luck - Aruna ( I keep asking myself 'why' are you doing this though ? :)





_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux