Skip to content

Commit 6744840

Browse files
osteffenrhDaniel Kiper
authored andcommitted
build: Track explicit module dependencies in Makefile.core.def
Add a new keyword, "depends", to the module definition syntax used in Makefile.core.def. This allows specifying explicit module dependencies together with the module definition. Do not track the "extra_deps.lst" file in the repository anymore, it is now auto-generated. Make use of this new keyword in the bli module definition. Signed-off-by: Oliver Steffen <[email protected]> Reviewed-by: Daniel Kiper <[email protected]>
1 parent 8719cc2 commit 6744840

File tree

7 files changed

+16
-6
lines changed

7 files changed

+16
-6
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
*.img
1212
*.log
1313
*.lst
14-
!/grub-core/extra_deps.lst
1514
*.marker
1615
*.mod
1716
*.o

conf/Makefile.common

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ MOD_FILES =
111111
MODULE_FILES =
112112
MARKER_FILES =
113113
KERNEL_HEADER_FILES =
114+
EXTRA_DEPS =
114115

115116
bin_SCRIPTS =
116117
bin_PROGRAMS =

gentpl.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,9 @@ def platform_values(defn, platform, suffix):
631631
def extra_dist(defn):
632632
return foreach_value(defn, "extra_dist", lambda value: value + " ")
633633

634+
def extra_dep(defn):
635+
return foreach_value(defn, "depends", lambda value: value + " ")
636+
634637
def platform_sources(defn, p): return platform_values(defn, p, "")
635638
def platform_nodist_sources(defn, p): return platform_values(defn, p, "_nodist")
636639

@@ -699,6 +702,10 @@ def module(defn, platform):
699702
gvar_add("MOD_FILES", name + ".mod")
700703
gvar_add("MARKER_FILES", name + ".marker")
701704
gvar_add("CLEANFILES", name + ".marker")
705+
706+
for dep in defn.find_all("depends"):
707+
gvar_add("EXTRA_DEPS", "depends " + name + " " + dep + ":")
708+
702709
output("""
703710
""" + name + """.marker: $(""" + cname(defn) + """_SOURCES) $(nodist_""" + cname(defn) + """_SOURCES)
704711
$(TARGET_CPP) -DGRUB_LST_GENERATOR $(CPPFLAGS_MARKER) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + cname(defn) + """_CPPFLAGS) $(CPPFLAGS) $^ > [email protected] || (rm -f $@; exit 1)

grub-core/Makefile.am

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,11 @@ crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst
454454
platform_DATA += crypto.lst
455455
CLEANFILES += crypto.lst
456456

457-
syminfo.lst: gensyminfo.sh kernel_syms.lst $(top_srcdir)/grub-core/extra_deps.lst $(MODULE_FILES)
458-
cat kernel_syms.lst $(top_srcdir)/grub-core/extra_deps.lst > $@.new
457+
extra_deps.lst:
458+
@echo $(EXTRA_DEPS) | sed "s/\s*:\s*/\n/g" > $@
459+
460+
syminfo.lst: gensyminfo.sh kernel_syms.lst extra_deps.lst $(MODULE_FILES)
461+
cat kernel_syms.lst extra_deps.lst > $@.new
459462
for m in $(MODULE_FILES); do \
460463
sh $< $$m >> $@.new || exit 1; \
461464
done
@@ -465,7 +468,7 @@ syminfo.lst: gensyminfo.sh kernel_syms.lst $(top_srcdir)/grub-core/extra_deps.ls
465468
moddep.lst: syminfo.lst genmoddep.awk video.lst
466469
cat $< | sort | $(AWK) -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; exit 1)
467470
platform_DATA += moddep.lst
468-
CLEANFILES += config.log syminfo.lst moddep.lst
471+
CLEANFILES += config.log syminfo.lst moddep.lst extra_deps.lst
469472

470473
$(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT) build-grub-module-verifier$(BUILD_EXEEXT)
471474
TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@

grub-core/Makefile.core.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2598,4 +2598,5 @@ module = {
25982598
name = bli;
25992599
efi = commands/bli.c;
26002600
enable = efi;
2601+
depends = part_gpt;
26012602
};

grub-core/extra_deps.lst

Lines changed: 0 additions & 1 deletion
This file was deleted.

grub-core/genmoddep.awk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ BEGIN {
3535
for (i = 3; i <= NF; i++) {
3636
modtab[$2] = modtab[$2] " " $i;
3737
}
38-
}
38+
} else if ($1 == "") {} #Skip empty lines
3939
else {
4040
printf "error: %u: unrecognized input format\n", NR >"/dev/stderr";
4141
error++;

0 commit comments

Comments
 (0)