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

Re: [MiNT] precompiler kernel source compares



Paul Wratt a écrit :
is there any way to generate the sources used to compile the different
MiNT versions, as preparsed by the compiler (ie after #IF processing)

Here the solution for a single file.

A .c file is usually compiled with :
gcc -c myfile.c -other-options
As a result, you get myfile.o

To get the preprocessed output, replace "-c" with "-E"
-E indicates to preprocess only

So do:
gcc -E myfile.c -other-options >myfile.i

And you get in myfile.i the exact source that will be compiled, with all #include and #define being replaced. Beware, the preprocessed output is sometimes hard to read (it is intended to the compiler only). All the include files are copied, and the expanded macros are sometimes unreadable.

When you type make, you see the exact gcc command line used.
Use the exact same command line with -E instead of -c, and you're done.

I repeat this tip again and again because it saved me numerous times.

By the way, I'm not sure you will get something useful with this method, but who knows...

--
Vincent Rivière