2009-11-23 15:31:54 +00:00
|
|
|
# -*- makefile -*-
|
|
|
|
|
2010-02-07 01:07:35 +00:00
|
|
|
COMMON_LDFLAGS += -nostdlib
|
2010-02-07 16:39:52 +00:00
|
|
|
COMMON_CFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include) -fno-builtin
|
2010-02-07 01:07:35 +00:00
|
|
|
|
2009-11-23 15:31:54 +00:00
|
|
|
# Used by various components. These rules need to precede them.
|
2009-11-23 15:37:33 +00:00
|
|
|
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
2009-11-23 15:31:54 +00:00
|
|
|
|
|
|
|
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
|
2010-02-07 02:29:59 +00:00
|
|
|
kernel_img_RELOCATABLE = yes
|
|
|
|
pkglib_PROGRAMS = kernel.img
|
|
|
|
kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
|
2009-11-23 15:31:54 +00:00
|
|
|
kern/err.c kern/list.c kern/handler.c \
|
2010-02-07 01:07:35 +00:00
|
|
|
kern/command.c kern/corecmd.c kern/file.c \
|
2009-11-23 15:31:54 +00:00
|
|
|
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
|
2010-01-10 00:47:19 +00:00
|
|
|
kern/partition.c kern/term.c \
|
2009-11-23 15:31:54 +00:00
|
|
|
kern/rescue_reader.c kern/rescue_parser.c \
|
|
|
|
\
|
2010-02-07 01:07:35 +00:00
|
|
|
util/console.c util/grub-emu.c util/misc.c \
|
2009-11-23 15:31:54 +00:00
|
|
|
util/hostdisk.c util/getroot.c \
|
|
|
|
\
|
2010-02-07 16:30:16 +00:00
|
|
|
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
|
2010-02-07 02:29:59 +00:00
|
|
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
2010-02-07 02:43:07 +00:00
|
|
|
TARGET_NO_STRIP = yes
|
2010-02-07 02:48:38 +00:00
|
|
|
TARGET_NO_DYNAMIC_MODULES = yes
|
2010-02-07 01:07:35 +00:00
|
|
|
|
|
|
|
# For reboot.mod.
|
|
|
|
pkglib_MODULES += reboot.mod
|
|
|
|
reboot_mod_SOURCES = commands/reboot.c
|
|
|
|
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
|
|
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
|
|
|
|
# For halt.mod.
|
|
|
|
pkglib_MODULES += halt.mod
|
|
|
|
halt_mod_SOURCES = commands/halt.c
|
|
|
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
|
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
2009-11-23 15:31:54 +00:00
|
|
|
|
|
|
|
ifeq ($(target_cpu), i386)
|
2010-02-07 01:07:35 +00:00
|
|
|
pkglib_MODULES += cpuid.mod
|
|
|
|
cpuid_mod_SOURCES = commands/i386/cpuid.c
|
|
|
|
cpuid_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
|
|
cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
2009-11-23 15:31:54 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
grub_emu_LDFLAGS = $(LIBCURSES)
|
|
|
|
|
|
|
|
ifeq ($(enable_grub_emu_usb), yes)
|
2010-02-07 01:07:35 +00:00
|
|
|
pkglib_MODULES += usb.mod
|
|
|
|
usb_mod_SOURCES = disk/usbms.c util/usb.c bus/usb/usb.c \
|
2009-11-23 15:31:54 +00:00
|
|
|
commands/usbtest.c
|
2010-02-07 02:06:33 +00:00
|
|
|
usb_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
|
|
usb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
grub_emu_LDFLAGS += $(LIBUSB)
|
2009-11-23 15:31:54 +00:00
|
|
|
endif
|
2009-11-24 00:22:41 +00:00
|
|
|
|
|
|
|
ifeq ($(enable_grub_emu_sdl), yes)
|
2010-02-07 02:06:33 +00:00
|
|
|
pkglib_MODULES += sdl.mod
|
|
|
|
sdl_mod_SOURCES = util/sdl.c
|
2010-02-07 16:30:16 +00:00
|
|
|
sdl_mod_CFLAGS =
|
2010-02-07 02:06:33 +00:00
|
|
|
sdl_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
2009-11-24 00:22:41 +00:00
|
|
|
grub_emu_LDFLAGS += $(LIBSDL)
|
2009-11-23 15:31:54 +00:00
|
|
|
endif
|
2009-11-25 14:15:30 +00:00
|
|
|
|
|
|
|
ifeq ($(enable_grub_emu_pci), yes)
|
2010-02-07 01:07:35 +00:00
|
|
|
pkglib_MODULES += pci.mod
|
|
|
|
pci_mod_SOURCES = util/pci.c commands/lspci.c
|
2010-02-07 02:06:33 +00:00
|
|
|
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
2009-11-25 14:15:30 +00:00
|
|
|
grub_emu_LDFLAGS += $(LIBPCIACCESS)
|
|
|
|
endif
|
2009-11-23 15:31:54 +00:00
|
|
|
|
2010-02-07 03:45:54 +00:00
|
|
|
include $(srcdir)/conf/common.mk
|
2009-11-23 15:31:54 +00:00
|
|
|
|
2010-02-07 03:01:22 +00:00
|
|
|
grub_emu_init.h: genemuinitheader.sh $(pkglib_MODULES)
|
2010-02-07 02:58:14 +00:00
|
|
|
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinitheader.sh $(NM) > $@
|
2009-11-23 15:31:54 +00:00
|
|
|
DISTCLEANFILES += grub_emu_init.h
|
|
|
|
|
2010-02-07 02:58:14 +00:00
|
|
|
grub_emu_init.c: genemuinit.sh $(pkglib_MODULES)
|
|
|
|
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinit.sh $(NM) > $@
|
2009-11-23 15:31:54 +00:00
|
|
|
DISTCLEANFILES += grub_emu_init.c
|
|
|
|
|
2010-02-07 03:45:54 +00:00
|
|
|
CLEANFILES += grub-emu
|
2010-02-07 02:29:59 +00:00
|
|
|
grub-emu: $(pkglib_MODULES) $(pkglib_PROGRAMS)
|
|
|
|
$(CC) -o $@ $(pkglib_MODULES) $(pkglib_PROGRAMS) $(grub_emu_LDFLAGS) $(LDFLAGS)
|
2010-02-07 03:45:54 +00:00
|
|
|
GRUB_EMU=grub-emu
|
2009-11-23 15:31:54 +00:00
|
|
|
|