3 COMMON_ASFLAGS = -nostdinc -fno-builtin -m32
4 COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
5 COMMON_LDFLAGS = -m32 -nostdlib
7 # Used by various components. These rules need to precede them.
8 script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
12 GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
14 ifeq ($(platform), coreboot)
16 pkglib_PROGRAMS += kernel.img
17 kernel_img_SOURCES = kern/i386/coreboot/startup.S \
19 kern/i386/coreboot/init.c \
20 kern/i386/multiboot_mmap.c \
21 kern/main.c kern/device.c \
22 kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
23 kern/misc.c kern/mm.c kern/reader.c kern/term.c \
24 kern/rescue_parser.c kern/rescue_reader.c \
25 kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
26 kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
27 kern/i386/tsc.c kern/i386/pit.c \
28 kern/generic/rtc_get_time_ms.c \
29 kern/generic/millisleep.c \
31 term/i386/pc/vga_text.c term/i386/vga_common.c \
33 kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
34 env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
35 partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
36 machine/boot.h machine/console.h machine/init.h \
37 machine/memory.h machine/loader.h list.h handler.h command.h
38 kernel_img_CFLAGS = $(COMMON_CFLAGS)
39 kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
40 kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
44 ifeq ($(platform), qemu)
46 GRUB_BOOT_MACHINE_LINK_ADDR = 0xffe00
48 pkglib_IMAGES += boot.img
49 boot_img_SOURCES = boot/i386/qemu/boot.S
50 boot_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
51 boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LINK_ADDR)
52 boot_img_FORMAT = binary
54 bin_UTILITIES += grub-mkimage
55 grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
57 grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
59 pkglib_IMAGES += kernel.img
60 kernel_img_SOURCES = kern/i386/qemu/startup.S \
62 kern/i386/coreboot/init.c \
63 kern/i386/qemu/mmap.c \
64 kern/main.c kern/device.c \
65 kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
66 kern/misc.c kern/mm.c kern/reader.c kern/term.c \
67 kern/rescue_parser.c kern/rescue_reader.c \
68 kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
69 kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
70 kern/i386/tsc.c kern/i386/pit.c \
71 kern/generic/rtc_get_time_ms.c \
72 kern/generic/millisleep.c \
74 term/i386/pc/vga_text.c term/i386/vga_common.c \
76 kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
77 env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
78 partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
79 machine/boot.h machine/console.h machine/init.h \
80 machine/memory.h machine/loader.h list.h handler.h command.h
81 kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
82 kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
83 kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
84 kernel_img_FORMAT = binary
87 MOSTLYCLEANFILES += symlist.c kernel_syms.lst
88 DEFSYMFILES += kernel_syms.lst
90 symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
91 /bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
93 kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
94 /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
97 sbin_UTILITIES = grub-mkdevicemap
98 ifeq ($(enable_grub_emu), yes)
99 sbin_UTILITIES += grub-emu
102 # For grub-mkdevicemap.
103 grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
104 util/devicemap.c util/misc.c
107 util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
108 grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
109 commands/configfile.c commands/echo.c commands/help.c \
110 commands/handler.c commands/ls.c commands/test.c \
111 commands/search.c commands/blocklist.c commands/hexdump.c \
112 commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
113 commands/password.c commands/keystatus.c \
114 lib/hexdump.c commands/i386/cpuid.c \
115 lib/envblk.c commands/loadenv.c \
116 disk/host.c disk/loopback.c \
118 fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
119 fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
120 fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
121 fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
122 fs/befs.c fs/befs_be.c fs/tar.c \
126 kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
127 kern/err.c kern/list.c kern/handler.c \
128 kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
129 kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
130 kern/partition.c kern/reader.c kern/term.c \
131 kern/rescue_reader.c kern/rescue_parser.c \
132 lib/arg.c normal/cmdline.c normal/misc.c \
133 normal/handler.c normal/auth.c normal/autofs.c \
134 normal/completion.c normal/datetime.c normal/main.c \
136 normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
138 script/sh/main.c script/sh/execute.c script/sh/function.c \
139 script/sh/lexer.c script/sh/script.c grub_script.tab.c \
140 partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
141 partmap/acorn.c partmap/gpt.c \
142 util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
143 util/hostdisk.c util/getroot.c \
145 disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
146 disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
147 commands/parttool.c parttool/msdospart.c \
150 grub_emu_LDFLAGS = $(LIBCURSES)
152 sbin_SCRIPTS += grub-install
153 grub_install_SOURCES = util/i386/pc/grub-install.in
156 pkglib_MODULES = linux.mod multiboot.mod \
157 aout.mod play.mod serial.mod ata.mod \
158 memdisk.mod pci.mod lspci.mod reboot.mod \
159 halt.mod datetime.mod date.mod datehook.mod \
163 pkglib_MODULES += boot.mod
164 boot_mod_SOURCES = commands/boot.c
165 boot_mod_CFLAGS = $(COMMON_CFLAGS)
166 boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
169 mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
170 mmap_mod_CFLAGS = $(COMMON_CFLAGS)
171 mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
172 mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
175 linux_mod_SOURCES = loader/i386/linux.c
176 linux_mod_CFLAGS = $(COMMON_CFLAGS)
177 linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
180 reboot_mod_SOURCES = commands/reboot.c kern/i386/reboot.c
181 reboot_mod_CFLAGS = $(COMMON_CFLAGS)
182 reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
185 halt_mod_SOURCES = commands/halt.c kern/i386/halt.c
186 halt_mod_CFLAGS = $(COMMON_CFLAGS)
187 halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
190 serial_mod_SOURCES = term/i386/pc/serial.c
191 serial_mod_CFLAGS = $(COMMON_CFLAGS)
192 serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
195 multiboot_mod_SOURCES = loader/i386/multiboot.c \
196 loader/i386/multiboot_helper.S \
197 loader/i386/pc/multiboot2.c \
198 loader/multiboot2.c \
199 loader/multiboot_loader.c
200 multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
201 multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
202 multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
205 aout_mod_SOURCES = loader/aout.c
206 aout_mod_CFLAGS = $(COMMON_CFLAGS)
207 aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
210 pkglib_MODULES += bsd.mod
211 bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c loader/i386/bsd_helper.S loader/i386/bsd_trampoline.S
212 bsd_mod_CFLAGS = $(COMMON_CFLAGS)
213 bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
214 bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
217 play_mod_SOURCES = commands/i386/pc/play.c
218 play_mod_CFLAGS = $(COMMON_CFLAGS)
219 play_mod_LDFLAGS = $(COMMON_LDFLAGS)
222 ata_mod_SOURCES = disk/ata.c
223 ata_mod_CFLAGS = $(COMMON_CFLAGS)
224 ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
227 memdisk_mod_SOURCES = disk/memdisk.c
228 memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
229 memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
232 pci_mod_SOURCES = bus/pci.c
233 pci_mod_CFLAGS = $(COMMON_CFLAGS)
234 pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
237 lspci_mod_SOURCES = commands/lspci.c
238 lspci_mod_CFLAGS = $(COMMON_CFLAGS)
239 lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
242 datetime_mod_SOURCES = lib/i386/datetime.c
243 datetime_mod_CFLAGS = $(COMMON_CFLAGS)
244 datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
247 date_mod_SOURCES = commands/date.c
248 date_mod_CFLAGS = $(COMMON_CFLAGS)
249 date_mod_LDFLAGS = $(COMMON_LDFLAGS)
252 datehook_mod_SOURCES = hook/datehook.c
253 datehook_mod_CFLAGS = $(COMMON_CFLAGS)
254 datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
257 lsmmap_mod_SOURCES = commands/lsmmap.c
258 lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
259 lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
261 include $(srcdir)/conf/i386.mk
262 include $(srcdir)/conf/common.mk