From 6fa42fa65a8a6a7ffda9bf265937a181e052f4bc Mon Sep 17 00:00:00 2001 From: chaac Date: Sat, 31 Jan 2009 09:15:43 +0000 Subject: [PATCH] 2009-01-31 Colin D Bennett MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * normal/main.c: Add include to grub/menu_viewer.h. (free_menu_entry_classes): Added. (grub_normal_menu_addentry): Added class property handling. (grub_normal_execute): Changed to use new menu viewer for menu viewing. (GRUB_MOD_INIT(normal)): Added register for text based menu viewer. * normal/menu_viewer.c: New file. * normal/menu.c (run_menu_entry): Renamed to ... (grub_menu_execute_entry): ... this and made it as global. (grub_menu_run): Renamed to ... (show_text_menu): ... this and made it local. (show_text_menu): Adapt to new function names. (grub_normal_terminal_menu_viewer): New global variable. * include/grub/menu.h: New file. * include/grub/menu_viewer.h: New file. * include/grub/normal.h: Added include to grub/menu.h. (grub_menu_entry): Moved to include/grub/menu.h. (grub_menu_entry_t): Likewise. (grub_menu): Likewise. (grub_menu_t): Likewise. (grub_normal_terminal_menu_viewer): Added. (grub_menu_execute_entry): Likewise. (grub_menu_run): Removed. * DISTLIST: Added include/grub/menu.h. Added include/grub/menu_viewer.h. Added normal/menu_viewer.c. 2009-01-31 Vesa Jääskeläinen * normal/execute.c (grub_script_execute_menuentry): Changed to use arglist for menutitle arguments. * normal/main.c (grub_normal_menu_addentry): Likewise. * normal/parser.y (menuentry): Likewise. * normal/script.c (grub_script_create_cmdmenu): Likewise. * include/grub/script.h (grub_script_cmd_menuentry): Likewise. (grub_script_create_cmdmenu): Likewise. * include/grub/normal.h (grub_normal_menu_addentry): Likewise. * conf/i386-pc.rmk (normal_mod_SOURCES): Adapt Colin D Bennett's changes. * conf/x86_64-efi.rmk (normal_mod_SOURCES): Likewise. * conf/i386-coreboot.rmk (normal_mod_SOURCES): Likewise. * conf/i386-efi.rmk (normal_mod_SOURCES): Likewise. * conf/i386-ieee1275.rmk (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (normal_mod_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (normal_mod_SOURCES): Likewise. --- ChangeLog | 65 +++++++++++++++++++++ DISTLIST | 3 + conf/i386-coreboot.mk | 81 +++++++++++++++++--------- conf/i386-coreboot.rmk | 16 +++++- conf/i386-efi.mk | 83 +++++++++++++++++--------- conf/i386-efi.rmk | 18 ++++-- conf/i386-ieee1275.mk | 81 +++++++++++++++++--------- conf/i386-ieee1275.rmk | 16 +++++- conf/i386-pc.mk | 42 +++++++++++--- conf/i386-pc.rmk | 15 ++++- conf/powerpc-ieee1275.mk | 83 +++++++++++++++++--------- conf/powerpc-ieee1275.rmk | 18 ++++-- conf/sparc64-ieee1275.mk | 103 ++++++++++++++++++++++++--------- conf/sparc64-ieee1275.rmk | 19 ++++-- conf/x86_64-efi.mk | 83 +++++++++++++++++--------- conf/x86_64-efi.rmk | 18 ++++-- include/grub/menu.h | 63 ++++++++++++++++++++ include/grub/menu_viewer.h | 43 ++++++++++++++ include/grub/normal.h | 37 ++---------- include/grub/script.h | 8 +-- normal/execute.c | 57 ++++++++++++------ normal/main.c | 115 +++++++++++++++++++++++++++++++++++-- normal/menu.c | 93 ++++++++++++++++-------------- normal/menu_viewer.c | 63 ++++++++++++++++++++ normal/parser.y | 4 +- normal/script.c | 8 +-- 26 files changed, 934 insertions(+), 301 deletions(-) create mode 100644 include/grub/menu.h create mode 100644 include/grub/menu_viewer.h create mode 100644 normal/menu_viewer.c diff --git a/ChangeLog b/ChangeLog index 182d5535d..3b5b949c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,68 @@ +2009-01-31 Colin D Bennett + + * normal/main.c: Add include to grub/menu_viewer.h. + (free_menu_entry_classes): Added. + (grub_normal_menu_addentry): Added class property handling. + (grub_normal_execute): Changed to use new menu viewer for menu viewing. + (GRUB_MOD_INIT(normal)): Added register for text based menu viewer. + + * normal/menu_viewer.c: New file. + + * normal/menu.c (run_menu_entry): Renamed to ... + (grub_menu_execute_entry): ... this and made it as global. + (grub_menu_run): Renamed to ... + (show_text_menu): ... this and made it local. + (show_text_menu): Adapt to new function names. + (grub_normal_terminal_menu_viewer): New global variable. + + * include/grub/menu.h: New file. + + * include/grub/menu_viewer.h: New file. + + * include/grub/normal.h: Added include to grub/menu.h. + (grub_menu_entry): Moved to include/grub/menu.h. + (grub_menu_entry_t): Likewise. + (grub_menu): Likewise. + (grub_menu_t): Likewise. + (grub_normal_terminal_menu_viewer): Added. + (grub_menu_execute_entry): Likewise. + (grub_menu_run): Removed. + + * DISTLIST: Added include/grub/menu.h. + Added include/grub/menu_viewer.h. + Added normal/menu_viewer.c. + +2009-01-31 Vesa Jääskeläinen + + * normal/execute.c (grub_script_execute_menuentry): Changed to use + arglist for menutitle arguments. + + * normal/main.c (grub_normal_menu_addentry): Likewise. + + * normal/parser.y (menuentry): Likewise. + + * normal/script.c (grub_script_create_cmdmenu): Likewise. + + * include/grub/script.h (grub_script_cmd_menuentry): Likewise. + (grub_script_create_cmdmenu): Likewise. + + * include/grub/normal.h (grub_normal_menu_addentry): Likewise. + + * conf/i386-pc.rmk (normal_mod_SOURCES): Adapt Colin D Bennett's + changes. + + * conf/x86_64-efi.rmk (normal_mod_SOURCES): Likewise. + + * conf/i386-coreboot.rmk (normal_mod_SOURCES): Likewise. + + * conf/i386-efi.rmk (normal_mod_SOURCES): Likewise. + + * conf/i386-ieee1275.rmk (normal_mod_SOURCES): Likewise. + + * conf/powerpc-ieee1275.rmk (normal_mod_SOURCES): Likewise. + + * conf/sparc64-ieee1275.rmk (normal_mod_SOURCES): Likewise. + 2009-01-30 Christian Franke * normal/arg.c (grub_arg_show_help): Add indentation if '\n' appears diff --git a/DISTLIST b/DISTLIST index 521aec475..5e31c5989 100644 --- a/DISTLIST +++ b/DISTLIST @@ -152,6 +152,8 @@ include/grub/hfs.h include/grub/kernel.h include/grub/loader.h include/grub/lvm.h +include/grub/menu.h +include/grub/menu_viewer.h include/grub/misc.h include/grub/mm.h include/grub/multiboot.h @@ -391,6 +393,7 @@ normal/lexer.c normal/main.c normal/menu.c normal/menu_entry.c +normal/menu_viewer.c normal/misc.c normal/parser.y normal/script.c diff --git a/conf/i386-coreboot.mk b/conf/i386-coreboot.mk index 1689f6d78..9665117ec 100644 --- a/conf/i386-coreboot.mk +++ b/conf/i386-coreboot.mk @@ -696,18 +696,28 @@ partmap-linux_mod-loader_linux_normal.lst: loader/linux_normal.c $(loader/linux_ linux_mod_CFLAGS = $(COMMON_CFLAGS) linux_mod_LDFLAGS = $(COMMON_LDFLAGS) -# For normal.mod. +# +# Only arch dependant part of normal.mod will be here. Common part for +# all architecures of normal.mod is at start and should be kept at sync +# with other makefiles. +# +# Please put arch dependant part of normal.mod at the end of list to +# keep it simpler to update to different architectures. +# normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ normal/completion.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ - normal/menu_entry.c normal/misc.c grub_script.tab.c \ - normal/script.c normal/i386/setjmp.S normal/color.c -CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o normal_mod-normal_color.o und-normal.lst + normal/color.c \ + normal/menu_viewer.c normal/menu_entry.c \ + normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/i386/setjmp.S +CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o und-normal.lst ifneq ($(normal_mod_EXPORTS),no) CLEANFILES += def-normal.lst DEFSYMFILES += def-normal.lst endif -MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_i386_setjmp.d normal_mod-normal_color.d +MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_color.d normal_mod-normal_menu_viewer.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_i386_setjmp.d UNDSYMFILES += und-normal.lst normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF) @@ -716,9 +726,9 @@ normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF) 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 $@ -pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o normal_mod-normal_color.o +pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o -rm -f $@ - $(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o normal_mod-normal_color.o + $(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o mod-normal.o: mod-normal.c $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< @@ -906,6 +916,44 @@ partmap-normal_mod-normal_menu.lst: normal/menu.c $(normal/menu.c_DEPENDENCIES) set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) +normal_mod-normal_color.o: normal/color.c $(normal/color.c_DEPENDENCIES) + $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< +-include normal_mod-normal_color.d + +CLEANFILES += cmd-normal_mod-normal_color.lst fs-normal_mod-normal_color.lst partmap-normal_mod-normal_color.lst +COMMANDFILES += cmd-normal_mod-normal_color.lst +FSFILES += fs-normal_mod-normal_color.lst +PARTMAPFILES += partmap-normal_mod-normal_color.lst + +cmd-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) gencmdlist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genfslist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + +partmap-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genpartmaplist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_menu_viewer.o: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) + $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< +-include normal_mod-normal_menu_viewer.d + +CLEANFILES += cmd-normal_mod-normal_menu_viewer.lst fs-normal_mod-normal_menu_viewer.lst partmap-normal_mod-normal_menu_viewer.lst +COMMANDFILES += cmd-normal_mod-normal_menu_viewer.lst +FSFILES += fs-normal_mod-normal_menu_viewer.lst +PARTMAPFILES += partmap-normal_mod-normal_menu_viewer.lst + +cmd-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) gencmdlist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) genfslist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + +partmap-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) genpartmaplist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) + + normal_mod-normal_menu_entry.o: normal/menu_entry.c $(normal/menu_entry.c_DEPENDENCIES) $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< -include normal_mod-normal_menu_entry.d @@ -1001,25 +1049,6 @@ partmap-normal_mod-normal_i386_setjmp.lst: normal/i386/setjmp.S $(normal/i386/se set -e; $(TARGET_CC) -Inormal/i386 -I$(srcdir)/normal/i386 $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(normal_mod_ASFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) -normal_mod-normal_color.o: normal/color.c $(normal/color.c_DEPENDENCIES) - $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< --include normal_mod-normal_color.d - -CLEANFILES += cmd-normal_mod-normal_color.lst fs-normal_mod-normal_color.lst partmap-normal_mod-normal_color.lst -COMMANDFILES += cmd-normal_mod-normal_color.lst -FSFILES += fs-normal_mod-normal_color.lst -PARTMAPFILES += partmap-normal_mod-normal_color.lst - -cmd-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) gencmdlist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) - -fs-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genfslist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) - -partmap-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genpartmaplist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) - - normal_mod_CFLAGS = $(COMMON_CFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) normal_mod_LDFLAGS = $(COMMON_LDFLAGS) diff --git a/conf/i386-coreboot.rmk b/conf/i386-coreboot.rmk index ac9ea8f74..591ea74c8 100644 --- a/conf/i386-coreboot.rmk +++ b/conf/i386-coreboot.rmk @@ -111,12 +111,22 @@ linux_mod_SOURCES = loader/linux_normal.c linux_mod_CFLAGS = $(COMMON_CFLAGS) linux_mod_LDFLAGS = $(COMMON_LDFLAGS) -# For normal.mod. +# +# Only arch dependant part of normal.mod will be here. Common part for +# all architecures of normal.mod is at start and should be kept at sync +# with other makefiles. +# +# Please put arch dependant part of normal.mod at the end of list to +# keep it simpler to update to different architectures. +# normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ normal/completion.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ - normal/menu_entry.c normal/misc.c grub_script.tab.c \ - normal/script.c normal/i386/setjmp.S normal/color.c + normal/color.c \ + normal/menu_viewer.c normal/menu_entry.c \ + normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/i386/setjmp.S normal_mod_CFLAGS = $(COMMON_CFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) normal_mod_LDFLAGS = $(COMMON_LDFLAGS) diff --git a/conf/i386-efi.mk b/conf/i386-efi.mk index f9d7c1b82..ccd6ac7d9 100644 --- a/conf/i386-efi.mk +++ b/conf/i386-efi.mk @@ -731,18 +731,28 @@ symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h gensymlist. kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) -# For normal.mod. +# +# Only arch dependant part of normal.mod will be here. Common part for +# all architecures of normal.mod is at start and should be kept at sync +# with other makefiles. +# +# Please put arch dependant part of normal.mod at the end of list to +# keep it simpler to update to different architectures. +# normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ - normal/menu_entry.c normal/misc.c grub_script.tab.c \ - normal/script.c normal/i386/setjmp.S normal/color.c -CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o normal_mod-normal_color.o und-normal.lst + normal/color.c \ + normal/menu_viewer.c normal/menu_entry.c \ + normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/i386/setjmp.S +CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o und-normal.lst ifneq ($(normal_mod_EXPORTS),no) CLEANFILES += def-normal.lst DEFSYMFILES += def-normal.lst endif -MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_i386_setjmp.d normal_mod-normal_color.d +MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_color.d normal_mod-normal_menu_viewer.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_i386_setjmp.d UNDSYMFILES += und-normal.lst normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF) @@ -751,9 +761,9 @@ normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF) 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 $@ -pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o normal_mod-normal_color.o +pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o -rm -f $@ - $(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o normal_mod-normal_color.o + $(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o mod-normal.o: mod-normal.c $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< @@ -941,6 +951,44 @@ partmap-normal_mod-normal_menu.lst: normal/menu.c $(normal/menu.c_DEPENDENCIES) set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) +normal_mod-normal_color.o: normal/color.c $(normal/color.c_DEPENDENCIES) + $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< +-include normal_mod-normal_color.d + +CLEANFILES += cmd-normal_mod-normal_color.lst fs-normal_mod-normal_color.lst partmap-normal_mod-normal_color.lst +COMMANDFILES += cmd-normal_mod-normal_color.lst +FSFILES += fs-normal_mod-normal_color.lst +PARTMAPFILES += partmap-normal_mod-normal_color.lst + +cmd-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) gencmdlist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genfslist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + +partmap-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genpartmaplist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_menu_viewer.o: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) + $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< +-include normal_mod-normal_menu_viewer.d + +CLEANFILES += cmd-normal_mod-normal_menu_viewer.lst fs-normal_mod-normal_menu_viewer.lst partmap-normal_mod-normal_menu_viewer.lst +COMMANDFILES += cmd-normal_mod-normal_menu_viewer.lst +FSFILES += fs-normal_mod-normal_menu_viewer.lst +PARTMAPFILES += partmap-normal_mod-normal_menu_viewer.lst + +cmd-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) gencmdlist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) genfslist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + +partmap-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) genpartmaplist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) + + normal_mod-normal_menu_entry.o: normal/menu_entry.c $(normal/menu_entry.c_DEPENDENCIES) $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< -include normal_mod-normal_menu_entry.d @@ -1036,25 +1084,6 @@ partmap-normal_mod-normal_i386_setjmp.lst: normal/i386/setjmp.S $(normal/i386/se set -e; $(TARGET_CC) -Inormal/i386 -I$(srcdir)/normal/i386 $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(normal_mod_ASFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) -normal_mod-normal_color.o: normal/color.c $(normal/color.c_DEPENDENCIES) - $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< --include normal_mod-normal_color.d - -CLEANFILES += cmd-normal_mod-normal_color.lst fs-normal_mod-normal_color.lst partmap-normal_mod-normal_color.lst -COMMANDFILES += cmd-normal_mod-normal_color.lst -FSFILES += fs-normal_mod-normal_color.lst -PARTMAPFILES += partmap-normal_mod-normal_color.lst - -cmd-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) gencmdlist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) - -fs-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genfslist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) - -partmap-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genpartmaplist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) - - normal_mod_CFLAGS = $(COMMON_CFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) normal_mod_LDFLAGS = $(COMMON_LDFLAGS) diff --git a/conf/i386-efi.rmk b/conf/i386-efi.rmk index c13a3a789..0ab02f653 100644 --- a/conf/i386-efi.rmk +++ b/conf/i386-efi.rmk @@ -108,12 +108,22 @@ symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h gensymlist. kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) -# For normal.mod. +# +# Only arch dependant part of normal.mod will be here. Common part for +# all architecures of normal.mod is at start and should be kept at sync +# with other makefiles. +# +# Please put arch dependant part of normal.mod at the end of list to +# keep it simpler to update to different architectures. +# normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ - normal/menu_entry.c normal/misc.c grub_script.tab.c \ - normal/script.c normal/i386/setjmp.S normal/color.c + normal/color.c \ + normal/menu_viewer.c normal/menu_entry.c \ + normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/i386/setjmp.S normal_mod_CFLAGS = $(COMMON_CFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) normal_mod_LDFLAGS = $(COMMON_LDFLAGS) diff --git a/conf/i386-ieee1275.mk b/conf/i386-ieee1275.mk index 5923b6f02..26dda9028 100644 --- a/conf/i386-ieee1275.mk +++ b/conf/i386-ieee1275.mk @@ -590,18 +590,28 @@ pkglib_MODULES = normal.mod halt.mod reboot.mod suspend.mod \ _linux.mod nand.mod memdisk.mod pci.mod lspci.mod datetime.mod \ date.mod datehook.mod lsmmap.mod -# For normal.mod. +# +# Only arch dependant part of normal.mod will be here. Common part for +# all architecures of normal.mod is at start and should be kept at sync +# with other makefiles. +# +# Please put arch dependant part of normal.mod at the end of list to +# keep it simpler to update to different architectures. +# normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ normal/completion.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ - normal/menu_entry.c normal/misc.c grub_script.tab.c \ - normal/script.c normal/i386/setjmp.S normal/color.c -CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o normal_mod-normal_color.o und-normal.lst + normal/color.c \ + normal/menu_viewer.c normal/menu_entry.c \ + normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/i386/setjmp.S +CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o und-normal.lst ifneq ($(normal_mod_EXPORTS),no) CLEANFILES += def-normal.lst DEFSYMFILES += def-normal.lst endif -MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_i386_setjmp.d normal_mod-normal_color.d +MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_color.d normal_mod-normal_menu_viewer.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_i386_setjmp.d UNDSYMFILES += und-normal.lst normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF) @@ -610,9 +620,9 @@ normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF) 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 $@ -pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o normal_mod-normal_color.o +pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o -rm -f $@ - $(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o normal_mod-normal_color.o + $(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o mod-normal.o: mod-normal.c $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< @@ -800,6 +810,44 @@ partmap-normal_mod-normal_menu.lst: normal/menu.c $(normal/menu.c_DEPENDENCIES) set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) +normal_mod-normal_color.o: normal/color.c $(normal/color.c_DEPENDENCIES) + $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< +-include normal_mod-normal_color.d + +CLEANFILES += cmd-normal_mod-normal_color.lst fs-normal_mod-normal_color.lst partmap-normal_mod-normal_color.lst +COMMANDFILES += cmd-normal_mod-normal_color.lst +FSFILES += fs-normal_mod-normal_color.lst +PARTMAPFILES += partmap-normal_mod-normal_color.lst + +cmd-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) gencmdlist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genfslist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + +partmap-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genpartmaplist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_menu_viewer.o: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) + $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< +-include normal_mod-normal_menu_viewer.d + +CLEANFILES += cmd-normal_mod-normal_menu_viewer.lst fs-normal_mod-normal_menu_viewer.lst partmap-normal_mod-normal_menu_viewer.lst +COMMANDFILES += cmd-normal_mod-normal_menu_viewer.lst +FSFILES += fs-normal_mod-normal_menu_viewer.lst +PARTMAPFILES += partmap-normal_mod-normal_menu_viewer.lst + +cmd-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) gencmdlist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) genfslist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + +partmap-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) genpartmaplist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) + + normal_mod-normal_menu_entry.o: normal/menu_entry.c $(normal/menu_entry.c_DEPENDENCIES) $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< -include normal_mod-normal_menu_entry.d @@ -895,25 +943,6 @@ partmap-normal_mod-normal_i386_setjmp.lst: normal/i386/setjmp.S $(normal/i386/se set -e; $(TARGET_CC) -Inormal/i386 -I$(srcdir)/normal/i386 $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(normal_mod_ASFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) -normal_mod-normal_color.o: normal/color.c $(normal/color.c_DEPENDENCIES) - $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< --include normal_mod-normal_color.d - -CLEANFILES += cmd-normal_mod-normal_color.lst fs-normal_mod-normal_color.lst partmap-normal_mod-normal_color.lst -COMMANDFILES += cmd-normal_mod-normal_color.lst -FSFILES += fs-normal_mod-normal_color.lst -PARTMAPFILES += partmap-normal_mod-normal_color.lst - -cmd-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) gencmdlist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) - -fs-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genfslist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) - -partmap-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genpartmaplist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) - - normal_mod_CFLAGS = $(COMMON_CFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) normal_mod_LDFLAGS = $(COMMON_LDFLAGS) diff --git a/conf/i386-ieee1275.rmk b/conf/i386-ieee1275.rmk index ce11a257b..3e75b2781 100644 --- a/conf/i386-ieee1275.rmk +++ b/conf/i386-ieee1275.rmk @@ -101,12 +101,22 @@ pkglib_MODULES = normal.mod halt.mod reboot.mod suspend.mod \ _linux.mod nand.mod memdisk.mod pci.mod lspci.mod datetime.mod \ date.mod datehook.mod lsmmap.mod -# For normal.mod. +# +# Only arch dependant part of normal.mod will be here. Common part for +# all architecures of normal.mod is at start and should be kept at sync +# with other makefiles. +# +# Please put arch dependant part of normal.mod at the end of list to +# keep it simpler to update to different architectures. +# normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ normal/completion.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ - normal/menu_entry.c normal/misc.c grub_script.tab.c \ - normal/script.c normal/i386/setjmp.S normal/color.c + normal/color.c \ + normal/menu_viewer.c normal/menu_entry.c \ + normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/i386/setjmp.S normal_mod_CFLAGS = $(COMMON_CFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) normal_mod_LDFLAGS = $(COMMON_LDFLAGS) diff --git a/conf/i386-pc.mk b/conf/i386-pc.mk index 5297fa6b3..4482329b3 100644 --- a/conf/i386-pc.mk +++ b/conf/i386-pc.mk @@ -1216,19 +1216,28 @@ partmap-linux_mod-loader_linux_normal.lst: loader/linux_normal.c $(loader/linux_ linux_mod_CFLAGS = $(COMMON_CFLAGS) linux_mod_LDFLAGS = $(COMMON_LDFLAGS) -# For normal.mod. +# +# Only arch dependant part of normal.mod will be here. Common part for +# all architecures of normal.mod is at start and should be kept at sync +# with other makefiles. +# +# Please put arch dependant part of normal.mod at the end of list to +# keep it simpler to update to different architectures. +# normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ normal/completion.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/color.c \ - normal/menu_entry.c normal/misc.c grub_script.tab.c \ - normal/script.c normal/i386/setjmp.S -CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o und-normal.lst + normal/menu_viewer.c normal/menu_entry.c \ + normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/i386/setjmp.S +CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o und-normal.lst ifneq ($(normal_mod_EXPORTS),no) CLEANFILES += def-normal.lst DEFSYMFILES += def-normal.lst endif -MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_color.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_i386_setjmp.d +MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_color.d normal_mod-normal_menu_viewer.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_i386_setjmp.d UNDSYMFILES += und-normal.lst normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF) @@ -1237,9 +1246,9 @@ normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF) 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 $@ -pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o +pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o -rm -f $@ - $(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o + $(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o mod-normal.o: mod-normal.c $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< @@ -1446,6 +1455,25 @@ partmap-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIE set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) +normal_mod-normal_menu_viewer.o: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) + $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< +-include normal_mod-normal_menu_viewer.d + +CLEANFILES += cmd-normal_mod-normal_menu_viewer.lst fs-normal_mod-normal_menu_viewer.lst partmap-normal_mod-normal_menu_viewer.lst +COMMANDFILES += cmd-normal_mod-normal_menu_viewer.lst +FSFILES += fs-normal_mod-normal_menu_viewer.lst +PARTMAPFILES += partmap-normal_mod-normal_menu_viewer.lst + +cmd-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) gencmdlist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) genfslist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + +partmap-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) genpartmaplist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) + + normal_mod-normal_menu_entry.o: normal/menu_entry.c $(normal/menu_entry.c_DEPENDENCIES) $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< -include normal_mod-normal_menu_entry.d diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index 099825277..1b9cc214c 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -191,13 +191,22 @@ linux_mod_SOURCES = loader/linux_normal.c linux_mod_CFLAGS = $(COMMON_CFLAGS) linux_mod_LDFLAGS = $(COMMON_LDFLAGS) -# For normal.mod. +# +# Only arch dependant part of normal.mod will be here. Common part for +# all architecures of normal.mod is at start and should be kept at sync +# with other makefiles. +# +# Please put arch dependant part of normal.mod at the end of list to +# keep it simpler to update to different architectures. +# normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ normal/completion.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/color.c \ - normal/menu_entry.c normal/misc.c grub_script.tab.c \ - normal/script.c normal/i386/setjmp.S + normal/menu_viewer.c normal/menu_entry.c \ + normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/i386/setjmp.S normal_mod_CFLAGS = $(COMMON_CFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) normal_mod_LDFLAGS = $(COMMON_LDFLAGS) diff --git a/conf/powerpc-ieee1275.mk b/conf/powerpc-ieee1275.mk index c98197d04..038d44988 100644 --- a/conf/powerpc-ieee1275.mk +++ b/conf/powerpc-ieee1275.mk @@ -704,18 +704,28 @@ partmap-linux_mod-loader_powerpc_ieee1275_linux_normal.lst: loader/powerpc/ieee1 linux_mod_CFLAGS = $(COMMON_CFLAGS) linux_mod_LDFLAGS = $(COMMON_LDFLAGS) -# For normal.mod. +# +# Only arch dependant part of normal.mod will be here. Common part for +# all architecures of normal.mod is at start and should be kept at sync +# with other makefiles. +# +# Please put arch dependant part of normal.mod at the end of list to +# keep it simpler to update to different architectures. +# normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ normal/completion.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ - normal/menu_entry.c normal/misc.c grub_script.tab.c \ - normal/script.c normal/powerpc/setjmp.S normal/color.c -CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_powerpc_setjmp.o normal_mod-normal_color.o und-normal.lst + normal/color.c \ + normal/menu_viewer.c normal/menu_entry.c \ + normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/powerpc/setjmp.S +CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_powerpc_setjmp.o und-normal.lst ifneq ($(normal_mod_EXPORTS),no) CLEANFILES += def-normal.lst DEFSYMFILES += def-normal.lst endif -MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_powerpc_setjmp.d normal_mod-normal_color.d +MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_color.d normal_mod-normal_menu_viewer.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_powerpc_setjmp.d UNDSYMFILES += und-normal.lst normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF) @@ -724,9 +734,9 @@ normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF) 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 $@ -pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_powerpc_setjmp.o normal_mod-normal_color.o +pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_powerpc_setjmp.o -rm -f $@ - $(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_powerpc_setjmp.o normal_mod-normal_color.o + $(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_powerpc_setjmp.o mod-normal.o: mod-normal.c $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< @@ -914,6 +924,44 @@ partmap-normal_mod-normal_menu.lst: normal/menu.c $(normal/menu.c_DEPENDENCIES) set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) +normal_mod-normal_color.o: normal/color.c $(normal/color.c_DEPENDENCIES) + $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< +-include normal_mod-normal_color.d + +CLEANFILES += cmd-normal_mod-normal_color.lst fs-normal_mod-normal_color.lst partmap-normal_mod-normal_color.lst +COMMANDFILES += cmd-normal_mod-normal_color.lst +FSFILES += fs-normal_mod-normal_color.lst +PARTMAPFILES += partmap-normal_mod-normal_color.lst + +cmd-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) gencmdlist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genfslist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + +partmap-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genpartmaplist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_menu_viewer.o: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) + $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< +-include normal_mod-normal_menu_viewer.d + +CLEANFILES += cmd-normal_mod-normal_menu_viewer.lst fs-normal_mod-normal_menu_viewer.lst partmap-normal_mod-normal_menu_viewer.lst +COMMANDFILES += cmd-normal_mod-normal_menu_viewer.lst +FSFILES += fs-normal_mod-normal_menu_viewer.lst +PARTMAPFILES += partmap-normal_mod-normal_menu_viewer.lst + +cmd-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) gencmdlist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) genfslist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + +partmap-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) genpartmaplist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) + + normal_mod-normal_menu_entry.o: normal/menu_entry.c $(normal/menu_entry.c_DEPENDENCIES) $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< -include normal_mod-normal_menu_entry.d @@ -1009,28 +1057,9 @@ partmap-normal_mod-normal_powerpc_setjmp.lst: normal/powerpc/setjmp.S $(normal/p set -e; $(TARGET_CC) -Inormal/powerpc -I$(srcdir)/normal/powerpc $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(normal_mod_ASFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) -normal_mod-normal_color.o: normal/color.c $(normal/color.c_DEPENDENCIES) - $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< --include normal_mod-normal_color.d - -CLEANFILES += cmd-normal_mod-normal_color.lst fs-normal_mod-normal_color.lst partmap-normal_mod-normal_color.lst -COMMANDFILES += cmd-normal_mod-normal_color.lst -FSFILES += fs-normal_mod-normal_color.lst -PARTMAPFILES += partmap-normal_mod-normal_color.lst - -cmd-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) gencmdlist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) - -fs-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genfslist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) - -partmap-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genpartmaplist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) - - normal_mod_CFLAGS = $(COMMON_CFLAGS) -normal_mod_LDFLAGS = $(COMMON_LDFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) +normal_mod_LDFLAGS = $(COMMON_LDFLAGS) # For suspend.mod suspend_mod_SOURCES = commands/ieee1275/suspend.c diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk index f22540f0a..7f5425472 100644 --- a/conf/powerpc-ieee1275.rmk +++ b/conf/powerpc-ieee1275.rmk @@ -121,15 +121,25 @@ linux_mod_SOURCES = loader/powerpc/ieee1275/linux_normal.c linux_mod_CFLAGS = $(COMMON_CFLAGS) linux_mod_LDFLAGS = $(COMMON_LDFLAGS) -# For normal.mod. +# +# Only arch dependant part of normal.mod will be here. Common part for +# all architecures of normal.mod is at start and should be kept at sync +# with other makefiles. +# +# Please put arch dependant part of normal.mod at the end of list to +# keep it simpler to update to different architectures. +# normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ normal/completion.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ - normal/menu_entry.c normal/misc.c grub_script.tab.c \ - normal/script.c normal/powerpc/setjmp.S normal/color.c + normal/color.c \ + normal/menu_viewer.c normal/menu_entry.c \ + normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/powerpc/setjmp.S normal_mod_CFLAGS = $(COMMON_CFLAGS) -normal_mod_LDFLAGS = $(COMMON_LDFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) +normal_mod_LDFLAGS = $(COMMON_LDFLAGS) # For suspend.mod suspend_mod_SOURCES = commands/ieee1275/suspend.c diff --git a/conf/sparc64-ieee1275.mk b/conf/sparc64-ieee1275.mk index 901b62649..a9033a530 100644 --- a/conf/sparc64-ieee1275.mk +++ b/conf/sparc64-ieee1275.mk @@ -781,19 +781,28 @@ sfs_mod_LDFLAGS = $(COMMON_LDFLAGS) #linux_mod_CFLAGS = $(COMMON_CFLAGS) #linux_mod_LDFLAGS = $(COMMON_LDFLAGS) -# For normal.mod. +# +# Only arch dependant part of normal.mod will be here. Common part for +# all architecures of normal.mod is at start and should be kept at sync +# with other makefiles. +# +# Please put arch dependant part of normal.mod at the end of list to +# keep it simpler to update to different architectures. +# normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ - normal/menu_entry.c normal/misc.c normal/script.c \ - normal/sparc64/setjmp.S \ - grub_script.tab.c -CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-normal_script.o normal_mod-normal_sparc64_setjmp.o normal_mod-grub_script_tab.o und-normal.lst + normal/color.c \ + normal/menu_viewer.c normal/menu_entry.c \ + normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/sparc64/setjmp.S +CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_sparc64_setjmp.o und-normal.lst ifneq ($(normal_mod_EXPORTS),no) CLEANFILES += def-normal.lst DEFSYMFILES += def-normal.lst endif -MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-normal_script.d normal_mod-normal_sparc64_setjmp.d normal_mod-grub_script_tab.d +MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_color.d normal_mod-normal_menu_viewer.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_sparc64_setjmp.d UNDSYMFILES += und-normal.lst normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF) @@ -802,9 +811,9 @@ normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF) 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 $@ -pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-normal_script.o normal_mod-normal_sparc64_setjmp.o normal_mod-grub_script_tab.o +pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_sparc64_setjmp.o -rm -f $@ - $(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-normal_script.o normal_mod-normal_sparc64_setjmp.o normal_mod-grub_script_tab.o + $(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_sparc64_setjmp.o mod-normal.o: mod-normal.c $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< @@ -992,6 +1001,44 @@ partmap-normal_mod-normal_menu.lst: normal/menu.c $(normal/menu.c_DEPENDENCIES) set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) +normal_mod-normal_color.o: normal/color.c $(normal/color.c_DEPENDENCIES) + $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< +-include normal_mod-normal_color.d + +CLEANFILES += cmd-normal_mod-normal_color.lst fs-normal_mod-normal_color.lst partmap-normal_mod-normal_color.lst +COMMANDFILES += cmd-normal_mod-normal_color.lst +FSFILES += fs-normal_mod-normal_color.lst +PARTMAPFILES += partmap-normal_mod-normal_color.lst + +cmd-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) gencmdlist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genfslist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + +partmap-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genpartmaplist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_menu_viewer.o: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) + $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< +-include normal_mod-normal_menu_viewer.d + +CLEANFILES += cmd-normal_mod-normal_menu_viewer.lst fs-normal_mod-normal_menu_viewer.lst partmap-normal_mod-normal_menu_viewer.lst +COMMANDFILES += cmd-normal_mod-normal_menu_viewer.lst +FSFILES += fs-normal_mod-normal_menu_viewer.lst +PARTMAPFILES += partmap-normal_mod-normal_menu_viewer.lst + +cmd-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) gencmdlist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) genfslist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + +partmap-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) genpartmaplist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) + + normal_mod-normal_menu_entry.o: normal/menu_entry.c $(normal/menu_entry.c_DEPENDENCIES) $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< -include normal_mod-normal_menu_entry.d @@ -1030,6 +1077,25 @@ partmap-normal_mod-normal_misc.lst: normal/misc.c $(normal/misc.c_DEPENDENCIES) set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) +normal_mod-grub_script_tab.o: grub_script.tab.c $(grub_script.tab.c_DEPENDENCIES) + $(TARGET_CC) -I. -I$(srcdir)/. $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< +-include normal_mod-grub_script_tab.d + +CLEANFILES += cmd-normal_mod-grub_script_tab.lst fs-normal_mod-grub_script_tab.lst partmap-normal_mod-grub_script_tab.lst +COMMANDFILES += cmd-normal_mod-grub_script_tab.lst +FSFILES += fs-normal_mod-grub_script_tab.lst +PARTMAPFILES += partmap-normal_mod-grub_script_tab.lst + +cmd-normal_mod-grub_script_tab.lst: grub_script.tab.c $(grub_script.tab.c_DEPENDENCIES) gencmdlist.sh + set -e; $(TARGET_CC) -I. -I$(srcdir)/. $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-grub_script_tab.lst: grub_script.tab.c $(grub_script.tab.c_DEPENDENCIES) genfslist.sh + set -e; $(TARGET_CC) -I. -I$(srcdir)/. $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + +partmap-normal_mod-grub_script_tab.lst: grub_script.tab.c $(grub_script.tab.c_DEPENDENCIES) genpartmaplist.sh + set -e; $(TARGET_CC) -I. -I$(srcdir)/. $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) + + normal_mod-normal_script.o: normal/script.c $(normal/script.c_DEPENDENCIES) $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< -include normal_mod-normal_script.d @@ -1068,25 +1134,6 @@ partmap-normal_mod-normal_sparc64_setjmp.lst: normal/sparc64/setjmp.S $(normal/s set -e; $(TARGET_CC) -Inormal/sparc64 -I$(srcdir)/normal/sparc64 $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(normal_mod_ASFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) -normal_mod-grub_script_tab.o: grub_script.tab.c $(grub_script.tab.c_DEPENDENCIES) - $(TARGET_CC) -I. -I$(srcdir)/. $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< --include normal_mod-grub_script_tab.d - -CLEANFILES += cmd-normal_mod-grub_script_tab.lst fs-normal_mod-grub_script_tab.lst partmap-normal_mod-grub_script_tab.lst -COMMANDFILES += cmd-normal_mod-grub_script_tab.lst -FSFILES += fs-normal_mod-grub_script_tab.lst -PARTMAPFILES += partmap-normal_mod-grub_script_tab.lst - -cmd-normal_mod-grub_script_tab.lst: grub_script.tab.c $(grub_script.tab.c_DEPENDENCIES) gencmdlist.sh - set -e; $(TARGET_CC) -I. -I$(srcdir)/. $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) - -fs-normal_mod-grub_script_tab.lst: grub_script.tab.c $(grub_script.tab.c_DEPENDENCIES) genfslist.sh - set -e; $(TARGET_CC) -I. -I$(srcdir)/. $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) - -partmap-normal_mod-grub_script_tab.lst: grub_script.tab.c $(grub_script.tab.c_DEPENDENCIES) genpartmaplist.sh - set -e; $(TARGET_CC) -I. -I$(srcdir)/. $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) - - normal_mod_CFLAGS = $(COMMON_CFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) normal_mod_LDFLAGS = $(COMMON_LDFLAGS) diff --git a/conf/sparc64-ieee1275.rmk b/conf/sparc64-ieee1275.rmk index f658ac249..17dd175e0 100644 --- a/conf/sparc64-ieee1275.rmk +++ b/conf/sparc64-ieee1275.rmk @@ -154,13 +154,22 @@ sfs_mod_LDFLAGS = $(COMMON_LDFLAGS) #linux_mod_CFLAGS = $(COMMON_CFLAGS) #linux_mod_LDFLAGS = $(COMMON_LDFLAGS) -# For normal.mod. +# +# Only arch dependant part of normal.mod will be here. Common part for +# all architecures of normal.mod is at start and should be kept at sync +# with other makefiles. +# +# Please put arch dependant part of normal.mod at the end of list to +# keep it simpler to update to different architectures. +# normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ - normal/menu_entry.c normal/misc.c normal/script.c \ - normal/sparc64/setjmp.S \ - grub_script.tab.c + normal/color.c \ + normal/menu_viewer.c normal/menu_entry.c \ + normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/sparc64/setjmp.S normal_mod_CFLAGS = $(COMMON_CFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) normal_mod_LDFLAGS = $(COMMON_LDFLAGS) diff --git a/conf/x86_64-efi.mk b/conf/x86_64-efi.mk index ca8d6cdd7..3f5e0b553 100644 --- a/conf/x86_64-efi.mk +++ b/conf/x86_64-efi.mk @@ -738,18 +738,28 @@ symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h gensymlist. kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) -# For normal.mod. +# +# Only arch dependant part of normal.mod will be here. Common part for +# all architecures of normal.mod is at start and should be kept at sync +# with other makefiles. +# +# Please put arch dependant part of normal.mod at the end of list to +# keep it simpler to update to different architectures. +# normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ - normal/menu_entry.c normal/misc.c grub_script.tab.c \ - normal/script.c normal/x86_64/setjmp.S normal/color.c -CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_x86_64_setjmp.o normal_mod-normal_color.o und-normal.lst + normal/color.c \ + normal/menu_viewer.c normal/menu_entry.c \ + normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/x86_64/setjmp.S +CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_x86_64_setjmp.o und-normal.lst ifneq ($(normal_mod_EXPORTS),no) CLEANFILES += def-normal.lst DEFSYMFILES += def-normal.lst endif -MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_x86_64_setjmp.d normal_mod-normal_color.d +MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_color.d normal_mod-normal_menu_viewer.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_x86_64_setjmp.d UNDSYMFILES += und-normal.lst normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF) @@ -758,9 +768,9 @@ normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF) 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 $@ -pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_x86_64_setjmp.o normal_mod-normal_color.o +pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_x86_64_setjmp.o -rm -f $@ - $(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_x86_64_setjmp.o normal_mod-normal_color.o + $(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_x86_64_setjmp.o mod-normal.o: mod-normal.c $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< @@ -948,6 +958,44 @@ partmap-normal_mod-normal_menu.lst: normal/menu.c $(normal/menu.c_DEPENDENCIES) set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) +normal_mod-normal_color.o: normal/color.c $(normal/color.c_DEPENDENCIES) + $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< +-include normal_mod-normal_color.d + +CLEANFILES += cmd-normal_mod-normal_color.lst fs-normal_mod-normal_color.lst partmap-normal_mod-normal_color.lst +COMMANDFILES += cmd-normal_mod-normal_color.lst +FSFILES += fs-normal_mod-normal_color.lst +PARTMAPFILES += partmap-normal_mod-normal_color.lst + +cmd-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) gencmdlist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genfslist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + +partmap-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genpartmaplist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) + + +normal_mod-normal_menu_viewer.o: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) + $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< +-include normal_mod-normal_menu_viewer.d + +CLEANFILES += cmd-normal_mod-normal_menu_viewer.lst fs-normal_mod-normal_menu_viewer.lst partmap-normal_mod-normal_menu_viewer.lst +COMMANDFILES += cmd-normal_mod-normal_menu_viewer.lst +FSFILES += fs-normal_mod-normal_menu_viewer.lst +PARTMAPFILES += partmap-normal_mod-normal_menu_viewer.lst + +cmd-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) gencmdlist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) + +fs-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) genfslist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) + +partmap-normal_mod-normal_menu_viewer.lst: normal/menu_viewer.c $(normal/menu_viewer.c_DEPENDENCIES) genpartmaplist.sh + set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) + + normal_mod-normal_menu_entry.o: normal/menu_entry.c $(normal/menu_entry.c_DEPENDENCIES) $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< -include normal_mod-normal_menu_entry.d @@ -1043,25 +1091,6 @@ partmap-normal_mod-normal_x86_64_setjmp.lst: normal/x86_64/setjmp.S $(normal/x86 set -e; $(TARGET_CC) -Inormal/x86_64 -I$(srcdir)/normal/x86_64 $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(normal_mod_ASFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) -normal_mod-normal_color.o: normal/color.c $(normal/color.c_DEPENDENCIES) - $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $< --include normal_mod-normal_color.d - -CLEANFILES += cmd-normal_mod-normal_color.lst fs-normal_mod-normal_color.lst partmap-normal_mod-normal_color.lst -COMMANDFILES += cmd-normal_mod-normal_color.lst -FSFILES += fs-normal_mod-normal_color.lst -PARTMAPFILES += partmap-normal_mod-normal_color.lst - -cmd-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) gencmdlist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1) - -fs-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genfslist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1) - -partmap-normal_mod-normal_color.lst: normal/color.c $(normal/color.c_DEPENDENCIES) genpartmaplist.sh - set -e; $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1) - - normal_mod_CFLAGS = $(COMMON_CFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) normal_mod_LDFLAGS = $(COMMON_LDFLAGS) diff --git a/conf/x86_64-efi.rmk b/conf/x86_64-efi.rmk index a1b94b664..eb7f6d177 100644 --- a/conf/x86_64-efi.rmk +++ b/conf/x86_64-efi.rmk @@ -110,12 +110,22 @@ symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h gensymlist. kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) -# For normal.mod. +# +# Only arch dependant part of normal.mod will be here. Common part for +# all architecures of normal.mod is at start and should be kept at sync +# with other makefiles. +# +# Please put arch dependant part of normal.mod at the end of list to +# keep it simpler to update to different architectures. +# normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ - normal/menu_entry.c normal/misc.c grub_script.tab.c \ - normal/script.c normal/x86_64/setjmp.S normal/color.c + normal/color.c \ + normal/menu_viewer.c normal/menu_entry.c \ + normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/x86_64/setjmp.S normal_mod_CFLAGS = $(COMMON_CFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) normal_mod_LDFLAGS = $(COMMON_LDFLAGS) diff --git a/include/grub/menu.h b/include/grub/menu.h new file mode 100644 index 000000000..6850846b4 --- /dev/null +++ b/include/grub/menu.h @@ -0,0 +1,63 @@ +/* menu.h - Menu and menu entry model declarations. */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_MENU_HEADER +#define GRUB_MENU_HEADER 1 + +struct grub_menu_entry_class +{ + char *name; + struct grub_menu_entry_class *next; +}; + +/* The menu entry. */ +struct grub_menu_entry +{ + /* The title name. */ + const char *title; + + /* The classes associated with the menu entry: + used to choose an icon or other style attributes. + This is a dummy head node for the linked list, so for an entry E, + E.classes->next is the first class if it is not NULL. */ + struct grub_menu_entry_class *classes; + + /* The commands associated with this menu entry. */ + struct grub_script *commands; + + /* The sourcecode of the menu entry, used by the editor. */ + const char *sourcecode; + + /* The next element. */ + struct grub_menu_entry *next; +}; +typedef struct grub_menu_entry *grub_menu_entry_t; + +/* The menu. */ +struct grub_menu +{ + /* The size of a menu. */ + int size; + + /* The list of menu entries. */ + grub_menu_entry_t entry_list; +}; +typedef struct grub_menu *grub_menu_t; + +#endif /* GRUB_MENU_HEADER */ diff --git a/include/grub/menu_viewer.h b/include/grub/menu_viewer.h new file mode 100644 index 000000000..725c97548 --- /dev/null +++ b/include/grub/menu_viewer.h @@ -0,0 +1,43 @@ +/* menu_viewer.h - Interface to menu viewer implementations. */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_MENU_VIEWER_HEADER +#define GRUB_MENU_VIEWER_HEADER 1 + +#include +#include +#include +#include + +struct grub_menu_viewer +{ + /* The menu viewer name. */ + const char *name; + + grub_err_t (*show_menu) (grub_menu_t menu, int nested); + + struct grub_menu_viewer *next; +}; +typedef struct grub_menu_viewer *grub_menu_viewer_t; + +void grub_menu_viewer_register (grub_menu_viewer_t viewer); + +grub_err_t grub_menu_viewer_show_menu (grub_menu_t menu, int nested); + +#endif /* GRUB_MENU_VIEWER_HEADER */ diff --git a/include/grub/normal.h b/include/grub/normal.h index 544a95787..8cb715bbe 100644 --- a/include/grub/normal.h +++ b/include/grub/normal.h @@ -1,7 +1,7 @@ /* normal.h - prototypes for the normal mode */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2003,2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2002,2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ #include #include #include +#include /* The maximum size of a command-line. */ #define GRUB_MAX_CMDLINE 1600 @@ -84,34 +85,6 @@ struct grub_command }; typedef struct grub_command *grub_command_t; -/* The menu entry. */ -struct grub_menu_entry -{ - /* The title name. */ - const char *title; - - /* The commands associated with this menu entry. */ - struct grub_script *commands; - - /* The sourcecode of the menu entry, used by the editor. */ - const char *sourcecode; - - /* The next element. */ - struct grub_menu_entry *next; -}; -typedef struct grub_menu_entry *grub_menu_entry_t; - -/* The menu. */ -struct grub_menu -{ - /* The size of a menu. */ - int size; - - /* The list of menu entries. */ - grub_menu_entry_t entry_list; -}; -typedef struct grub_menu *grub_menu_t; - /* This is used to store the names of filesystem modules for auto-loading. */ struct grub_fs_module_list { @@ -123,10 +96,12 @@ typedef struct grub_fs_module_list *grub_fs_module_list_t; /* To exit from the normal mode. */ extern grub_jmp_buf grub_exit_env; +extern struct grub_menu_viewer grub_normal_terminal_menu_viewer; + void grub_enter_normal_mode (const char *config); void grub_normal_execute (const char *config, int nested); -void grub_menu_run (grub_menu_t menu, int nested); void grub_menu_entry_run (grub_menu_entry_t entry); +void grub_menu_execute_entry(grub_menu_entry_t entry); void grub_cmdline_run (int nested); int grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, int echo_char, int readline); @@ -152,7 +127,7 @@ void grub_arg_show_help (grub_command_t cmd); char *grub_normal_do_completion (char *buf, int *restore, void (*hook) (const char *item, grub_completion_type_t type, int count)); grub_err_t grub_normal_print_device_info (const char *name); -grub_err_t grub_normal_menu_addentry (const char *title, +grub_err_t grub_normal_menu_addentry (int argc, const char **args, struct grub_script *script, const char *sourcecode); char *grub_env_write_color_normal (struct grub_env_var *var, const char *val); diff --git a/include/grub/script.h b/include/grub/script.h index 5218d1352..4d18b9266 100644 --- a/include/grub/script.h +++ b/include/grub/script.h @@ -1,7 +1,7 @@ /* script.h */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2007 Free Software Foundation, Inc. + * Copyright (C) 2005,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -113,8 +113,8 @@ struct grub_script_cmd_menuentry { struct grub_script_cmd cmd; - /* The title of the menu entry. */ - struct grub_script_arg *title; + /* The arguments for this menu entry. */ + struct grub_script_arglist *arglist; /* The sourcecode the entry will be generated from. */ const char *sourcecode; @@ -204,7 +204,7 @@ grub_script_create_cmdif (struct grub_parser_param *state, struct grub_script_cmd * grub_script_create_cmdmenu (struct grub_parser_param *state, - struct grub_script_arg *title, + struct grub_script_arglist *arglist, char *sourcecode, int options); diff --git a/normal/execute.c b/normal/execute.c index 4211cad93..35b7a4be1 100644 --- a/normal/execute.c +++ b/normal/execute.c @@ -1,7 +1,7 @@ /* execute.c -- Execute a GRUB script. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -148,11 +148,11 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd) parser = (struct grub_arg_option *) grubcmd->options; while (parser && (parser++)->doc) maxargs++; - + /* Set up the option state. */ state = grub_malloc (sizeof (struct grub_arg_list) * maxargs); grub_memset (state, 0, sizeof (struct grub_arg_list) * maxargs); - + /* Start the command. */ if (! (grubcmd->flags & GRUB_COMMAND_FLAG_NO_ARG_PARSE)) { @@ -161,7 +161,7 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd) } else ret = (grubcmd->func) (state, argcount, args); - + grub_free (state); } else @@ -178,7 +178,7 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd) return ret; } -/* Execute a block of one or more commands. */ +/* Execute a block of one or more commands. */ grub_err_t grub_script_execute_cmdblock (struct grub_script_cmd *cmd) { @@ -216,32 +216,53 @@ grub_err_t grub_script_execute_menuentry (struct grub_script_cmd *cmd) { struct grub_script_cmd_menuentry *cmd_menuentry; - char *title; + struct grub_script_arglist *arglist; struct grub_script *script; + char **args = 0; + int argcount = 0; + int i = 0; cmd_menuentry = (struct grub_script_cmd_menuentry *) cmd; - /* The title can contain variables, parse them and generate a string - from it. */ - title = grub_script_execute_argument_to_string (cmd_menuentry->title); - if (! title) - return grub_errno; + if (cmd_menuentry->arglist) + { + argcount = cmd_menuentry->arglist->argcount; + + /* Create argv from the arguments. */ + args = grub_malloc (sizeof (char *) * argcount); + + if (! args) + { + return grub_errno; + } + + for (arglist = cmd_menuentry->arglist; arglist; arglist = arglist->next) + { + char *str; + str = grub_script_execute_argument_to_string (arglist->arg); + args[i++] = str; + } + } /* Parse the menu entry *again*. */ script = grub_script_parse ((char *) cmd_menuentry->sourcecode, 0); - if (! script) + /* Add new menu entry. */ + if (script) { - grub_free (title); - return grub_errno; + grub_normal_menu_addentry (argcount, (const char **)args, + script, cmd_menuentry->sourcecode); } - /* XXX: When this fails, the memory should be freed? */ - return grub_normal_menu_addentry (title, script, - cmd_menuentry->sourcecode); + /* Free arguments. */ + for (i = 0; i < argcount; i++) + grub_free (args[i]); + grub_free (args); + + return grub_errno; } - + /* Execute any GRUB pre-parsed command or script. */ grub_err_t diff --git a/normal/main.c b/normal/main.c index 2e6df90ea..09d17b26d 100644 --- a/normal/main.c +++ b/normal/main.c @@ -1,7 +1,7 @@ /* main.c - the normal mode main routine */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000,2001,2002,2003,2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2000,2001,2002,2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ #include #include #include +#include grub_jmp_buf grub_exit_env; @@ -147,14 +148,41 @@ free_menu (grub_menu_t menu) grub_env_unset_data_slot ("menu"); } +static void +free_menu_entry_classes (struct grub_menu_entry_class *head) +{ + /* Free all the classes. */ + while (head) + { + struct grub_menu_entry_class *next; + + grub_free (head->name); + next = head->next; + grub_free (head); + head = next; + } +} + grub_err_t -grub_normal_menu_addentry (const char *title, struct grub_script *script, +grub_normal_menu_addentry (int argc, const char **args, struct grub_script *script, const char *sourcecode) { - const char *menutitle; + const char *menutitle = 0; const char *menusourcecode; grub_menu_t menu; grub_menu_entry_t *last; + int failed = 0; + int i; + struct grub_menu_entry_class *classes_head; /* Dummy head node for list. */ + struct grub_menu_entry_class *classes_tail; + + /* Allocate dummy head node for class list. */ + classes_head = grub_malloc (sizeof (struct grub_menu_entry_class)); + if (! classes_head) + return grub_errno; + classes_head->name = 0; + classes_head->next = 0; + classes_tail = classes_head; menu = grub_env_get_data_slot("menu"); if (! menu) @@ -166,10 +194,81 @@ grub_normal_menu_addentry (const char *title, struct grub_script *script, if (! menusourcecode) return grub_errno; - menutitle = grub_strdup (title); - if (! menutitle) + /* Parse menu arguments. */ + for (i = 0; i < argc; i++) { + /* Capture arguments. */ + if (grub_strncmp ("--", args[i], 2) == 0) + { + const char *arg = &args[i][2]; + + /* Handle menu class. */ + if (grub_strcmp(arg, "class") == 0) + { + char *class_name; + struct grub_menu_entry_class *new_class; + + i++; + class_name = grub_strdup (args[i]); + if (! class_name) + { + failed = 1; + break; + } + + /* Create a new class and add it at the tail of the list. */ + new_class = grub_malloc (sizeof (struct grub_menu_entry_class)); + if (! new_class) + { + grub_free (class_name); + failed = 1; + break; + } + /* Fill in the new class node. */ + new_class->name = class_name; + new_class->next = 0; + /* Link the tail to it, and make it the new tail. */ + classes_tail->next = new_class; + classes_tail = new_class; + continue; + } + else + { + /* Handle invalid argument. */ + failed = 1; + grub_error (GRUB_ERR_MENU, "invalid argument for menuentry: %s", args[i]); + break; + } + } + + /* Capture title. */ + if (! menutitle) + { + menutitle = grub_strdup (args[i]); + } + else + { + failed = 1; + grub_error (GRUB_ERR_MENU, "too many titles for menuentry: %s", args[i]); + break; + } + } + + /* Validate arguments. */ + if ((! failed) && (! menutitle)) + { + grub_error (GRUB_ERR_MENU, "menuentry is missing title"); + failed = 1; + } + + /* If argument parsing failed, free any allocated resources. */ + if (failed) + { + free_menu_entry_classes (classes_head); + grub_free ((void *) menutitle); grub_free ((void *) menusourcecode); + + /* Here we assume that grub_error has been used to specify failure details. */ return grub_errno; } @@ -180,6 +279,7 @@ grub_normal_menu_addentry (const char *title, struct grub_script *script, *last = grub_malloc (sizeof (**last)); if (! *last) { + free_menu_entry_classes (classes_head); grub_free ((void *) menutitle); grub_free ((void *) menusourcecode); return grub_errno; @@ -187,6 +287,7 @@ grub_normal_menu_addentry (const char *title, struct grub_script *script, (*last)->commands = script; (*last)->title = menutitle; + (*last)->classes = classes_head; (*last)->next = 0; (*last)->sourcecode = menusourcecode; @@ -476,7 +577,7 @@ grub_normal_execute (const char *config, int nested) if (menu && menu->size) { - grub_menu_run (menu, nested); + grub_menu_viewer_show_menu (menu, nested); if (nested) free_menu (menu); } @@ -519,6 +620,8 @@ GRUB_MOD_INIT(normal) if (mod) grub_dl_ref (mod); + grub_menu_viewer_register (&grub_normal_terminal_menu_viewer); + grub_set_history (GRUB_DEFAULT_HISTORY_SIZE); /* Register a command "normal" for the rescue mode. */ diff --git a/normal/menu.c b/normal/menu.c index 7dd5300be..b4fec26f0 100644 --- a/normal/menu.c +++ b/normal/menu.c @@ -24,6 +24,7 @@ #include #include #include +#include static grub_uint8_t grub_color_menu_normal; static grub_uint8_t grub_color_menu_highlight; @@ -41,9 +42,9 @@ static void draw_border (void) { unsigned i; - + grub_setcolorstate (GRUB_TERM_COLOR_NORMAL); - + grub_gotoxy (GRUB_TERM_MARGIN, GRUB_TERM_TOP_BORDER_Y); grub_putcode (GRUB_TERM_DISP_UL); for (i = 0; i < (unsigned) GRUB_TERM_BORDER_WIDTH - 2; i++) @@ -97,7 +98,7 @@ print_message (int nested, int edit) grub_printf ("\n\ ESC to return previous menu."); } - + } static grub_menu_entry_t @@ -128,7 +129,7 @@ print_entry (int y, int highlight, grub_menu_entry_t entry) if (! unicode_title) /* XXX How to show this error? */ return; - + len = grub_utf8_to_ucs4 (unicode_title, title_len, (grub_uint8_t *) title, -1, 0); if (len < 0) @@ -157,7 +158,7 @@ print_entry (int y, int highlight, grub_menu_entry_t entry) grub_ssize_t width; width = grub_getcharwidth (unicode_title[i]); - + if (x + width > (GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_BORDER_WIDTH - GRUB_TERM_MARGIN - 1)) grub_putcode (GRUB_TERM_DISP_RIGHT); @@ -187,7 +188,7 @@ print_entries (grub_menu_t menu, int first, int offset) { grub_menu_entry_t e; int i; - + grub_gotoxy (GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_BORDER_WIDTH, GRUB_TERM_FIRST_ENTRY_Y); @@ -248,13 +249,13 @@ get_timeout (void) { char *val; int timeout; - + val = grub_env_get ("timeout"); if (! val) return -1; - + grub_error_push (); - + timeout = (int) grub_strtoul (val, 0, 0); /* If the value is invalid, unset the variable. */ @@ -266,7 +267,7 @@ get_timeout (void) } grub_error_pop (); - + return timeout; } @@ -278,7 +279,7 @@ set_timeout (int timeout) if (timeout > 0) { char buf[16]; - + grub_sprintf (buf, "%d", timeout); grub_env_set ("timeout", buf); } @@ -290,13 +291,13 @@ get_entry_number (const char *name) { char *val; int entry; - + val = grub_env_get (name); if (! val) return -1; - + grub_error_push (); - + entry = (int) grub_strtoul (val, 0, 0); if (grub_errno != GRUB_ERR_NONE) @@ -306,7 +307,7 @@ get_entry_number (const char *name) } grub_error_pop (); - + return entry; } @@ -317,7 +318,7 @@ print_timeout (int timeout, int offset, int second_stage) They are required to clear the line. */ char *msg = " The highlighted entry will be booted automatically in %ds. "; char *msg_end = grub_strchr (msg, '%'); - + grub_gotoxy (second_stage ? (msg_end - msg) : 0, GRUB_TERM_HEIGHT - 3); grub_printf (second_stage ? msg_end : msg, timeout); grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset); @@ -331,9 +332,9 @@ run_menu (grub_menu_t menu, int nested) grub_uint64_t saved_time; int default_entry; int timeout; - + first = 0; - + default_entry = get_entry_number ("default"); /* If DEFAULT_ENTRY is not within the menu entries, fall back to @@ -370,7 +371,7 @@ run_menu (grub_menu_t menu, int nested) { int c; timeout = get_timeout (); - + if (timeout > 0) { grub_uint64_t current_time; @@ -390,11 +391,11 @@ run_menu (grub_menu_t menu, int nested) grub_env_unset ("timeout"); return default_entry; } - + if (grub_checkkey () >= 0 || timeout < 0) { c = GRUB_TERM_ASCII_CHAR (grub_getkey ()); - + if (timeout >= 0) { grub_gotoxy (0, GRUB_TERM_HEIGHT - 3); @@ -404,7 +405,7 @@ run_menu (grub_menu_t menu, int nested) grub_env_unset ("fallback"); grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset); } - + switch (c) { case GRUB_TERM_HOME: @@ -439,7 +440,7 @@ run_menu (grub_menu_t menu, int nested) print_entries (menu, first, offset); } break; - + case GRUB_TERM_DOWN: case 'v': if (menu->size > first + offset + 1) @@ -459,7 +460,7 @@ run_menu (grub_menu_t menu, int nested) } } break; - + case GRUB_TERM_PPAGE: if (first == 0) { @@ -490,12 +491,12 @@ run_menu (grub_menu_t menu, int nested) else { first += GRUB_TERM_NUM_ENTRIES; - + if (first + offset >= menu->size) { first -= GRUB_TERM_NUM_ENTRIES; offset += GRUB_TERM_NUM_ENTRIES; - + if (offset > menu->size - 1 || offset > GRUB_TERM_NUM_ENTRIES - 1) { @@ -510,13 +511,13 @@ run_menu (grub_menu_t menu, int nested) } print_entries (menu, first, offset); break; - + case '\n': case '\r': case 6: grub_setcursor (1); return first + offset; - + case '\e': if (nested) { @@ -524,7 +525,7 @@ run_menu (grub_menu_t menu, int nested) return -1; } break; - + case 'c': grub_cmdline_run (1); goto refresh; @@ -536,11 +537,11 @@ run_menu (grub_menu_t menu, int nested) grub_menu_entry_run (e); } goto refresh; - + default: break; } - + grub_refresh (); } } @@ -550,25 +551,25 @@ run_menu (grub_menu_t menu, int nested) } /* Run a menu entry. */ -static void -run_menu_entry (grub_menu_entry_t entry) +void +grub_menu_execute_entry(grub_menu_entry_t entry) { grub_script_execute (entry->commands); - + if (grub_errno == GRUB_ERR_NONE && grub_loader_is_loaded ()) /* Implicit execution of boot, only if something is loaded. */ grub_command_execute ("boot", 0); } -void -grub_menu_run (grub_menu_t menu, int nested) +static grub_err_t +show_text_menu (grub_menu_t menu, int nested) { while (1) { int boot_entry; grub_menu_entry_t e; int fallback_entry; - + boot_entry = run_menu (menu, nested); if (boot_entry < 0) break; @@ -576,13 +577,13 @@ grub_menu_run (grub_menu_t menu, int nested) e = get_entry (menu, boot_entry); if (! e) continue; /* Menu is empty. */ - + grub_cls (); grub_setcursor (1); grub_printf (" Booting \'%s\'\n\n", e->title); - - run_menu_entry (e); + + grub_menu_execute_entry (e); /* Deal with a fallback entry. */ /* FIXME: Multiple fallback entries like GRUB Legacy. */ @@ -591,11 +592,11 @@ grub_menu_run (grub_menu_t menu, int nested) { grub_print_error (); grub_errno = GRUB_ERR_NONE; - + e = get_entry (menu, fallback_entry); grub_env_unset ("fallback"); grub_printf ("\n Falling back to \'%s\'\n\n", e->title); - run_menu_entry (e); + grub_menu_execute_entry (e); } if (grub_errno != GRUB_ERR_NONE) @@ -606,4 +607,12 @@ grub_menu_run (grub_menu_t menu, int nested) grub_wait_after_message (); } } + + return GRUB_ERR_NONE; } + +struct grub_menu_viewer grub_normal_terminal_menu_viewer = +{ + .name = "terminal", + .show_menu = show_text_menu +}; diff --git a/normal/menu_viewer.c b/normal/menu_viewer.c new file mode 100644 index 000000000..f7047c7fc --- /dev/null +++ b/normal/menu_viewer.c @@ -0,0 +1,63 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include +#include +#include +#include +#include + +/* The list of menu viewers. */ +static grub_menu_viewer_t menu_viewer_list; + +void +grub_menu_viewer_register (grub_menu_viewer_t viewer) +{ + viewer->next = menu_viewer_list; + menu_viewer_list = viewer; +} + +static grub_menu_viewer_t get_current_menu_viewer (void) +{ + const char *selected_name = grub_env_get ("menuviewer"); + + /* If none selected, pick the last registered one. */ + if (selected_name == 0) + return menu_viewer_list; + + grub_menu_viewer_t cur; + for (cur = menu_viewer_list; cur; cur = cur->next) + { + if (grub_strcmp (cur->name, selected_name) == 0) + return cur; + } + + /* Fall back to the first entry (or null). */ + return menu_viewer_list; +} + +grub_err_t +grub_menu_viewer_show_menu (grub_menu_t menu, int nested) +{ + grub_menu_viewer_t cur = get_current_menu_viewer (); + if (!cur) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "No menu viewer available."); + + return cur->show_menu (menu, nested); +} + diff --git a/normal/parser.y b/normal/parser.y index f3525927b..ea62b6434 100644 --- a/normal/parser.y +++ b/normal/parser.y @@ -1,7 +1,7 @@ /* parser.y - The scripting parser. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -204,7 +204,7 @@ commandblock: '{' ; /* A menu entry. Carefully save the memory that is allocated. */ -menuentry: "menuentry" argument +menuentry: "menuentry" arguments { grub_script_lexer_ref (state->lexerstate); } newlines '{' diff --git a/normal/script.c b/normal/script.c index 5169e4949..0d5d5a8b7 100644 --- a/normal/script.c +++ b/normal/script.c @@ -1,7 +1,7 @@ /* script.c -- Functions to create an in memory description of the script. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2006,2007 Free Software Foundation, Inc. + * Copyright (C) 2005,2006,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -206,7 +206,7 @@ grub_script_create_cmdif (struct grub_parser_param *state, The options for this entry are passed in OPTIONS. */ struct grub_script_cmd * grub_script_create_cmdmenu (struct grub_parser_param *state, - struct grub_script_arg *title, + struct grub_script_arglist *arglist, char *sourcecode, int options) { @@ -232,9 +232,9 @@ grub_script_create_cmdmenu (struct grub_parser_param *state, cmd->cmd.next = 0; /* XXX: Check if this memory is properly freed. */ cmd->sourcecode = sourcecode; - cmd->title = title; + cmd->arglist = arglist; cmd->options = options; - + return (struct grub_script_cmd *) cmd; }