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
|
|
|
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
|
2010-03-14 16:50:55 +00:00
|
|
|
kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
|
2010-03-26 23:19:42 +00:00
|
|
|
kern/err.c kern/list.c kern/command.c \
|
2010-03-14 16:50:55 +00:00
|
|
|
kern/corecmd.c kern/file.c kern/fs.c kern/main.c kern/misc.c \
|
|
|
|
kern/parser.c kern/partition.c kern/term.c \
|
2009-11-23 15:31:54 +00:00
|
|
|
kern/rescue_reader.c kern/rescue_parser.c \
|
2010-03-14 16:50:55 +00:00
|
|
|
\
|
|
|
|
util/console.c util/grub-emu.c util/misc.c util/hostdisk.c \
|
|
|
|
util/getroot.c util/time.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 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-09 20:16:17 +00:00
|
|
|
pkglib_MODULES += libusb.mod
|
|
|
|
libusb_mod_SOURCES = util/usb.c
|
|
|
|
libusb_mod_CFLAGS =
|
|
|
|
libusb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
|
|
|
|
# For usb.mod
|
2010-02-07 01:07:35 +00:00
|
|
|
pkglib_MODULES += usb.mod
|
2010-02-09 20:16:17 +00:00
|
|
|
usb_mod_SOURCES = bus/usb/usb.c
|
2010-02-07 02:06:33 +00:00
|
|
|
usb_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
|
|
usb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
2010-02-09 20:16:17 +00:00
|
|
|
|
|
|
|
# For usbtest.mod
|
|
|
|
pkglib_MODULES += usbtest.mod
|
|
|
|
usbtest_mod_SOURCES = commands/usbtest.c
|
|
|
|
usbtest_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
|
|
usbtest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
|
|
|
|
# For usbms.mod
|
|
|
|
pkglib_MODULES += usbms.mod
|
|
|
|
usbms_mod_SOURCES = disk/usbms.c
|
|
|
|
usbms_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
|
|
usbms_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
|
2010-02-07 02:06:33 +00:00
|
|
|
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
|
|
|
|