[U-Boot] [PATCH V3 17/32] imximage.cfg: run files through C preprocessor

stefano babic
2012-10-11T22:27:09Z

Am 11/10/2012 22:33, schrieb Troy Kisky:
> On 10/11/2012 4:11 AM, Stefano Babic wrote:
>> Does it work something more direct (I have not tested, really...) ?
>>
>> In board Makefile, for example board/freescale/mx6qsabrelite, a rule for
>> the imximage file:
>>
>> $(CONFIG_IMX_CONFIG): <your base file, mx6q_4x_mt41j128.cfg maybe>
>> $(CC) -E -x c $< -I./include -o $@
>>
>> And let unchanged in the main Makefile. So CONFIG_IMX_CONFIG is produced
>> and you do not need to change logic in the main Makefile.
>>
>> Regards,
>> Stefano
>>
>
> The advantages I see of changing the main Makefile are
> 1. Easy for other boards to use the preprocessor. You merely
> need to change the file extension to pcfg.

I set Tom in CC, because changing the main Makefile is more related to
the whole project, and not only for the i.MX.

One reason to move into the board directory is that there was a decision
to move rules related to only one arch or SOC where they belong to, that
is in the corresponding arch/ or board/ directory.

>
> 2. Easy to clean the temporary generated file. The main Makefile
> deletes files with .pcfgtmp extension.
>
> 3. The file referred to by boards.cfg actually exists before the build
> starts.

This is true, but I do not understand which is the advantage. A lot of
files are generated, also .c or .S files. If it exists or not, it does
not matter.

>
> 4. The temporary file can be placed in an out-of-tree directory for
> make -O builds
>
> Using the file extension to determine whether to use the preprocessor is
> also
> what gcc uses to preprocess ".S" files while skipping this for ".s" files.
>
> I believe that at least other mx6 boards will quickly change to using
> the preprocessor
> as well to add support for solo/duallite, so total line count should
> eventually be
> less with changes to the main makefile.

Ok, but if this true, the rule should be moved to the mx6 directory, and
should not be valid for other i.MX that do not need it.

> Having said that, I really have no problem going your route, I just
> don't prefer it.
> Let me know.

Let's wait to know Tom's opinion.

Regards,
Stefano

--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================