011fe8
From 85cc4b1abfed85fd8504da4acc391d5936de2812 Mon Sep 17 00:00:00 2001
78a3d7
From: Andrey Borzenkov <arvidjaar@gmail.com>
78a3d7
Date: Sat, 18 Jan 2014 23:15:40 +0400
58fe9a
Subject: [PATCH 034/152] use MODULE_FILES for genemuinit* instead of MOD_FILES
78a3d7
78a3d7
MinGW native nm does not support ELF binaries.
78a3d7
---
78a3d7
 ChangeLog                     | 8 ++++++++
78a3d7
 grub-core/Makefile.am         | 8 ++++----
78a3d7
 grub-core/genemuinit.sh       | 4 ++--
78a3d7
 grub-core/genemuinitheader.sh | 4 ++--
78a3d7
 4 files changed, 16 insertions(+), 8 deletions(-)
78a3d7
78a3d7
diff --git a/ChangeLog b/ChangeLog
011fe8
index 9360345..4688ff4 100644
78a3d7
--- a/ChangeLog
78a3d7
+++ b/ChangeLog
78a3d7
@@ -1,3 +1,11 @@
78a3d7
+2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
78a3d7
+
78a3d7
+	* grub-core/Makefile.am: Build grub_emu_init.[ch] from MODULE_FILES
78a3d7
+	instead of MOD_FILES.
78a3d7
+	* grub-core/genemuinit.sh: Simplify stripping of suffix so it works
78a3d7
+	both with and without .exe.
78a3d7
+	* grub-core/genemuinitheader.sh: Same.
78a3d7
+
78a3d7
 2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
78a3d7
 
78a3d7
 	* util/grub-install.c: Fix a typo.
78a3d7
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
78a3d7
index 826b3dd..5c087c8 100644
78a3d7
--- a/grub-core/Makefile.am
78a3d7
+++ b/grub-core/Makefile.am
78a3d7
@@ -294,12 +294,12 @@ grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
78a3d7
 kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
78a3d7
 grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
78a3d7
 
78a3d7
-grub_emu_init.h: genemuinitheader.sh $(MOD_FILES)
78a3d7
-	rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
78a3d7
+grub_emu_init.h: genemuinitheader.sh $(MODULE_FILES)
78a3d7
+	rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
78a3d7
 CLEANFILES += grub_emu_init.h
78a3d7
 
78a3d7
-grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES)
78a3d7
-	rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
78a3d7
+grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MODULE_FILES)
78a3d7
+	rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
78a3d7
 CLEANFILES += grub_emu_init.c
78a3d7
 endif
78a3d7
 
78a3d7
diff --git a/grub-core/genemuinit.sh b/grub-core/genemuinit.sh
78a3d7
index 45c15ec..8c6bb1c 100644
78a3d7
--- a/grub-core/genemuinit.sh
78a3d7
+++ b/grub-core/genemuinit.sh
78a3d7
@@ -47,7 +47,7 @@ EOF
78a3d7
 read mods
78a3d7
 for line in $mods; do
78a3d7
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
78a3d7
-      echo "grub_${line}_init ();" | sed 's,\.mod,,g;'
78a3d7
+      echo "grub_${line%%.*}_init ();"
78a3d7
   fi
78a3d7
 done
78a3d7
 
78a3d7
@@ -63,7 +63,7 @@ EOF
78a3d7
 
78a3d7
 for line in $mods; do
78a3d7
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
78a3d7
-      echo "grub_${line}_fini ();" | sed 's,\.mod,,g;'
78a3d7
+      echo "grub_${line%%.*}_fini ();"
78a3d7
   fi
78a3d7
 done
78a3d7
 
78a3d7
diff --git a/grub-core/genemuinitheader.sh b/grub-core/genemuinitheader.sh
78a3d7
index 6b83f59..a99a15d 100644
78a3d7
--- a/grub-core/genemuinitheader.sh
78a3d7
+++ b/grub-core/genemuinitheader.sh
78a3d7
@@ -44,9 +44,9 @@ EOF
78a3d7
 read mods
78a3d7
 for line in $mods; do
78a3d7
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
78a3d7
-      echo "void grub_${line}_init (void);" | sed 's,\.mod,,g;'
78a3d7
+      echo "void grub_${line%%.*}_init (void);"
78a3d7
   fi
78a3d7
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
78a3d7
-      echo "void grub_${line}_fini (void);" | sed 's,\.mod,,g;'
78a3d7
+      echo "void grub_${line%%.*}_fini (void);"
78a3d7
   fi
78a3d7
 done
78a3d7
-- 
37b39b
1.9.3
78a3d7