From: Bean <bean123@126.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] Avoid recompilation of unrelated files
Date: Wed, 27 Jun 2007 14:21:43 +0800 [thread overview]
Message-ID: <20070627062143.GA2416@ws3.vdp.com> (raw)
In-Reply-To: <20070626185212.GA3822@ws3.vdp.com>
On Wed, Jun 27, 2007 at 02:52:12AM +0800, Bean wrote:
> A problem of the grub2 make system is that even the smallest change of source
> code can trigger a huge recompilation. Try this:
>
> touch commands/cmp.c
> make
>
> The ideal situation is that only files related to cmp module is recompiled.
> But unfortunately, this is not the case. The problem lies in file dependence.
>
> cmp.mod: pre-cmp.o mod-cmp.o
>
> pre-cmp.o: cmp_mod-commands_cmp.o
>
> cmp_mod-commands_cmp.o: cmp.c
>
> mod-cmp.o: mod-cmp.c
>
> mod-cmp.c: moddep.lst genmodsrc.sh
>
> def-cmp.lst: pre-cmp.o
>
> und-cmp.lst: pre-cmp.o
>
> moddep.lst: def-cmp.lst und-cmp.lst
>
> cmp.c => cmp_mod-commands_cmp.o => pre-cmp.o => def-cmp.lst and und-cmp.lst
> => moddep.lst
>
> When cmp.c changes, moddep.lst changes. But every mod-*.c depends on
> moddep.lst, they all need to be recreated. This will lead to a huge
> recompilation process.
>
> def-cmp.lst and und-cmp.lst contains the exported symbol and unresolved symbol
> of the module. Their content rarely change. So we can update them only when
> it's necessary, not every time we recompile the module.
>
> The solution:
>
> Merge these three rules:
>
> pre-cmp.o: cmp_mod-commands_cmp.o
>
> def-cmp.lst: pre-cmp.o
>
> und-cmp.lst: pre-cmp.o
>
> The output of def-cmp.lst is saved as tmp_pre-cmp.lst. When tmp_pre-cmp.lst
> and the old pre-cmp.lst is different, move tmp_pre-cmp.lst to pre-cmp.lst,
> otherwise, just delete tmp_pre-cmp.lst. und-cmp.lst can be handled in exactly
> the same way.
I'm sorry, the previous patch doesn't work properly. It's still possible to
implement this feature using a flag variable. If any of the def-*.lst or
und-*.lst changes, we set the variable. When it's time to rebuild moddep.lst,
the flag variable is checked. If it's not set, it means nothing has changed
since last build, we can just touch moddep.lst instead of rebuilding it. The
same process can be applied to mod-*.c files as well. However, this method is
not very elegant, I'm not posting it here any more.
--
Bean
prev parent reply other threads:[~2007-06-27 6:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-26 18:52 [PATCH] Avoid recompilation of unrelated files Bean
2007-06-27 6:21 ` Bean [this message]
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=20070627062143.GA2416@ws3.vdp.com \
--to=bean123@126.com \
--cc=grub-devel@gnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.