-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (33 loc) · 1.04 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
CROSS = ~/cross/bin
LD = $(CROSS)/x86_64-elf-ld
CC = $(CROSS)/x86_64-elf-gcc
CXX = $(CROSS)/x86_64-elf-g++
AS = nasm
ASFLAGS = -f elf64
LDFLAGS = -nostdlib -nodefaultlibs
objects = kmain.o
all:: boot.iso
install:: /media/sf_VirtualBox/boot.iso
.PHONY: clean
clean::
-rm -rf image boot.iso *.o *.img *~
%.o: %.s
$(AS) $(ASFLAGS) -o $@ $<
image/boot/%: %
-mkdir -p image/boot
cp $< $@
/media/sf_VirtualBox/%: %
cp $< $@
image/bootstrap.elf32: bootstrap.ld start.o
-mkdir image
$(LD) $(LDFLAGS) -T bootstrap.ld -o $@ start.o
image/kernel.elf64: kernel.ld $(objects)
-mkdir image
$(LD) $(LDFLAGS) -T kernel.ld -o $@ $(objects)
core.img: grub-mkimage.cfg
grub-mkimage -p "(cd)/boot" -o core.img -O i386-pc -c grub-mkimage.cfg biosdisk iso9660 multiboot configfile
eltorito.img: /usr/lib/grub/i386-pc/cdboot.img core.img
-mkdir -p image/boot
cat $^ > $@
boot.iso: image/boot/eltorito.img image/bootstrap.elf32 image/kernel.elf64 image/boot/grub.cfg
genisoimage -R -b boot/eltorito.img -no-emul-boot -boot-load-size 4 -boot-info-table -o $@ image