summaryrefslogtreecommitdiff
path: root/makefile
blob: 5c0eedd6091118686dec9a60b65411d9d36145cc (plain) (blame)
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
cd: files grub
	grub2-mkrescue out/fs -o out/cd.iso --product-name=portland --product-version=0.0.9

grub: kernel
	mkdir -p out/fs/boot/grub
	mv out/kernel.elf out/fs/boot/
	cp src/grub.cfg out/fs/boot/grub/

files: out
	mkdir -p out/fs
	cp -r src/skel/* out/fs/

kernel: obj out
	nasm src/kernel/keyb.asm   -o obj/kkeyba.o  -f elf32
	nasm src/kernel/serial.asm -o obj/kserial.o -f elf32
	nasm src/kernel/stub.asm   -o obj/kstub.o   -f elf32
	gcc -c src/kernel/diskio.c -o obj/kdiskio.o -ffreestanding -nostdlib -m32
	gcc -c src/kernel/files.c  -o obj/kfiles.o  -ffreestanding -nostdlib -m32
	gcc -c src/kernel/gpt.c    -o obj/kgpt.o    -ffreestanding -nostdlib -m32
	gcc -c src/kernel/keyb.c   -o obj/kkeybc.o  -ffreestanding -nostdlib -m32
	gcc -c src/kernel/main.c   -o obj/kmain.o   -ffreestanding -nostdlib -m32
	gcc -c src/kernel/mem.c    -o obj/kmem.o    -ffreestanding -nostdlib -m32
	gcc -c src/kernel/proc.c   -o obj/kproc.o   -ffreestanding -nostdlib -m32
	gcc -c src/kernel/vga.c    -o obj/kvga.o    -ffreestanding -nostdlib -m32
	ld obj/kkeyba.o obj/kserial.o obj/kstub.o obj/kdiskio.o obj/kfiles.o \
		obj/kgpt.o obj/kkeybc.o obj/kmain.o obj/kmem.o obj/kproc.o obj/kvga.o \
		-o out/kernel.elf -T src/kernel/link.ld -s --orphan-handling=discard -melf_i386

clean:
	rm -r obj out

obj:
	mkdir -p obj

out:
	mkdir -p out