use preprocessing-marker technique for creating list files
This commit is contained in:
parent
466b9c3567
commit
6568636e31
3 changed files with 44 additions and 38 deletions
|
@ -83,12 +83,26 @@ CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap
|
||||||
|
|
||||||
CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime
|
CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime
|
||||||
|
|
||||||
|
# List file macros for recognizing /interesting/ modules
|
||||||
|
CPPFLAGS_FS_LIST = -Dgrub_fs_register=FS_LIST_MARKER
|
||||||
|
CPPFLAGS_VIDEO_LIST= -Dgrub_video_register=VIDEO_LIST_MARKER
|
||||||
|
CPPFLAGS_PARTMAP_LIST = -Dgrub_partition_map_register=PARTMAP_LIST_MARKER
|
||||||
|
CPPFLAGS_PARTTOOL_LIST = -Dgrub_parttool_register=PARTTOOL_LIST_MARKER
|
||||||
|
CPPFLAGS_TERMINAL_LIST = '-Dgrub_term_register_input(...)=INPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
|
||||||
|
CPPFLAGS_TERMINAL_LIST += '-Dgrub_term_register_output(...)=OUTPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
|
||||||
|
CPPFLAGS_COMMAND_LIST = '-Dgrub_register_command(...)=COMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||||
|
CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd(...)=EXTCOMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||||
|
CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_p1(...)=P1COMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||||
|
CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \
|
||||||
|
$(CPPFLAGS_PARTTOOL_LIST) $(CPPFLAGS_PARTMAP_LIST) \
|
||||||
|
$(CPPFLAGS_TERMINAL_LIST) $(CPPFLAGS_COMMAND_LIST)
|
||||||
|
|
||||||
# Define these variables to calm down automake
|
# Define these variables to calm down automake
|
||||||
|
|
||||||
PP_FILES =
|
|
||||||
IMG_FILES =
|
IMG_FILES =
|
||||||
MOD_FILES =
|
MOD_FILES =
|
||||||
MODULE_FILES =
|
MODULE_FILES =
|
||||||
|
MARKER_FILES =
|
||||||
KERNEL_HEADER_FILES =
|
KERNEL_HEADER_FILES =
|
||||||
|
|
||||||
man_MANS =
|
man_MANS =
|
||||||
|
|
|
@ -285,11 +285,12 @@ def module(platform):
|
||||||
r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
|
r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
|
||||||
|
|
||||||
r += gvar_add("MOD_FILES", "[+ name +].mod")
|
r += gvar_add("MOD_FILES", "[+ name +].mod")
|
||||||
r += gvar_add("PP_FILES", "[+ name +].pp")
|
r += gvar_add("MARKER_FILES", "[+ name +].marker")
|
||||||
r += gvar_add("CLEANFILES", "[+ name +].pp")
|
r += gvar_add("CLEANFILES", "[+ name +].marker")
|
||||||
r += """
|
r += """
|
||||||
[+ name +].pp: $(""" + cname() + """_SOURCES) $(nodist_""" + cname() + """_SOURCES)
|
[+ name +].marker: $(""" + cname() + """_SOURCES) $(nodist_""" + cname() + """_SOURCES)
|
||||||
$(TARGET_CPP) -DGRUB_LST_GENERATOR $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + cname() + """_CPPFLAGS) $(CPPFLAGS) $^ > $@ || (rm -f $@; exit 1)
|
$(TARGET_CPP) -DGRUB_LST_GENERATOR $(CPPFLAGS_MARKER) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + cname() + """_CPPFLAGS) $(CPPFLAGS) $^ > $@.new || (rm -f $@; exit 1)
|
||||||
|
grep 'MARKER' $@.new > $@; rm -f $@.new
|
||||||
"""
|
"""
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
|
@ -258,69 +258,60 @@ endif
|
||||||
|
|
||||||
# List files
|
# List files
|
||||||
|
|
||||||
fs.lst: $(PP_FILES)
|
fs.lst: $(MARKER_FILES)
|
||||||
(for pp in $^; do \
|
(for pp in $^; do \
|
||||||
b=`basename $$pp .pp`; \
|
b=`basename $$pp .marker`; \
|
||||||
if grep -v "^#" $$pp | grep '^ *grub_fs_register' >/dev/null 2>&1; then \
|
if grep 'FS_LIST_MARKER' $$pp >/dev/null 2>&1; then \
|
||||||
echo $$b; \
|
echo $$b; \
|
||||||
fi; \
|
fi; \
|
||||||
done) | sort -u > $@
|
done) | sort -u > $@
|
||||||
platform_DATA += fs.lst
|
platform_DATA += fs.lst
|
||||||
CLEANFILES += fs.lst
|
CLEANFILES += fs.lst
|
||||||
|
|
||||||
command.lst: $(PP_FILES)
|
command.lst: $(MARKER_FILES)
|
||||||
(for pp in $^; do \
|
(for pp in $^; do \
|
||||||
b=`basename $$pp .pp`; \
|
b=`basename $$pp .marker`; \
|
||||||
grep -v "^#" $$pp | sed -n \
|
sed -n \
|
||||||
-e "/grub_register_command *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" \
|
-e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" \
|
||||||
-e "/grub_register_extcmd *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
|
-e "/EXTCOMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
|
||||||
-e "/grub_register_command_p1 *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}"; \
|
-e "/P1COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" $$pp; \
|
||||||
done) | sort -u > $@
|
done) | sort -u > $@
|
||||||
platform_DATA += command.lst
|
platform_DATA += command.lst
|
||||||
CLEANFILES += command.lst
|
CLEANFILES += command.lst
|
||||||
|
|
||||||
partmap.lst: $(PP_FILES)
|
partmap.lst: $(MARKER_FILES)
|
||||||
(for pp in $^; do \
|
(for pp in $^; do \
|
||||||
b=`basename $$pp .pp`; \
|
b=`basename $$pp .marker`; \
|
||||||
if grep -v "^#" $$pp | grep '^ *grub_partition_map_register' >/dev/null 2>&1; then \
|
if grep 'PARTMAP_LIST_MARKER' $$pp >/dev/null 2>&1; then \
|
||||||
echo $$b; \
|
echo $$b; \
|
||||||
fi; \
|
fi; \
|
||||||
done) | sort -u > $@
|
done) | sort -u > $@
|
||||||
platform_DATA += partmap.lst
|
platform_DATA += partmap.lst
|
||||||
CLEANFILES += partmap.lst
|
CLEANFILES += partmap.lst
|
||||||
|
|
||||||
handler.lst: $(PP_FILES)
|
terminal.lst: $(MARKER_FILES)
|
||||||
(for pp in $^; do \
|
(for pp in $^; do \
|
||||||
b=`basename $$pp .pp`; \
|
b=`basename $$pp .marker`; \
|
||||||
grep -v "^#" $$pp | sed -n \
|
sed -n \
|
||||||
-e "/grub_parser_register *( *\"/{s/.*( *\"\([^\"]*\)\".*/parser.\1: $$b/;p;}"; \
|
-e "/INPUT_TERMINAL_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $$b/;p;}" \
|
||||||
done) | sort -u > $@
|
-e "/OUTPUT_TERMINAL_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $$b/;p;}" $$pp; \
|
||||||
platform_DATA += handler.lst
|
|
||||||
CLEANFILES += handler.lst
|
|
||||||
|
|
||||||
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 > $@
|
done) | sort -u > $@
|
||||||
platform_DATA += terminal.lst
|
platform_DATA += terminal.lst
|
||||||
CLEANFILES += terminal.lst
|
CLEANFILES += terminal.lst
|
||||||
|
|
||||||
parttool.lst: $(PP_FILES)
|
parttool.lst: $(MARKER_FILES)
|
||||||
(for pp in $^; do \
|
(for pp in $^; do \
|
||||||
b=`basename $$pp .pp`; \
|
b=`basename $$pp .marker`; \
|
||||||
grep -v "^#" $$pp | sed -n \
|
sed -n \
|
||||||
-e "/grub_parttool_register *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}"; \
|
-e "/PARTTOOL_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
|
||||||
done) | sort -u > $@
|
done) | sort -u > $@
|
||||||
platform_DATA += parttool.lst
|
platform_DATA += parttool.lst
|
||||||
CLEANFILES += parttool.lst
|
CLEANFILES += parttool.lst
|
||||||
|
|
||||||
video.lst: $(PP_FILES)
|
video.lst: $(MARKER_FILES)
|
||||||
(for pp in $^; do \
|
(for pp in $^; do \
|
||||||
b=`basename $$pp .pp`; \
|
b=`basename $$pp .marker`; \
|
||||||
if grep -v "^#" $$pp | grep '^ *grub_video_register' >/dev/null 2>&1; then \
|
if grep 'VIDEO_LIST_MARKER' $$pp >/dev/null 2>&1; then \
|
||||||
echo $$b; \
|
echo $$b; \
|
||||||
fi; \
|
fi; \
|
||||||
done) | sort -u > $@
|
done) | sort -u > $@
|
||||||
|
|
Loading…
Reference in a new issue