# -*- makefile -*-

pkglib_MODULES += cpuid.mod
cpuid_mod_SOURCES = commands/i386/cpuid.c
cpuid_mod_CFLAGS = $(COMMON_CFLAGS)
cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS)

pkglib_MODULES += at_keyboard.mod
at_keyboard_mod_SOURCES = term/at_keyboard.c
at_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
at_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)

pkglib_MODULES += vga_text.mod
vga_text_mod_SOURCES = term/i386/pc/vga_text.c term/i386/vga_common.c
vga_text_mod_CFLAGS = $(COMMON_CFLAGS)
vga_text_mod_LDFLAGS = $(COMMON_LDFLAGS)

pkglib_MODULES += video_cirrus.mod
video_cirrus_mod_SOURCES = video/cirrus.c
video_cirrus_mod_CFLAGS = $(COMMON_CFLAGS)
video_cirrus_mod_LDFLAGS = $(COMMON_LDFLAGS)

pkglib_MODULES += video_bochs.mod
video_bochs_mod_SOURCES = video/bochs.c
video_bochs_mod_CFLAGS = $(COMMON_CFLAGS)
video_bochs_mod_LDFLAGS = $(COMMON_LDFLAGS)

pkglib_MODULES += relocator.mod
relocator_mod_SOURCES = lib/i386/relocator.c lib/i386/relocator_asm.S lib/i386/relocator_backward.S
relocator_mod_CFLAGS = $(COMMON_CFLAGS)
relocator_mod_ASFLAGS = $(COMMON_ASFLAGS)
relocator_mod_LDFLAGS = $(COMMON_LDFLAGS)

pkglib_MODULES += ata.mod
ata_mod_SOURCES = disk/ata.c
ata_mod_CFLAGS = $(COMMON_CFLAGS)
ata_mod_LDFLAGS = $(COMMON_LDFLAGS)

# For setpci.mod
pkglib_MODULES += setpci.mod
setpci_mod_SOURCES = commands/setpci.c
setpci_mod_CFLAGS = $(COMMON_CFLAGS)
setpci_mod_LDFLAGS = $(COMMON_LDFLAGS)

pkglib_MODULES += multiboot.mod
multiboot_mod_SOURCES = loader/multiboot.c loader/i386/multiboot_mbi.c
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)

pkglib_MODULES += multiboot2.mod
multiboot2_mod_SOURCES = loader/multiboot.c loader/multiboot_mbi2.c
multiboot2_mod_CFLAGS = $(COMMON_CFLAGS) -DGRUB_USE_MULTIBOOT2
multiboot2_mod_LDFLAGS = $(COMMON_LDFLAGS)
multiboot2_mod_ASFLAGS = $(COMMON_ASFLAGS)

# For serial.mod.
pkglib_MODULES += serial.mod
serial_mod_SOURCES = term/serial.c term/ns8250.c
serial_mod_CFLAGS = $(COMMON_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)

# On qemu it's compiled in
ifneq ($(platform), qemu)
# For pci.mod
pkglib_MODULES += pci.mod
pci_mod_SOURCES = bus/pci.c
pci_mod_CFLAGS = $(COMMON_CFLAGS)
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
endif

# For cs5536.mod
pkglib_MODULES += cs5536.mod
cs5536_mod_SOURCES = bus/cs5536.c
cs5536_mod_CFLAGS = $(COMMON_CFLAGS)
cs5536_mod_LDFLAGS = $(COMMON_LDFLAGS)

# For lspci.mod
pkglib_MODULES += lspci.mod
lspci_mod_SOURCES = commands/lspci.c
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)

# For play.mod.
pkglib_MODULES += play.mod
play_mod_SOURCES = commands/i386/pc/play.c
play_mod_CFLAGS = $(COMMON_CFLAGS)
play_mod_LDFLAGS = $(COMMON_LDFLAGS)

# For iorw.mod.
pkglib_MODULES += iorw.mod
iorw_mod_SOURCES = commands/iorw.c
iorw_mod_CFLAGS = $(COMMON_CFLAGS)
iorw_mod_LDFLAGS = $(COMMON_LDFLAGS)
