]> git.proxmox.com Git - grub2.git/blob - conf/i386-pc.rmk
merge from trunk
[grub2.git] / conf / i386-pc.rmk
1 # -*- makefile -*-
2
3 GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
4
5 COMMON_ASFLAGS = -nostdinc -fno-builtin -m32
6 COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
7 COMMON_LDFLAGS = -m32 -nostdlib
8
9 # Used by various components. These rules need to precede them.
10 script/lexer.c_DEPENDENCIES = grub_script.tab.h
11
12 # Images.
13 pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \
14 pxeboot.img
15
16 # For boot.img.
17 boot_img_SOURCES = boot/i386/pc/boot.S
18 boot_img_ASFLAGS = $(COMMON_ASFLAGS)
19 boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x7C00
20 boot_img_FORMAT = binary
21
22 # For pxeboot.img
23 pxeboot_img_SOURCES = boot/i386/pc/pxeboot.S
24 pxeboot_img_ASFLAGS = $(COMMON_ASFLAGS)
25 pxeboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x7C00
26 pxeboot_img_FORMAT = binary
27
28 # For diskboot.img.
29 diskboot_img_SOURCES = boot/i386/pc/diskboot.S
30 diskboot_img_ASFLAGS = $(COMMON_ASFLAGS)
31 diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x8000
32 diskboot_img_FORMAT = binary
33
34 # For lnxboot.img.
35 lnxboot_img_SOURCES = boot/i386/pc/lnxboot.S
36 lnxboot_img_ASFLAGS = $(COMMON_ASFLAGS)
37 lnxboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x6000
38 lnxboot_img_FORMAT = binary
39
40 # For cdboot.img.
41 cdboot_img_SOURCES = boot/i386/pc/cdboot.S
42 cdboot_img_ASFLAGS = $(COMMON_ASFLAGS)
43 cdboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x7C00
44 cdboot_img_FORMAT = binary
45
46 # For kernel.img.
47 kernel_img_SOURCES = kern/i386/pc/startup.S \
48 kern/i386/misc.S \
49 kern/main.c kern/device.c \
50 kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
51 kern/misc.c kern/mm.c kern/term.c \
52 kern/rescue_parser.c kern/rescue_reader.c \
53 kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
54 kern/$(target_cpu)/dl.c kern/i386/pc/init.c kern/i386/pc/mmap.c \
55 kern/parser.c kern/partition.c \
56 kern/i386/tsc.c kern/i386/pit.c \
57 kern/generic/rtc_get_time_ms.c \
58 kern/generic/millisleep.c \
59 kern/env.c \
60 term/i386/pc/console.c term/i386/vga_common.c \
61 symlist.c
62 kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
63 env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
64 partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
65 machine/biosdisk.h machine/boot.h machine/console.h machine/init.h \
66 machine/memory.h machine/loader.h machine/vga.h machine/vbe.h \
67 machine/kernel.h machine/pxe.h i386/pit.h list.h handler.h command.h i18n.h
68 kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
69 kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
70 kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
71 kernel_img_FORMAT = binary
72
73 MOSTLYCLEANFILES += symlist.c kernel_syms.lst
74 DEFSYMFILES += kernel_syms.lst
75
76 symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
77 /bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
78
79 kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
80 /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
81
82 # Utilities.
83 bin_UTILITIES = grub-mkimage
84 sbin_UTILITIES = grub-setup
85
86 # For grub-mkimage.
87 grub_mkimage_SOURCES = gnulib/progname.c util/i386/pc/grub-mkimage.c util/misc.c \
88 util/resolve.c lib/LzmaEnc.c lib/LzFind.c
89 grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
90 util/i386/pc/grub-mkimage.c_DEPENDENCIES = Makefile
91
92 # For grub-setup.
93 util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
94 grub_setup_SOURCES = gnulib/progname.c \
95 util/i386/pc/grub-setup.c util/hostdisk.c \
96 util/misc.c util/getroot.c kern/device.c kern/disk.c \
97 kern/err.c kern/misc.c kern/parser.c kern/partition.c \
98 kern/file.c kern/fs.c kern/env.c fs/fshelp.c \
99 \
100 fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
101 fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
102 fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
103 fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
104 fs/befs.c fs/befs_be.c fs/tar.c \
105 \
106 partmap/msdos.c partmap/gpt.c \
107 \
108 disk/raid.c disk/mdraid_linux.c disk/lvm.c \
109 util/raid.c util/lvm.c \
110 grub_setup_init.c
111
112 sbin_SCRIPTS += grub-install
113 grub_install_SOURCES = util/grub-install.in
114
115 bin_SCRIPTS += grub-mkrescue
116 grub_mkrescue_SOURCES = util/grub-mkrescue.in
117
118 pkglib_MODULES = biosdisk.mod chain.mod \
119 reboot.mod halt.mod \
120 vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \
121 vga.mod memdisk.mod pci.mod lspci.mod \
122 aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
123 datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \
124 usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \
125 efiemu.mod mmap.mod acpi.mod drivemap.mod
126
127 # For boot.mod.
128 pkglib_MODULES += boot.mod
129 boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
130 boot_mod_CFLAGS = $(COMMON_CFLAGS)
131 boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
132
133 # For drivemap.mod.
134 drivemap_mod_SOURCES = commands/i386/pc/drivemap.c \
135 commands/i386/pc/drivemap_int13h.S
136 drivemap_mod_ASFLAGS = $(COMMON_ASFLAGS)
137 drivemap_mod_CFLAGS = $(COMMON_CFLAGS)
138 drivemap_mod_LDFLAGS = $(COMMON_LDFLAGS)
139
140 # For efiemu.mod.
141 efiemu_mod_SOURCES = efiemu/main.c efiemu/i386/loadcore32.c \
142 efiemu/i386/loadcore64.c efiemu/i386/pc/cfgtables.c \
143 efiemu/mm.c efiemu/loadcore_common.c efiemu/symbols.c \
144 efiemu/loadcore32.c efiemu/loadcore64.c \
145 efiemu/prepare32.c efiemu/prepare64.c efiemu/pnvram.c \
146 efiemu/i386/coredetect.c
147 efiemu_mod_CFLAGS = $(COMMON_CFLAGS)
148 efiemu_mod_LDFLAGS = $(COMMON_LDFLAGS)
149
150 # For acpi.mod.
151 acpi_mod_SOURCES = commands/acpi.c commands/i386/pc/acpi.c
152 acpi_mod_CFLAGS = $(COMMON_CFLAGS)
153 acpi_mod_LDFLAGS = $(COMMON_LDFLAGS)
154
155 # For mmap.mod.
156 mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c \
157 mmap/i386/pc/mmap.c mmap/i386/pc/mmap_helper.S
158 mmap_mod_CFLAGS = $(COMMON_CFLAGS)
159 mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
160 mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
161
162 # For biosdisk.mod.
163 biosdisk_mod_SOURCES = disk/i386/pc/biosdisk.c
164 biosdisk_mod_CFLAGS = $(COMMON_CFLAGS)
165 biosdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
166
167 # For chain.mod.
168 chain_mod_SOURCES = loader/i386/pc/chainloader.c
169 chain_mod_CFLAGS = $(COMMON_CFLAGS)
170 chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
171
172 pkglib_MODULES += linux16.mod
173 linux16_mod_SOURCES = loader/i386/pc/linux.c
174 linux16_mod_CFLAGS = $(COMMON_CFLAGS)
175 linux16_mod_LDFLAGS = $(COMMON_LDFLAGS)
176
177 pkglib_MODULES += linux.mod
178 linux_mod_SOURCES = loader/i386/linux.c
179 linux_mod_CFLAGS = $(COMMON_CFLAGS)
180 linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
181
182 pkglib_MODULES += xnu.mod
183 xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/pc/xnu.c \
184 loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
185 xnu_mod_CFLAGS = $(COMMON_CFLAGS)
186 xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
187 xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
188
189 # For reboot.mod.
190 reboot_mod_SOURCES = commands/reboot.c
191 reboot_mod_CFLAGS = $(COMMON_CFLAGS)
192 reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
193
194 # For halt.mod.
195 halt_mod_SOURCES = commands/i386/pc/halt.c
196 halt_mod_CFLAGS = $(COMMON_CFLAGS)
197 halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
198
199 # For serial.mod.
200 serial_mod_SOURCES = term/i386/pc/serial.c
201 serial_mod_CFLAGS = $(COMMON_CFLAGS)
202 serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
203
204 pkglib_MODULES += multiboot.mod
205 multiboot_mod_SOURCES = loader/i386/multiboot.c \
206 loader/i386/multiboot_mbi.c \
207 loader/multiboot_loader.c
208 multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
209 multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
210 multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
211
212 pkglib_MODULES += multiboot2.mod
213 multiboot2_mod_SOURCES = loader/i386/multiboot.c \
214 loader/i386/multiboot_mbi.c \
215 loader/multiboot_loader.c
216 multiboot2_mod_CFLAGS = $(COMMON_CFLAGS) -DGRUB_USE_MULTIBOOT2
217 multiboot2_mod_LDFLAGS = $(COMMON_LDFLAGS)
218 multiboot2_mod_ASFLAGS = $(COMMON_ASFLAGS)
219
220 # For vbe.mod.
221 vbe_mod_SOURCES = video/i386/pc/vbe.c
222 vbe_mod_CFLAGS = $(COMMON_CFLAGS)
223 vbe_mod_LDFLAGS = $(COMMON_LDFLAGS)
224
225 # For vbeinfo.mod.
226 vbeinfo_mod_SOURCES = commands/i386/pc/vbeinfo.c
227 vbeinfo_mod_CFLAGS = $(COMMON_CFLAGS)
228 vbeinfo_mod_LDFLAGS = $(COMMON_LDFLAGS)
229
230 # For vbetest.mod.
231 vbetest_mod_SOURCES = commands/i386/pc/vbetest.c
232 vbetest_mod_CFLAGS = $(COMMON_CFLAGS)
233 vbetest_mod_LDFLAGS = $(COMMON_LDFLAGS)
234
235 # For play.mod.
236 play_mod_SOURCES = commands/i386/pc/play.c
237 play_mod_CFLAGS = $(COMMON_CFLAGS)
238 play_mod_LDFLAGS = $(COMMON_LDFLAGS)
239
240 # For vga.mod.
241 vga_mod_SOURCES = term/i386/pc/vga.c
242 vga_mod_CFLAGS = $(COMMON_CFLAGS)
243 vga_mod_LDFLAGS = $(COMMON_LDFLAGS)
244
245 # For memdisk.mod.
246 memdisk_mod_SOURCES = disk/memdisk.c
247 memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
248 memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
249
250 # For pci.mod
251 pci_mod_SOURCES = bus/pci.c
252 pci_mod_CFLAGS = $(COMMON_CFLAGS)
253 pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
254
255 # For lspci.mod
256 lspci_mod_SOURCES = commands/lspci.c
257 lspci_mod_CFLAGS = $(COMMON_CFLAGS)
258 lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
259
260 # For aout.mod
261 aout_mod_SOURCES = loader/aout.c
262 aout_mod_CFLAGS = $(COMMON_CFLAGS)
263 aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
264
265 # For bsd.mod
266 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
267 bsd_mod_CFLAGS = $(COMMON_CFLAGS)
268 bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
269 bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
270
271 # For usb.mod
272 usb_mod_SOURCES = bus/usb/usb.c bus/usb/usbtrans.c bus/usb/usbhub.c
273 usb_mod_CFLAGS = $(COMMON_CFLAGS)
274 usb_mod_LDFLAGS = $(COMMON_LDFLAGS)
275
276 # For usbtest.mod
277 usbtest_mod_SOURCES = commands/usbtest.c
278 usbtest_mod_CFLAGS = $(COMMON_CFLAGS)
279 usbtest_mod_LDFLAGS = $(COMMON_LDFLAGS)
280
281 # For uhci.mod
282 uhci_mod_SOURCES = bus/usb/uhci.c
283 uhci_mod_CFLAGS = $(COMMON_CFLAGS)
284 uhci_mod_LDFLAGS = $(COMMON_LDFLAGS)
285
286 # For ohci.mod
287 ohci_mod_SOURCES = bus/usb/ohci.c
288 ohci_mod_CFLAGS = $(COMMON_CFLAGS)
289 ohci_mod_LDFLAGS = $(COMMON_LDFLAGS)
290
291 # For usbms.mod
292 usbms_mod_SOURCES = disk/usbms.c
293 usbms_mod_CFLAGS = $(COMMON_CFLAGS)
294 usbms_mod_LDFLAGS = $(COMMON_LDFLAGS)
295
296 # For usb_keyboard.mod
297 usb_keyboard_mod_SOURCES = term/usb_keyboard.c
298 usb_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
299 usb_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
300
301 # For pxe.mod
302 pxe_mod_SOURCES = fs/i386/pc/pxe.c
303 pxe_mod_CFLAGS = $(COMMON_CFLAGS)
304 pxe_mod_LDFLAGS = $(COMMON_LDFLAGS)
305
306 # For pxecmd.mod
307 pxecmd_mod_SOURCES = commands/i386/pc/pxecmd.c
308 pxecmd_mod_CFLAGS = $(COMMON_CFLAGS)
309 pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
310
311 # For datetime.mod
312 datetime_mod_SOURCES = lib/i386/datetime.c
313 datetime_mod_CFLAGS = $(COMMON_CFLAGS)
314 datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
315
316 # For date.mod
317 date_mod_SOURCES = commands/date.c
318 date_mod_CFLAGS = $(COMMON_CFLAGS)
319 date_mod_LDFLAGS = $(COMMON_LDFLAGS)
320
321 # For datehook.mod
322 datehook_mod_SOURCES = hook/datehook.c
323 datehook_mod_CFLAGS = $(COMMON_CFLAGS)
324 datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
325
326 # For lsmmap.mod
327 lsmmap_mod_SOURCES = commands/lsmmap.c
328 lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
329 lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
330
331 # For ata_pthru.mod.
332 ata_pthru_mod_SOURCES = disk/ata_pthru.c
333 ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)
334 ata_pthru_mod_LDFLAGS = $(COMMON_LDFLAGS)
335
336 # For hdparm.mod.
337 hdparm_mod_SOURCES = commands/hdparm.c lib/hexdump.c
338 hdparm_mod_CFLAGS = $(COMMON_CFLAGS)
339 hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS)
340
341 ifeq ($(enable_efiemu), yes)
342
343 efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
344 -rm -f $@
345 ifeq ($(TARGET_APPLE_CC), 1)
346 -rm -f $@.bin
347 $(TARGET_CC) -c -m32 -DELF32 -DAPPLE_CC -o $@.bin -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
348 $(OBJCONV) -felf32 -nu -nd $@.bin $@
349 -rm -f $@.bin
350 else
351 $(TARGET_CC) -c -m32 -DELF32 -o $@ -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
352 if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
353 endif
354
355 efiemu64_c.o: efiemu/runtime/efiemu.c
356 ifeq ($(TARGET_APPLE_CC), 1)
357 $(TARGET_CC) -c -m64 -DAPPLE_CC=1 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
358 else
359 $(TARGET_CC) -c -m64 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mcmodel=large -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
360 endif
361
362 efiemu64_s.o: efiemu/runtime/efiemu.S
363 -rm -f $@
364 ifeq ($(TARGET_APPLE_CC), 1)
365 $(TARGET_CC) -c -m64 -DAPPLE_CC=1 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
366 else
367 $(TARGET_CC) -c -m64 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mcmodel=large -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
368 endif
369
370 efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELF)
371 -rm -f $@
372 ifeq ($(TARGET_APPLE_CC), 1)
373 -rm -f $@.bin
374 $(TARGET_CC) -m64 -o $@.bin -Wl,-r $^ -nostdlib
375 $(OBJCONV) -felf64 -nu -nd $@.bin $@
376 -rm -f $@.bin
377 else
378 $(TARGET_CC) -m64 -o $@ -Wl,-r $^ -nostdlib
379 if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
380 endif
381
382 CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
383 pkglib_DATA += efiemu32.o efiemu64.o
384
385 endif
386
387 include $(srcdir)/conf/i386.mk
388 include $(srcdir)/conf/common.mk