104 lines
3 KiB
Makefile
104 lines
3 KiB
Makefile
# -*- makefile -*-
|
|
|
|
COMMON_LDFLAGS += -nostdlib
|
|
COMMON_CFLAGS +=
|
|
|
|
# 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
|
|
kernel_img_CFLAGS = $(CPPFLAGS) $(CFLAGS)
|
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
|
TARGET_NO_STRIP = yes
|
|
TARGET_NO_DYNAMIC_MODULES = yes
|
|
|
|
# progname.c always has warnings. Compile it separately.
|
|
pkglib_MODULES += progname.mod
|
|
progname_mod_SOURCES = gnulib/progname.c
|
|
progname_mod_CFLAGS = $(COMMON_CFLAGS) -Wno-error
|
|
progname_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For hostfs.mod.
|
|
pkglib_MODULES += hostfs.mod
|
|
hostfs_mod_SOURCES = util/hostfs.c
|
|
hostfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
hostfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For host.mod.
|
|
pkglib_MODULES += host.mod
|
|
host_mod_SOURCES = disk/host.c
|
|
host_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
host_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# 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_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
|
|
|