# -*- makefile -*-
- sbin_UTILITIES += grub-emu
+ COMMON_LDFLAGS += -nostdlib
+ COMMON_CFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include) -fno-builtin
+
+# Used by various components. These rules need to precede them.
+script/lexer.c_DEPENDENCIES = grub_script.tab.h grub_script.yy.h
+
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
- grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
- commands/configfile.c commands/echo.c commands/help.c \
- commands/handler.c commands/ls.c commands/test.c \
- commands/search_wrap.c commands/search_file.c \
- commands/search_label.c commands/search_uuid.c \
- commands/blocklist.c commands/hexdump.c \
- lib/hexdump.c commands/halt.c commands/reboot.c \
- lib/envblk.c commands/loadenv.c \
- commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
- commands/password.c commands/keystatus.c \
- disk/host.c disk/loopback.c disk/scsi.c \
- fs/fshelp.c \
- \
- io/gzio.c \
- kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
- kern/err.c kern/list.c kern/handler.c \
- kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
- kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
- kern/partition.c kern/term.c \
+ kernel_img_RELOCATABLE = yes
+ pkglib_PROGRAMS = kernel.img
-kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
- kern/err.c kern/list.c kern/handler.c \
- kern/command.c kern/corecmd.c kern/file.c \
- kern/fs.c kern/main.c kern/misc.c kern/parser.c \
- kern/partition.c kern/term.c \
++kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
++ kern/err.c kern/list.c kern/handler.c kern/command.c \
++ kern/corecmd.c kern/file.c kern/fs.c kern/main.c kern/misc.c \
++ kern/parser.c kern/partition.c kern/term.c \
kern/rescue_reader.c kern/rescue_parser.c \
- lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \
- normal/handler.c normal/auth.c lib/crypto.c normal/autofs.c \
- normal/completion.c normal/main.c normal/color.c \
- normal/menu.c normal/menu_entry.c \
- normal/menu_text.c normal/crypto.c normal/term.c \
- commands/terminal.c normal/context.c lib/charset.c \
- script/main.c script/execute.c script/function.c \
- script/lexer.c script/script.c grub_script.tab.c \
- grub_script.yy.c \
- \
- partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
- partmap/acorn.c partmap/gpt.c \
- \
- fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
- fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
- fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
- fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
- fs/befs.c fs/befs_be.c fs/tar.c \
-- \
- util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
- util/hostdisk.c util/getroot.c \
- util/console.c util/grub-emu.c util/misc.c \
- util/hostdisk.c util/getroot.c util/time.c \
-- \
- disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
- disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
- commands/parttool.c parttool/msdospart.c \
- lib/libgcrypt-grub/cipher/md5.c \
- grub_emu_init.c gnulib/progname.c
- grub_emu_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap
-
++ \
++ util/console.c util/grub-emu.c util/misc.c util/hostdisk.c \
++ util/getroot.c util/time.c \
++ \
+ 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
+
+ # For halt.mod.
+ pkglib_MODULES += halt.mod
+ halt_mod_SOURCES = commands/halt.c
+ halt_mod_CFLAGS = $(COMMON_CFLAGS)
+ halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
ifeq ($(target_cpu), i386)
- grub_emu_SOURCES += commands/i386/cpuid.c
+ pkglib_MODULES += cpuid.mod
+ cpuid_mod_SOURCES = commands/i386/cpuid.c
+ cpuid_mod_CFLAGS = $(COMMON_CFLAGS)
+ cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
endif
grub_emu_LDFLAGS = $(LIBCURSES)
# For grub-script-check.
bin_UTILITIES += grub-script-check
util/grub-script-check.c_DEPENDENCIES = grub_script_check_init.h
- grub_script_check_SOURCES = gnulib/progname.c util/grub-script-check.c util/misc.c \
+ grub_script_check_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c \
+ util/grub-script-check.c util/misc.c \
script/main.c script/script.c script/function.c script/lexer.c \
kern/handler.c kern/err.c kern/parser.c kern/list.c \
- kern/misc.c kern/env.c grub_script_check_init.c grub_script.tab.c
+ kern/misc.c kern/env.c grub_script_check_init.c grub_script.tab.c \
+ grub_script.yy.c
+ MOSTLYCLEANFILES += symlist.c kernel_syms.lst
+ DEFSYMFILES += kernel_syms.lst
+
+ kernel_img_HEADERS += boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
+ env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
+ partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
+ machine/memory.h machine/loader.h machine/kernel.h \
+ list.h handler.h command.h i18n.h env_private.h
+
+ symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
+ /bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
+
+ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
+ /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
+
# For the parser.
grub_script.tab.c grub_script.tab.h: script/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y