From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1I3Quw-0001ph-Do for mharc-grub-devel@gnu.org; Wed, 27 Jun 2007 02:22:18 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I3Qut-0001oi-Ek for grub-devel@gnu.org; Wed, 27 Jun 2007 02:22:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I3Qur-0001nr-Iw for grub-devel@gnu.org; Wed, 27 Jun 2007 02:22:14 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I3Qur-0001no-Dc for grub-devel@gnu.org; Wed, 27 Jun 2007 02:22:13 -0400 Received: from m15-113.126.com ([220.181.15.113]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1I3Qup-0005bR-PY for grub-devel@gnu.org; Wed, 27 Jun 2007 02:22:13 -0400 Received: from localhost (unknown [123.49.170.139]) by smtp5 (Coremail) with SMTP id wKjJDbCrkQQMAoJGs1NLBA==.53124S2; Wed, 27 Jun 2007 14:22:04 +0800 (CST) Date: Wed, 27 Jun 2007 14:21:43 +0800 From: Bean To: The development of GRUB 2 Message-ID: <20070627062143.GA2416@ws3.vdp.com> References: <20070626185212.GA3822@ws3.vdp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070626185212.GA3822@ws3.vdp.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-Coremail-Antispam: 1U3Yxn0WfASr-VFAUDIcSsGvfJTRUUUj8xFxVCF77xC6IxKo4 kEV4ylIxAIcVC2z280aVAFwI0_Jr0_Gr1lnxkEFVAIw20F6cxK64vIFxWlx4CE17CEb7AF 67AKxVWUJVWUXwCjxxvEw4Wle4C267I2x7xF54xIwI1lYx0E2Ix0cI8IcVAFwI0_Jr0_Jr 4l4x8a6c8ajcxJMcIj6I8E87Iv67AKxVWUJVW8JwAFxVCaYxvI4VCIwcAKzIAtMxkI7II2 jI8vz4vEwIxGrwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UM7AC8VAFwI0_Jr0_Gr1lb4 IE77IF4wAFIxvE14AKwVWUJVWUGwAqx4xG64xvF2IEw4CE5I8CrVC2j2Wlb7Iv0xC_ZrUa nT9S1TB71UUUUUUa7-sFnT9fnUUI43ZEXa7IUnJGYJUUUUUFnT9fnV15pF1DCw47CrWxWF 4DCFW7KFW3JoXrpr43Kwb_ur1fJ3s8u34UAw4vy3yftF18Zr4rWw1DXrWDAr97Xr1jy34Y qr4fXrsaqrn3Way3ZrnIyr98ur42va48ZF1j9 X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) Subject: Re: [PATCH] Avoid recompilation of unrelated files X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2007 06:22:15 -0000 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