]> git.proxmox.com Git - grub2.git/blobdiff - gensymlist.sh.in
* Backport from upstream:
[grub2.git] / gensymlist.sh.in
index 588a1836e778f542a8f1801e400dfd95e7d649ae..3c3ddfa6c11bdfce3388c42bd2ddf070596fc476 100644 (file)
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-# Copyright (C) 2002,2006  Free Software Foundation, Inc.
+# Copyright (C) 2002,2006,2007,2008  Free Software Foundation, Inc.
 #
 # This gensymlist.sh.in is free software; the author
 # gives unlimited permission to copy and/or distribute it,
 
 ### The configure script will replace these variables.
 
-srcdir=@srcdir@
-CC=@CC@
+: ${srcdir=@srcdir@}
+: ${CC=@TARGET_CC@}
 
 
 cat <<EOF
 /* This file is automatically generated by gensymlist.sh. DO NOT EDIT! */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002,2006  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2006,2007,2008  Free Software Foundation, Inc.
  *
- *  GRUB is free software; you can redistribute it and/or modify
+ *  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 2 of the License, or
+ *  the Free Software Foundation, either version 3 of the License, or
  *  (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
+ *  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, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <grub/symbol.h>
 EOF
 
 for i in $*; do
@@ -46,6 +46,8 @@ done
 
 cat <<EOF
 
+#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
+
 void
 grub_register_exported_symbols (void)
 {
@@ -58,7 +60,7 @@ cat <<EOF
     {
 EOF
 
-$CC -DGRUB_SYMBOL_GENERATOR=1 -E -I. -Iinclude -I$srcdir/include $* \
+$CC @TARGET_CFLAGS@ -DGRUB_SYMBOL_GENERATOR=1 -E -I. -Iinclude -I"$srcdir/include" $* \
   | grep -v '^#' \
   | sed -n \
         -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/      {"\1", \1},/;p;}' \
@@ -69,6 +71,7 @@ cat <<EOF
       {0, 0}
     };
 
+  COMPILE_TIME_ASSERT (sizeof (tab) > sizeof (tab[0]));
   for (p = tab; p->name; p++)
     grub_dl_register_symbol (p->name, p->addr, 0);
 }