Make build more robust
cover Make build more robust
I've found these two patches to be necessary under certain build conditions that I've not been able to narrow down to a specific cause. I suspect it is related to the values of some build environment variables (like *CFLAGS). Either way, these patches allow a successful build finishes without error and where the test suite succeeds. So I believe these patches are allowing a usable build. Under normal conditions, these changes should be superflous and thus not affect the build process.
Glenn
Glenn Washburn (2):
gentpl.py: Fix issue where sometimes marker files have CPP defines
Makefile: Only look for @MARKER@ at the start of a line when
generating libgrub_a_init.lst
Makefile.am | 4 ++-- gentpl.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.27.0
PATCH 1/2 gentpl.py: Fix issue where sometimes marker files have CPP defines
When generating video.lst, modules whose marker file contains the string VIDEO_LIST_MARKER are selected. But when the marker file contains the CPP defines, one of the defines is VIDEO_LIST_MARKER and is present in all marker files, so they are all selected. By removing the defines, the correct modules are selected.
--- gentpl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
gentpl.py +1 -1
@@ -700,7 +700,7 @@ def module(defn, platform): output(""" """ + name + """.marker: $(""" + cname(defn) + """_SOURCES) $(nodist_""" + cname(defn) + """_SOURCES) $(TARGET_CPP) -DGRUB_LST_GENERATOR $(CPPFLAGS_MARKER) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + cname(defn) + """_CPPFLAGS) $(CPPFLAGS) $^ > [email protected] || (rm -f $@; exit 1) - grep 'MARKER' [email protected] > $@; rm -f [email protected] + grep 'MARKER' [email protected] | grep -v '^#' > $@; rm -f [email protected] """) def kernel(defn, platform):
Signature · 1 line
2.27.0
PATCH 2/2 Makefile: Only look for @MARKER@ at the start of a line when generating libgrub_a_init.lst
In reply to Glenn WashburnUnder certain conditions libgrub.pp gets generated with a such that it contains a bunch of CPP defines, at least one of which contains "@MARKER@". This line should not be used when generating libgrub_a_init.lst, otherwise we get compiler errors like:
libgrub_a_init.c:22:18: error: stray ‘#’ in program
22 | extern void grub_#define_init (void);
| ^
libgrub_a_init.c:22:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘define_init’
22 | extern void grub_#define_init (void);
| ^~~~~~~~~~~
libgrub_a_init.c:23:18: error: stray ‘#’ in program
23 | extern void grub_#define_fini (void);
| ^
libgrub_a_init.c:23:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘define_fini’
23 | extern void grub_#define_fini (void);
| ^~~~~~~~~~~
...When generating libgrub_a_init.lst only lines starting with "@MARKER@" are desired.
--- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile.am +2 -2
@@ -52,7 +52,7 @@ libgrub.pp: config-util.h grub_script.tab.h grub_script.yy.h $(libgrubmods_a_SOU CLEANFILES += libgrub.pp libgrub_a_init.lst: libgrub.pp - cat $< | grep '@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1) + cat $< | grep '^@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1) CLEANFILES += libgrub_a_init.lst libgrub_a_init.c: libgrub_a_init.lst $(top_srcdir)/geninit.sh
@@ -66,7 +66,7 @@ grub_fstest.pp: $(grub_fstest_SOURCES) CLEANFILES += grub_fstest.pp grub_fstest_init.lst: libgrub.pp grub_fstest.pp - cat $^ | grep '@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1) + cat $^ | grep '^@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1) CLEANFILES += grub_fstest_init.lst grub_fstest_init.c: grub_fstest_init.lst $(top_srcdir)/geninit.sh
Signature · 1 line
2.27.0
Quoted 7 lines · Glenn Washburn
I've found these two patches to be necessary under certain build conditions that I've not been able to narrow down to a specific cause. I suspect it is related to the values of some build environment variables (like *CFLAGS). Either way, these patches allow a successful build finishes without error and where the test suite succeeds. So I believe these patches are allowing a usable build. Under normal conditions, these changes should be superflous and thus not affect the build process.
For both Reviewed-by: Daniel Kiper <[email protected]>...
Daniel