public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Michael Schwingen <rincewind@discworld.dascon.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] RFC: auto-generate ARM mach-types.h file from ARM machine database
Date: Sat, 07 May 2011 12:57:32 +0200	[thread overview]
Message-ID: <4DC5259C.7040208@discworld.dascon.de> (raw)
In-Reply-To: <BANLkTik6jeJ02B-N2_VBiEVW-9wGSadZzg@mail.gmail.com>

Am 05/06/2011 07:09 AM, schrieb Mike Frysinger:
> On Thu, May 5, 2011 at 17:48, Michael Schwingen wrote:
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -469,7 +469,7 @@ $(obj)System.map:   $(obj)u-boot
>>  # This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
>>  # the dep file is only include in this top level makefile to determine when
>>  # to regenerate the autoconf.mk file.
>> -$(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
>> +$(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h $(obj)include/asm/mach-types.h
>>        @$(XECHO) Generating $@ ; \
>>        set -e ; \
>>        : Generate the dependancies ; \
>> @@ -530,13 +530,18 @@ unconfig:
>>                $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
>>                $(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep
>>
>> -%_config::     unconfig
>> +%_config::     unconfig $(obj)include/asm/mach-types.h
>>        @$(MKCONFIG) -A $(@:_config=)
>>
>>  sinclude $(obj).boards.depend
>>  $(obj).boards.depend:  boards.cfg
>>        awk '(NF && $$1 !~ /^#/) { print $$1 ": " $$1 "_config; $$(MAKE)" }' $< > $@
>>
>> +
>> +$(obj)include/asm/mach-types.h: arch/arm/tools/gen-mach-types arch/arm/tools/mach-types
>> +       @mkdir -p $(obj)include/asm
>> +       awk -f $^ > $@ || { rm -f $@; /bin/false; }
>> +
>>  #
>>  # Functions to generate common board directory names
>>  #
> this all belongs in arch/arm/config.mk and not the toplevel makefile
Fine with me, however, I am hitting a big problem with the Makefile
structure:

mach-types.h needs to be built before autoconf.mk can be generated, and
the rules for autoconf.mk are in the top-level Makefile.

If I put rules in arch/arm/config.mk, then the first of these rules
becomes the default rule which is executed in subdir makes (like "make
-C arch"), which breaks compilation completely, since config.mk is
included before the rules are defined in the subdir Makefiles.

It seems the current scheme allows only variable definitions in
config.mk files, which is not sufficient here.

rules.mk would be fine, however, there is no provision to include rules
from lower directories, since all the building in subdirectories is
handled by recursively calling make (this is one of the problems that
arise by recursively calling make for each directory, but that is a
different topic).

Any ideas? Using the current Makefile structure, I see no other solution
than defining the mach-types.h generation rules in the toplevel Makefile.

> also, dont hardcode full paths to things.  there's no reason for it.
Which of these can be omitted?

When putting the rules in arch/arm/config.mk, I can make them trigger
only when compiling for ARM, and I can use $(ARCH) instead of  arm/, but
apart from that, I think I need to specify the paths, no?

> might want to add an "update-mach-types" target so people can type
> `make update-mach-types` and it'll automatically wget the right file
> to the right place ...
Good idea.
I agree with Wolfgang that this is intended to be used by the maintainer
mainly, so the mach-types file should be included in the source so that
a normal user does not need to download the file.

cu
Michael

  reply	other threads:[~2011-05-07 10:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05 21:48 [U-Boot] RFC: auto-generate ARM mach-types.h file from ARM machine database Michael Schwingen
2011-05-06  5:09 ` Mike Frysinger
2011-05-07 10:57   ` Michael Schwingen [this message]
2011-05-09  5:37     ` Wolfgang Denk
2011-05-09  6:32       ` Michael Schwingen
2011-05-09 15:29     ` Mike Frysinger
2011-05-09 15:54       ` Michael Schwingen
2011-05-09 16:16         ` Mike Frysinger
2011-05-10 21:50           ` Albert ARIBAUD
2011-05-06 10:14 ` Wolfgang Denk
2011-05-07 10:58   ` Albert ARIBAUD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DC5259C.7040208@discworld.dascon.de \
    --to=rincewind@discworld.dascon.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox