diff --git a/conf/Makefile.common b/conf/Makefile.common index eb70f7f77..528fa418f 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -85,18 +85,12 @@ CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime # Define these variables to calm down automake -FS_FILES = +PP_FILES = DEF_FILES = UND_FILES = IMG_FILES = MOD_FILES = -VIDEO_FILES = MODULE_FILES = -HANDLER_FILES = -PARTMAP_FILES = -COMMAND_FILES = -PARTTOOL_FILES = -TERMINAL_FILES = KERNEL_HEADER_FILES = man_MANS = diff --git a/gentpl.py b/gentpl.py index 17bda02c6..783a425fa 100644 --- a/gentpl.py +++ b/gentpl.py @@ -290,17 +290,7 @@ def module(platform): r += gvar_add("platform_DATA", "[+ name +].mod") r += gvar_add("CLEANFILES", "def-[+ name +].lst und-[+ name +].lst mod-[+ name +].c mod-[+ name +].o [+ name +].mod") - r += gvar_add("COMMAND_FILES", "command-[+ name +].lst") - r += gvar_add("FS_FILES", "fs-[+ name +].lst") - r += gvar_add("VIDEO_FILES", "video-[+ name +].lst") - r += gvar_add("PARTMAP_FILES", "partmap-[+ name +].lst") - r += gvar_add("HANDLER_FILES", "handler-[+ name +].lst") - r += gvar_add("PARTTOOL_FILES", "parttool-[+ name +].lst") - r += gvar_add("TERMINAL_FILES", "terminal-[+ name +].lst") - r += gvar_add("CLEANFILES", "command-[+ name +].lst fs-[+ name +].lst") - r += gvar_add("CLEANFILES", "handler-[+ name +].lst terminal-[+ name +].lst") - r += gvar_add("CLEANFILES", "video-[+ name +].lst partmap-[+ name +].lst parttool-[+ name +].lst") - + r += gvar_add("PP_FILES", "[+ name +].pp") r += gvar_add("CLEANFILES", "[+ name +].pp") r += """ [+ name +].pp: $(""" + cname() + """_SOURCES) $(nodist_""" + cname() + """_SOURCES) @@ -332,27 +322,6 @@ mod-[+ name +].o: mod-[+ name +].c 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 $@; \ fi - -command-[+ name +].lst: [+ name +].pp $(srcdir)/gencmdlist.sh - cat $< | sh $(srcdir)/gencmdlist.sh [+ name +] > $@ || (rm -f $@; exit 1) - -fs-[+ name +].lst: [+ name +].pp $(srcdir)/genfslist.sh - cat $< | sh $(srcdir)/genfslist.sh [+ name +] > $@ || (rm -f $@; exit 1) - -video-[+ name +].lst: [+ name +].pp $(srcdir)/genvideolist.sh - cat $< | sh $(srcdir)/genvideolist.sh [+ name +] > $@ || (rm -f $@; exit 1) - -partmap-[+ name +].lst: [+ name +].pp $(srcdir)/genpartmaplist.sh - cat $< | sh $(srcdir)/genpartmaplist.sh [+ name +] > $@ || (rm -f $@; exit 1) - -parttool-[+ name +].lst: [+ name +].pp $(srcdir)/genparttoollist.sh - cat $< | sh $(srcdir)/genparttoollist.sh [+ name +] > $@ || (rm -f $@; exit 1) - -handler-[+ name +].lst: [+ name +].pp $(srcdir)/genhandlerlist.sh - cat $< | sh $(srcdir)/genhandlerlist.sh [+ name +] > $@ || (rm -f $@; exit 1) - -terminal-[+ name +].lst: [+ name +].pp $(srcdir)/genterminallist.sh - cat $< | sh $(srcdir)/genterminallist.sh [+ name +] > $@ || (rm -f $@; exit 1) """ return r diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index 773803544..33f5db46e 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -256,56 +256,87 @@ grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES) CLEANFILES += grub_emu_init.c endif -# .lst files -platform_DATA += moddep.lst -platform_DATA += fs.lst -platform_DATA += command.lst -platform_DATA += partmap.lst -platform_DATA += handler.lst -platform_DATA += terminal.lst -platform_DATA += parttool.lst -platform_DATA += video.lst -platform_DATA += crypto.lst -CLEANFILES += moddep.lst -CLEANFILES += handler.lst -CLEANFILES += terminal.lst -CLEANFILES += parttool.lst -CLEANFILES += video.lst -CLEANFILES += crypto.lst +# List files -fs.lst: $(FS_FILES) - cat $^ /dev/null | sort | uniq > $@ +fs.lst: $(PP_FILES) + (for pp in $^; do \ + b=`basename $$pp .pp`; \ + if grep -v "^#" $$pp | grep '^ *grub_fs_register' >/dev/null 2>&1; then \ + echo $$b; \ + fi; \ + done) | sort -u > $@ +platform_DATA += fs.lst CLEANFILES += fs.lst -command.lst: $(COMMAND_FILES) - cat $^ /dev/null | sort | uniq > $@ +command.lst: $(PP_FILES) + (for pp in $^; do \ + b=`basename $$pp .pp`; \ + grep -v "^#" $$pp | sed -n \ + -e "/grub_register_command *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" \ + -e "/grub_register_extcmd *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \ + -e "/grub_register_command_p1 *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}"; \ + done) | sort -u > $@ +platform_DATA += command.lst CLEANFILES += command.lst -partmap.lst: $(PARTMAP_FILES) - cat $^ /dev/null | sort | uniq > $@ +partmap.lst: $(PP_FILES) + (for pp in $^; do \ + b=`basename $$pp .pp`; \ + if grep -v "^#" $$pp | grep '^ *grub_partition_map_register' >/dev/null 2>&1; then \ + echo $$b; \ + fi; \ + done) | sort -u > $@ +platform_DATA += partmap.lst CLEANFILES += partmap.lst -handler.lst: $(HANDLER_FILES) - cat $^ /dev/null | sort | uniq > $@ +handler.lst: $(PP_FILES) + (for pp in $^; do \ + b=`basename $$pp .pp`; \ + grep -v "^#" $$pp | sed -n \ + -e "/grub_parser_register *( *\"/{s/.*( *\"\([^\"]*\)\".*/parser.\1: $$b/;p;}"; \ + done) | sort -u > $@ +platform_DATA += handler.lst CLEANFILES += handler.lst -terminal.lst: $(TERMINAL_FILES) - cat $^ /dev/null | sort | uniq > $@ +terminal.lst: $(PP_FILES) + (for pp in $^; do \ + b=`basename $$pp .pp`; \ + grep -v "^#" $$pp | sed -n \ + -e "/grub_term_register_input *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $$b/;p;}" \ + -e "/grub_term_register_output *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $$b/;p;}"; \ + done) | sort -u > $@ +platform_DATA += terminal.lst CLEANFILES += terminal.lst -parttool.lst: $(PARTTOOL_FILES) - cat $^ /dev/null | sort | uniq > $@ +parttool.lst: $(PP_FILES) + (for pp in $^; do \ + b=`basename $$pp .pp`; \ + grep -v "^#" $$pp | sed -n \ + -e "/grub_parttool_register *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}"; \ + done) | sort -u > $@ +platform_DATA += parttool.lst CLEANFILES += parttool.lst -video.lst: $(VIDEO_FILES) - cat $^ /dev/null | sort | uniq > $@ +video.lst: $(PP_FILES) + (for pp in $^; do \ + b=`basename $$pp .pp`; \ + if grep -v "^#" $$pp | grep '^ *grub_video_register' >/dev/null 2>&1; then \ + echo $$b; \ + fi; \ + done) | sort -u > $@ +platform_DATA += video.lst CLEANFILES += video.lst # but, crypto.lst is simply copied crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst cp $^ $@ +platform_DATA += crypto.lst CLEANFILES += crypto.lst +# .lst files +platform_DATA += moddep.lst +CLEANFILES += moddep.lst + # generate global module dependencies list moddep.lst: kernel_syms.lst genmoddep.awk $(DEF_FILES) $(UND_FILES) cat $(DEF_FILES) kernel_syms.lst /dev/null \ diff --git a/grub-core/gencmdlist.sh b/grub-core/gencmdlist.sh deleted file mode 100644 index ed5965f07..000000000 --- a/grub-core/gencmdlist.sh +++ /dev/null @@ -1,22 +0,0 @@ -#! /bin/sh -# -# Copyright (C) 2005,2009 Free Software Foundation, Inc. -# -# This gensymlist.sh is free software; the author -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Read source code from stdin and detect command names. - -module=$1 - -grep -v "^#" | sed -n \ - -e "/grub_register_command *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $module/;p;}" \ - -e "/grub_register_extcmd *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $module/;p;}" \ - -e "/grub_register_command_p1 *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $module/;p;}" - diff --git a/grub-core/genfslist.sh b/grub-core/genfslist.sh deleted file mode 100644 index 6fa7e927d..000000000 --- a/grub-core/genfslist.sh +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh -# -# Copyright (C) 2005,2008 Free Software Foundation, Inc. -# -# This gensymlist.sh is free software; the author -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Read source code from stdin and detect fs names. - -module=$1 - -# Ignore kernel.mod. -if test $module = kernel; then - exit -fi - -# For now, this emits only a module name, if the module registers a filesystem. -if grep -v "^#" | grep '^ *grub_fs_register' >/dev/null 2>&1; then - echo $module -fi diff --git a/grub-core/genhandlerlist.sh b/grub-core/genhandlerlist.sh deleted file mode 100644 index e4cb0d9de..000000000 --- a/grub-core/genhandlerlist.sh +++ /dev/null @@ -1,19 +0,0 @@ -#! /bin/sh -# -# Copyright (C) 2009 Free Software Foundation, Inc. -# -# This script is free software; the author -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Read source code from stdin and detect command names. - -module=$1 - -grep -v "^#" | sed -n \ - -e "/grub_parser_register *( *\"/{s/.*( *\"\([^\"]*\)\".*/parser.\1: $module/;p;}" diff --git a/grub-core/genpartmaplist.sh b/grub-core/genpartmaplist.sh deleted file mode 100644 index fceb0f869..000000000 --- a/grub-core/genpartmaplist.sh +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh -# -# Copyright (C) 2005, 2008 Free Software Foundation, Inc. -# -# This script is free software; the author -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Read source code from stdin and detect partmap names. - -module=$1 - -# Ignore kernel.mod. -if test $module = kernel; then - exit -fi - -# For now, this emits only a module name, if the module registers a partition map. -if grep -v "^#" | grep '^ *grub_partition_map_register' >/dev/null 2>&1; then - echo $module -fi diff --git a/grub-core/genparttoollist.sh b/grub-core/genparttoollist.sh deleted file mode 100644 index 48a0efe55..000000000 --- a/grub-core/genparttoollist.sh +++ /dev/null @@ -1,19 +0,0 @@ -#! /bin/sh -# -# Copyright (C) 2009 Free Software Foundation, Inc. -# -# This gensymlist.sh is free software; the author -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Read source code from stdin and detect parttool names. - -module=$1 - -grep -v "^#" | sed -n \ - -e "/grub_parttool_register *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $module/;p;}" diff --git a/grub-core/genterminallist.sh b/grub-core/genterminallist.sh deleted file mode 100644 index 60f5b9105..000000000 --- a/grub-core/genterminallist.sh +++ /dev/null @@ -1,20 +0,0 @@ -#! /bin/sh -# -# Copyright (C) 2009,2010 Free Software Foundation, Inc. -# -# This script is free software; the author -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Read source code from stdin and detect command names. - -module=$1 - -grep -v "^#" | sed -n \ - -e "/grub_term_register_input *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $module/;p;}" \ - -e "/grub_term_register_output *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $module/;p;}" \ diff --git a/grub-core/genvideolist.sh b/grub-core/genvideolist.sh deleted file mode 100644 index b208fa25c..000000000 --- a/grub-core/genvideolist.sh +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh -# -# Copyright (C) 2005,2008,2009 Free Software Foundation, Inc. -# -# This script is free software; the author -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Read source code from stdin and detect partmap names. - -module=$1 - -# Ignore video.mod. -if test $module = video; then - exit -fi - -# For now, this emits only a module name, if the module registers a partition map. -if grep -v "^#" | grep '^ *grub_video_register' >/dev/null 2>&1; then - echo $module -fi