2009-11-23 15:31:54 +00:00
|
|
|
# -*- makefile -*-
|
|
|
|
|
2010-05-26 04:26:59 +00:00
|
|
|
ifeq ($(target_cpu), sparc64)
|
2010-05-26 11:23:43 +00:00
|
|
|
COMMON_CFLAGS += -mno-app-regs
|
2010-05-26 04:26:59 +00:00
|
|
|
COMMON_LDFLAGS += -mno-relax
|
|
|
|
endif
|
2009-11-23 15:31:54 +00:00
|
|
|
|
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 \
|
|
|
|
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 \
|
2009-11-23 15:31:54 +00:00
|
|
|
kern/rescue_reader.c kern/rescue_parser.c \
|
2010-04-27 08:27:14 +00:00
|
|
|
\
|
2010-04-27 15:25:12 +00:00
|
|
|
kern/emu/main.c kern/emu/mm.c kern/emu/misc.c \
|
|
|
|
kern/emu/getroot.c kern/emu/time.c kern/emu/hostdisk.c \
|
|
|
|
kern/emu/hostfs.c kern/emu/console.c \
|
2010-04-27 08:27:14 +00:00
|
|
|
\
|
2010-04-27 05:20:28 +00:00
|
|
|
gnulib/progname.c disk/host.c
|
|
|
|
kernel_img_HEADERS += datetime.h emu/misc.h
|
2010-05-06 03:15:39 +00:00
|
|
|
kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-char-subscripts -Wno-unused -Wno-deprecated-declarations -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 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)
|
2010-05-26 04:26:59 +00:00
|
|
|
ifeq ($(target_cpu), sparc64)
|
2010-05-26 11:23:43 +00:00
|
|
|
grub_emu_LDFLAGS += -m64 -melf64_sparc -mno-relax
|
2010-05-26 04:26:59 +00:00
|
|
|
endif
|
2009-11-23 15:31:54 +00:00
|
|
|
|
|
|
|
ifeq ($(enable_grub_emu_usb), yes)
|
2010-04-09 23:56:51 +00:00
|
|
|
kernel_img_HEADERS += libusb.h
|
|
|
|
|
2010-02-09 20:16:17 +00:00
|
|
|
pkglib_MODULES += libusb.mod
|
2010-04-27 05:20:28 +00:00
|
|
|
libusb_mod_SOURCES = bus/usb/emu/usb.c
|
2010-02-09 20:16:17 +00:00
|
|
|
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
|
2010-04-27 05:20:28 +00:00
|
|
|
sdl_mod_SOURCES = video/emu/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)
|
2010-02-07 14:17:26 +00:00
|
|
|
kernel_img_HEADERS += sdl.h
|
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
|
2010-04-27 08:27:14 +00:00
|
|
|
pci_mod_SOURCES = bus/emu/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)
|
2010-04-19 09:45:59 +00:00
|
|
|
kernel_img_HEADERS += libpciaccess.h
|
2009-11-25 14:15:30 +00:00
|
|
|
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 16:52:11 +00:00
|
|
|
grub_emu_init.c: genemuinit.sh $(pkglib_MODULES) grub_emu_init.h
|
2010-02-07 02:58:14 +00:00
|
|
|
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinit.sh $(NM) > $@
|
2009-11-23 15:31:54 +00:00
|
|
|
DISTCLEANFILES += grub_emu_init.c
|
|
|
|
|
2010-05-04 04:17:48 +00:00
|
|
|
grub_emu_init.o: grub_emu_init.c grub_emu_init.h
|
|
|
|
rm -f $@; $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"grub_init.c\" -c -o $@ $<
|
|
|
|
CLEANFILES += grub_emu_init.o
|
|
|
|
|
2010-05-28 00:04:31 +00:00
|
|
|
kern_emu_lite.o: kern/emu/lite.c
|
|
|
|
$(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"kern/emu/lite.c\" -c -o $@ $<
|
|
|
|
CLEANFILES += kern_emu_lite.o
|
|
|
|
|
|
|
|
kern_emu_full.o: kern/emu/full.c
|
|
|
|
$(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"kern/emu/full.c\" -c -o $@ $<
|
|
|
|
CLEANFILES += kern_emu_full.o
|
|
|
|
|
|
|
|
kern_emu_cache.o: kern/emu/cache.S
|
|
|
|
$(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(TARGET_ASFLAGS) -DGRUB_FILE=\"kern/emu/cache.S\" -c -o $@ $<
|
|
|
|
CLEANFILES += kern_emu_cache.o
|
|
|
|
|
|
|
|
symlist.o: symlist.c
|
|
|
|
$(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"symlist.c\" -c -o $@ $<
|
|
|
|
CLEANFILES += symlist.o
|
|
|
|
|
2010-05-04 04:17:48 +00:00
|
|
|
CLEANFILES += grub-emu-lite
|
2010-05-28 00:04:31 +00:00
|
|
|
grub-emu-lite: kern_emu_lite.o kern_emu_cache.o symlist.o kernel.img
|
2010-04-27 08:27:14 +00:00
|
|
|
$(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS)
|
2010-05-04 04:17:48 +00:00
|
|
|
GRUB_EMU_LITE=grub-emu-lite
|
|
|
|
|
|
|
|
CLEANFILES += grub-emu
|
2010-05-28 00:04:31 +00:00
|
|
|
grub-emu: $(PREMODFILES) kern_emu_full.o grub_emu_init.o kernel.img
|
2010-04-27 05:20:28 +00:00
|
|
|
$(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS)
|
2010-02-07 03:45:54 +00:00
|
|
|
GRUB_EMU=grub-emu
|