]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Use nostdinc
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 7 Feb 2010 16:30:16 +0000 (17:30 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 7 Feb 2010 16:30:16 +0000 (17:30 +0100)
conf/any-emu.rmk
util/grub-emu.c
util/hostdisk.c

index 529174bc3142a0e8292f095f90acf3fb647a99e2..d3d2c2f2f5aeb71c08deca232afd480e5023f583 100644 (file)
@@ -1,7 +1,7 @@
 # -*- makefile -*-
 
 COMMON_LDFLAGS += -nostdlib
-COMMON_CFLAGS +=
+COMMON_CFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include)
 
 # Used by various components.  These rules need to precede them.
 script/lexer.c_DEPENDENCIES = grub_script.tab.h
@@ -19,30 +19,12 @@ kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c  kern/env.c        \
        util/console.c  util/grub-emu.c util/misc.c                     \
        util/hostdisk.c util/getroot.c                                  \
        \
-       grub_emu_init.c
-kernel_img_CFLAGS = $(CPPFLAGS) $(CFLAGS)
+       grub_emu_init.c gnulib/progname.c util/hostfs.c disk/host.c
+kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-undef -I$(srcdir)/gnulib
 kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
 TARGET_NO_STRIP = yes
 TARGET_NO_DYNAMIC_MODULES = yes
 
-# progname.c always has warnings. Compile it separately.
-pkglib_MODULES += progname.mod
-progname_mod_SOURCES = gnulib/progname.c
-progname_mod_CFLAGS = $(COMMON_CFLAGS) -Wno-error
-progname_mod_LDFLAGS = $(COMMON_LDFLAGS)
-
-# For hostfs.mod.
-pkglib_MODULES += hostfs.mod
-hostfs_mod_SOURCES = util/hostfs.c
-hostfs_mod_CFLAGS = $(COMMON_CFLAGS)
-hostfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
-
-# For host.mod.
-pkglib_MODULES += host.mod
-host_mod_SOURCES = disk/host.c
-host_mod_CFLAGS = $(COMMON_CFLAGS)
-host_mod_LDFLAGS = $(COMMON_LDFLAGS)
-
 # For reboot.mod.
 pkglib_MODULES += reboot.mod
 reboot_mod_SOURCES = commands/reboot.c
@@ -76,6 +58,7 @@ endif
 ifeq ($(enable_grub_emu_sdl), yes)
 pkglib_MODULES += sdl.mod
 sdl_mod_SOURCES = util/sdl.c
+sdl_mod_CFLAGS = 
 sdl_mod_LDFLAGS = $(COMMON_LDFLAGS)
 grub_emu_LDFLAGS += $(LIBSDL)
 endif
index 08ae19836c092c7f32246d4c2a66c4b23531cc5f..7d4544509a36d6030e26fa9d0a780ff57bd1eb78 100644 (file)
@@ -146,6 +146,11 @@ usage (int status)
 }
 \f
 
+void grub_hostfs_init (void);
+void grub_hostfs_fini (void);
+void grub_host_init (void);
+void grub_host_fini (void);
+
 int
 main (int argc, char *argv[])
 {
@@ -204,6 +209,8 @@ main (int argc, char *argv[])
 
   signal (SIGINT, SIG_IGN);
   grub_console_init ();
+  grub_host_init ();
+  grub_hostfs_init ();
 
   /* XXX: This is a bit unportable.  */
   grub_util_biosdisk_init (dev_map);
@@ -236,6 +243,8 @@ main (int argc, char *argv[])
     grub_main ();
 
   grub_fini_all ();
+  grub_hostfs_fini ();
+  grub_host_fini ();
 
   grub_machine_fini ();
 
index 98d3d53aebfc8876d77fe3379f7c239e020def54..be5d05afcca5c024ac8a588aa703c25d66379f1c 100644 (file)
@@ -168,7 +168,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
 
   drive = find_grub_drive (name);
   if (drive < 0)
-    return grub_error (GRUB_ERR_BAD_DEVICE,
+    return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
                       "no mapping exists for `%s'", name);
 
   disk->has_partitions = 1;
@@ -198,7 +198,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
 
     fd = open (map[drive].device, O_RDONLY);
     if (fd == -1)
-      return grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s' while attempting to get disk size", map[drive].device);
+      return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot open `%s' while attempting to get disk size", map[drive].device);
 
 # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__)
     if (fstat (fd, &st) < 0 || ! S_ISCHR (st.st_mode))
@@ -244,7 +244,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
 # warning "No special routine to get the size of a block device is implemented for your OS. This is not possibly fatal."
 #endif
   if (stat (map[drive].device, &st) < 0)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "cannot stat `%s'", map[drive].device);
+    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot stat `%s'", map[drive].device);
 
   disk->total_sectors = st.st_size >> GRUB_DISK_SECTOR_BITS;