87 lines
2.6 KiB
Makefile
87 lines
2.6 KiB
Makefile
# -*- makefile -*-
|
|
|
|
COMMON_LDFLAGS += -nostdlib
|
|
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
|
|
|
|
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
|
|
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 commands/boot.c kern/main.c kern/misc.c kern/parser.c \
|
|
kern/partition.c kern/term.c \
|
|
kern/rescue_reader.c kern/rescue_parser.c \
|
|
\
|
|
util/console.c util/grub-emu.c util/misc.c \
|
|
util/hostdisk.c util/getroot.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 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)
|
|
|
|
ifeq ($(target_cpu), i386)
|
|
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)
|
|
|
|
ifeq ($(enable_grub_emu_usb), yes)
|
|
pkglib_MODULES += usb.mod
|
|
usb_mod_SOURCES = disk/usbms.c util/usb.c bus/usb/usb.c \
|
|
commands/usbtest.c
|
|
usb_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
usb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
grub_emu_LDFLAGS += $(LIBUSB)
|
|
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
|
|
|
|
ifeq ($(enable_grub_emu_pci), yes)
|
|
pkglib_MODULES += pci.mod
|
|
pci_mod_SOURCES = util/pci.c commands/lspci.c
|
|
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
grub_emu_LDFLAGS += $(LIBPCIACCESS)
|
|
endif
|
|
|
|
include $(srcdir)/conf/common.mk
|
|
|
|
grub_emu_init.h: genemuinitheader.sh $(pkglib_MODULES)
|
|
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinitheader.sh $(NM) > $@
|
|
DISTCLEANFILES += grub_emu_init.h
|
|
|
|
grub_emu_init.c: genemuinit.sh $(pkglib_MODULES)
|
|
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinit.sh $(NM) > $@
|
|
DISTCLEANFILES += grub_emu_init.c
|
|
|
|
CLEANFILES += grub-emu
|
|
grub-emu: $(pkglib_MODULES) $(pkglib_PROGRAMS)
|
|
$(CC) -o $@ $(pkglib_MODULES) $(pkglib_PROGRAMS) $(grub_emu_LDFLAGS) $(LDFLAGS)
|
|
GRUB_EMU=grub-emu
|
|
|