From: "Javier Martín" <lordhabbit@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: [PATCH] Build system improvement
Date: Sun, 25 Jan 2009 03:39:03 +0100 [thread overview]
Message-ID: <1232851143.23773.13.camel@localhost> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1327 bytes --]
This patch modifies several files in the build system (mainly common.rmk
and genmk.rb) to reduce the general verbosity of the build process to a
manageable, semi-informative level. Thus, what currently appears as
"gcc" calls, several lines long each is turned into lines like:
[M xfs.mod] COMPILE ../src/fs/xfs.c ->
xfs_mod-fs_xfs.o
[M xfs.mod] LINK xfs_mod-fs_xfs.o ->
pre-xfs.o
[M xfs.mod] Looking for EXPORTED SYMBOL definitions: pre-xfs.o
And so on. The change also makes warning-hunting marginally easier,
though not by much since the patch intentionally shows a line for nearly
every process that did so previously. This behavior could be simplified
further if needed - this post is more of an RFC than anything else.
Also, it is by no means thorough or complete - only the most common
processes have been addressed - as I'm a bit busy with exams.
The patch makes the new behavior the default one, so a new make-time
option is added: V (for "verbose"), which must have the value 1 in order
to get the behavior, as in "make V=1"
[-- Attachment #1.2: build_system.diff --]
[-- Type: text/x-patch, Size: 9871 bytes --]
Index: Makefile.in
===================================================================
--- Makefile.in (revisión: 1954)
+++ Makefile.in (copia de trabajo)
@@ -138,18 +138,30 @@
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA)
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
- cat $(DEFSYMFILES) /dev/null \
+ifneq ($(V),1)
+ @echo [L moddep.lst] Building MODULE DEPENDENCIES list
+endif
+ $(SILENT)cat $(DEFSYMFILES) /dev/null \
| $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \
|| (rm -f $@; exit 1)
command.lst: $(COMMANDFILES)
- cat $^ /dev/null | sort > $@
+ifneq ($(V),1)
+ @echo [L command.lst] Building COMMAND list
+endif
+ $(SILENT)cat $^ /dev/null | sort > $@
fs.lst: $(FSFILES)
- cat $^ /dev/null | sort > $@
+ifneq ($(V),1)
+ @echo [L fs.lst] Building FILESYSTEM list
+endif
+ $(SILENT)cat $^ /dev/null | sort > $@
partmap.lst: $(PARTMAPFILES)
- cat $^ /dev/null | sort > $@
+ifneq ($(V),1)
+ @echo [L partmap.lst] Building PARTMAP list
+endif
+ $(SILENT)cat $^ /dev/null | sort > $@
ifeq (, $(UNIFONT_BDF))
else
Index: conf/common.rmk
===================================================================
--- conf/common.rmk (revisión: 1954)
+++ conf/common.rmk (copia de trabajo)
@@ -1,5 +1,9 @@
# -*- makefile -*-
+ifneq ($(V),1)
+SILENT = @
+endif
+
# For grub-mkelfimage.
bin_UTILITIES += grub-mkelfimage
grub_mkelfimage_SOURCES = util/elf/grub-mkimage.c util/misc.c \
@@ -125,26 +129,27 @@
# For grub-mkconfig
grub-mkconfig: util/grub-mkconfig.in config.status
- ./config.status --file=$@:$<
- chmod +x $@
+ $(SILENT)./config.status --file=$@:$<
+ $(SILENT)chmod +x $@
sbin_SCRIPTS += grub-mkconfig
CLEANFILES += grub-mkconfig
grub-mkconfig_lib: util/grub-mkconfig_lib.in config.status
- ./config.status --file=$@:$<
- chmod +x $@
+ $(SILENT)./config.status --file=$@:$<
+ $(SILENT)chmod +x $@
lib_DATA += grub-mkconfig_lib
CLEANFILES += grub-mkconfig_lib
update-grub_lib: util/update-grub_lib.in config.status
- ./config.status --file=$@:$<
- chmod +x $@
+ $(SILENT)./config.status --file=$@:$<
+ $(SILENT)chmod +x $@
lib_DATA += update-grub_lib
CLEANFILES += update-grub_lib
%: util/grub.d/%.in config.status
- ./config.status --file=$@:$<
- chmod +x $@
+#no need to echo nothing here: config.status already does so
+ $(SILENT)./config.status --file=$@:$<
+ $(SILENT)chmod +x $@
grub-mkconfig_SCRIPTS = 00_header 10_linux 10_hurd 10_freebsd 30_os-prober 40_custom
ifeq ($(target_os), cygwin)
grub-mkconfig_SCRIPTS += 10_windows
Index: genmk.rb
===================================================================
--- genmk.rb (revisión: 1954)
+++ genmk.rb (copia de trabajo)
@@ -57,10 +57,16 @@
MOSTLYCLEANFILES += #{deps_str}
#{@name}: #{exe}
+ifneq ($(V),1)
+ @echo [I #{@name}] OBJCOPY $< '->' $@
+endif
$(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
#{exe}: #{objs_str}
- $(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
+ifneq ($(V),1)
+ @echo [I #{@name}] LINK $< '->' $@
+endif
+ $(SILENT)$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
" + objs.collect_with_index do |obj, i|
src = sources[i]
@@ -71,7 +77,10 @@
dir = File.dirname(src)
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
- $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
+ifneq ($(V),1)
+ @echo [I #{@name}] COMPILE $< '->' $@
+endif
+ $(SILENT)$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
-include #{dep}
"
@@ -113,29 +122,47 @@
UNDSYMFILES += #{undsym}
#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
- -rm -f $@
- $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} #{mod_obj}
- if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
- $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
+ $(SILENT)-rm -f $@
+ifneq ($(V),1)
+ @echo [M #{@name}] LINK #{pre_obj} #{mod_obj} '->' $@
+endif
+ $(SILENT)$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} #{mod_obj}
+ $(SILENT)if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
+ifneq ($(V),1)
+ @echo [M #{@name}] STRIP $@
+endif
+ $(SILENT)$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
#{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
- -rm -f $@
- $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{objs_str}
+ $(SILENT)-rm -f $@
+ifneq ($(V),1)
+ @echo [M #{@name}] LINK #{objs_str} '->' $@
+endif
+ $(SILENT)$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{objs_str}
#{mod_obj}: #{mod_src}
- $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -c -o $@ $<
+ifneq ($(V),1)
+ @echo [M #{@name}] COMPILE $< '->' $@
+endif
+ $(SILENT)$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -c -o $@ $<
#{mod_src}: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
- sh $(srcdir)/genmodsrc.sh '#{mod_name}' $< > $@ || (rm -f $@; exit 1)
+ $(SILENT)sh $(srcdir)/genmodsrc.sh '#{mod_name}' $< > $@ || (rm -f $@; exit 1)
ifneq ($(#{prefix}_EXPORTS),no)
#{defsym}: #{pre_obj}
- $(NM) -g --defined-only -P -p $< | sed 's/^\\([^ ]*\\).*/\\1 #{mod_name}/' > $@
+ifneq ($(V),1)
+ @echo [M #{@name}] Looking for EXPORTED SYMBOL definitions: $<
endif
+ $(SILENT)$(NM) -g --defined-only -P -p $< | sed 's/^\\([^ ]*\\).*/\\1 #{mod_name}/' > $@
+endif
#{undsym}: #{pre_obj}
- echo '#{mod_name}' > $@
- $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+ifneq ($(V),1)
+ @echo [M #{@name}] Looking for REQUESTED SYMBOL definitions: $<
+endif
+ $(SILENT)echo '#{mod_name}' > $@
+ $(SILENT)$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
" + objs.collect_with_index do |obj, i|
src = sources[i]
@@ -149,7 +176,10 @@
dir = File.dirname(src)
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
- $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
+ifneq ($(V),1)
+ @echo [M #{@name}] COMPILE $< '->' $@
+endif
+ $(SILENT)$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
-include #{dep}
CLEANFILES += #{command} #{fs} #{partmap}
@@ -158,17 +188,26 @@
PARTMAPFILES += #{partmap}
#{command}: #{src} $(#{src}_DEPENDENCIES) gencmdlist.sh
- set -e; \
+ifneq ($(V),1)
+ @echo [M #{@name}] Looking for COMMAND definitions: $<
+endif
+ $(SILENT)set -e; \
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
| sh $(srcdir)/gencmdlist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
#{fs}: #{src} $(#{src}_DEPENDENCIES) genfslist.sh
- set -e; \
+ifneq ($(V),1)
+ @echo [M #{@name}] Looking for FILESYSTEM definitions: $<
+endif
+ $(SILENT)set -e; \
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
| sh $(srcdir)/genfslist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
#{partmap}: #{src} $(#{src}_DEPENDENCIES) genpartmaplist.sh
- set -e; \
+ifneq ($(V),1)
+ @echo [M #{@name}] Looking for PARTMAP definitions: $<
+endif
+ $(SILENT)set -e; \
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
| sh $(srcdir)/genpartmaplist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
@@ -199,7 +238,10 @@
MOSTLYCLEANFILES += #{deps_str}
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
- $(CC) -o $@ #{objs_str} $(LDFLAGS) $(#{prefix}_LDFLAGS)
+ifneq ($(V),1)
+ @echo [U #{@name}] LINK $< '->' $@
+endif
+ $(SILENT)$(CC) -o $@ #{objs_str} $(LDFLAGS) $(#{prefix}_LDFLAGS)
" + objs.collect_with_index do |obj, i|
src = sources[i]
@@ -208,7 +250,10 @@
dir = File.dirname(src)
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
- $(CC) -I#{dir} -I$(srcdir)/#{dir} $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(#{prefix}_CFLAGS) -MD -c -o $@ $<
+ifneq ($(V),1)
+ @echo [U #{@name}] COMPILE $< '->' $@
+endif
+ $(SILENT)$(CC) -I#{dir} -I$(srcdir)/#{dir} $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(#{prefix}_CFLAGS) -MD -c -o $@ $<
-include #{dep}
"
@@ -237,7 +282,10 @@
MOSTLYCLEANFILES += #{deps_str}
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
- $(TARGET_CC) -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
+ifneq ($(V),1)
+ @echo [P #{@name}] LINK $< '->' $@
+endif
+ $(SILENT)$(TARGET_CC) -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
" + objs.collect_with_index do |obj, i|
src = sources[i]
@@ -246,7 +294,10 @@
dir = File.dirname(src)
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
- $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -MD -c -o $@ $<
+ifneq ($(V),1)
+ @echo [P #{@name}] COMPILE $< '->' $@
+endif
+ $(SILENT)$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -MD -c -o $@ $<
-include #{dep}
"
@@ -273,8 +324,9 @@
"CLEANFILES += #{@name}
#{@name}: #{src} $(#{src}_DEPENDENCIES) config.status
- ./config.status --file=#{name}:#{src}
- chmod +x $@
+#no need to echo nothing here: config.status already does so
+ $(SILENT)./config.status --file=#{name}:#{src}
+ $(SILENT)chmod +x $@
"
end
[-- Attachment #2: Esta parte del mensaje está firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 835 bytes --]
next reply other threads:[~2009-01-25 2:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-25 2:39 Javier Martín [this message]
2009-01-25 10:34 ` [PATCH] Build system improvement Vesa Jääskeläinen
2009-01-25 13:23 ` Javier Martín
2009-01-25 16:38 ` Colin D Bennett
2009-04-10 23:25 ` phcoder
2009-04-11 10:09 ` Yoshinori K. Okuji
2009-04-11 11:55 ` phcoder
2009-04-11 15:29 ` Colin D Bennett
2009-04-12 21:24 ` Pavel Roskin
2009-04-13 1:07 ` David Miller
2009-04-13 5:03 ` Pavel Roskin
2009-04-14 14:52 ` Yoshinori K. Okuji
2009-05-03 8:29 ` Felix Zielcke
2009-07-22 12:41 ` Felix Zielcke
2009-07-22 16:14 ` Pavel Roskin
2009-07-22 16:59 ` Robert Millan
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=1232851143.23773.13.camel@localhost \
--to=lordhabbit@gmail.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.