2017-11-01 04:37:39 -04:00
|
|
|
ifneq (ok, $(shell test -d '$(I)' && echo 'ok'))
|
|
|
|
$(error 'Include directory "$(I)" does not exist')
|
|
|
|
endif
|
|
|
|
|
2017-11-01 00:53:54 -04:00
|
|
|
CCPREFIX = i686-elf-
|
|
|
|
|
|
|
|
AS = $(CCPREFIX)as
|
|
|
|
CC = $(CCPREFIX)gcc
|
|
|
|
|
2017-11-01 02:07:03 -04:00
|
|
|
OBJS = boot.s.o main.c.o logger.c.o console.c.o gdt.c.o gdt.asm.o idt.c.o idt.asm.o isr.c.o isr.asm.o
|
2017-11-01 00:53:54 -04:00
|
|
|
|
|
|
|
all: kernel
|
|
|
|
|
|
|
|
clean:
|
2017-11-01 01:01:29 -04:00
|
|
|
rm -f kernel $(OBJS)
|
2017-11-01 00:53:54 -04:00
|
|
|
|
|
|
|
kernel: $(OBJS)
|
2017-11-01 02:42:30 -04:00
|
|
|
$(CC) -T linker.ld -o $@ -ffreestanding -nostdlib -lgcc $(OBJS)
|
2017-11-01 04:53:27 -04:00
|
|
|
grub-file --is-x86-multiboot $@
|
|
|
|
grub-file --is-x86-multiboot2 $@
|
2017-11-01 00:53:54 -04:00
|
|
|
|
|
|
|
%.c.o: %.c
|
2017-11-01 04:37:39 -04:00
|
|
|
$(CC) -c $< -o $@ -std=gnu99 -ffreestanding -fno-builtin -fno-stack-protector -Wall -Wextra -I$(I)
|
2017-11-01 00:53:54 -04:00
|
|
|
|
|
|
|
%.s.o: %.s
|
|
|
|
$(AS) $< -o $@
|
2017-11-01 01:26:22 -04:00
|
|
|
|
|
|
|
%.asm.o: %.asm
|
|
|
|
nasm -felf -o $@ $<
|