summaryrefslogtreecommitdiff
path: root/Makefile
blob: 593ead04a29c8d7bb48efd5d2f7b8925187f62b2 (plain)
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
AS      = i686-elf-as
CC      = i686-elf-gcc
CFLAGS  = -std=gnu99 -ffreestanding -O2 -Wall -Wextra
CFLAGS += -I.
LFLAGS  = -ffreestanding -O2 -nostdlib -lgcc

OBJ  = platform/boot.o
OBJ += $(patsubst %.c,%.o,$(wildcard kernel/*.c))


.PHONY: boot clean
boot: kernel.bin
	qemu-system-i386 -kernel kernel.bin

clean:
	rm -vf kernel.bin
	rm -vf **/*.o


kernel.bin: $(OBJ)
	$(CC) $(LFLAGS) -T linker.ld $^ -o $@
	grub-file --is-x86-multiboot $@

platform/boot.o: platform/boot.s
	$(AS) $^ -o $@

%.o: %.c
	$(CC) $(CFLAGS) -c $^ -o $@