2020-11-25 04:32:16 -05:00
|
|
|
CCPREFIX = i686-elf-
|
|
|
|
|
|
|
|
AS = $(CCPREFIX)as
|
|
|
|
CC = $(CCPREFIX)gcc
|
2020-11-25 13:10:00 -05:00
|
|
|
LD = $(CCPREFIX)ld
|
2020-11-25 04:32:16 -05:00
|
|
|
|
|
|
|
KERNEL = kernelmq.multiboot2
|
|
|
|
|
2020-11-27 09:05:20 -05:00
|
|
|
CFLAGS = -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra -I/usr/local/include
|
2020-11-25 04:32:16 -05:00
|
|
|
|
|
|
|
# Architecture-dependent
|
|
|
|
OBJS = start.s.o
|
|
|
|
OBJS += main.c.o
|
|
|
|
OBJS += multiboot.c.o
|
2020-11-27 09:15:02 -05:00
|
|
|
OBJS += panic.c.o
|
2020-11-27 09:05:20 -05:00
|
|
|
OBJS += paging.c.o
|
2020-11-25 07:27:40 -05:00
|
|
|
OBJS += page_dir.c.o
|
2020-11-25 04:32:16 -05:00
|
|
|
|
|
|
|
# Architecture-independent
|
|
|
|
OBJS += info.c.o
|
2020-11-26 04:43:20 -05:00
|
|
|
OBJS += process.c.o
|
2020-11-25 04:32:16 -05:00
|
|
|
|
|
|
|
# Stdlib
|
|
|
|
OBJS += memset.c.o
|
|
|
|
OBJS += strlen.c.o
|
|
|
|
OBJS += itoa.c.o
|
|
|
|
OBJS += strncpy.c.o
|
|
|
|
|
|
|
|
# Built-in drivers
|
|
|
|
OBJS += console.c.o
|
|
|
|
OBJS += pic.c.o
|
|
|
|
OBJS += timer.c.o
|
|
|
|
|
|
|
|
# For debugging
|
|
|
|
OBJS += logger.c.o
|
|
|
|
|
|
|
|
OBJS += protected.c.o protected.asm.cpp.o
|
|
|
|
|
|
|
|
OBJS += tss.c.o tss.asm.cpp.o
|
|
|
|
OBJS += tasks.asm.cpp.o
|
|
|
|
|
|
|
|
OBJS += interrupt.asm.cpp.o
|
|
|
|
|
|
|
|
OBJS += exception.c.o
|
|
|
|
OBJS += hwint.c.o
|
|
|
|
OBJS += syscall.c.o
|
|
|
|
|
|
|
|
all: $(KERNEL)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(KERNEL) $(OBJS)
|
|
|
|
|
|
|
|
$(KERNEL): $(OBJS)
|
2020-11-27 09:05:20 -05:00
|
|
|
$(CC) -T linker.ld -o $@ $^ -ffreestanding -nostdlib -lgcc -lkernaux -Wl,-L/usr/local/lib
|
2020-11-25 04:32:16 -05:00
|
|
|
grub-file --is-x86-multiboot2 $@
|
|
|
|
|
|
|
|
%.c.o: %.c
|
|
|
|
$(CC) -c $< -o $@ $(CFLAGS)
|
|
|
|
|
|
|
|
%.s.o: %.s
|
|
|
|
$(AS) $< -o $@
|
|
|
|
|
|
|
|
%.asm.cpp.o: %.asm.cpp
|
2020-11-25 06:00:24 -05:00
|
|
|
nasm -f elf32 -o $@ $<
|
2020-11-25 04:32:16 -05:00
|
|
|
|
|
|
|
%.asm.cpp: %.asm
|
|
|
|
cpp -P $< $@
|