1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2024-11-20 11:16:10 -05:00
kernel/Makefile

77 lines
1.4 KiB
Makefile
Raw Normal View History

2017-11-09 10:37:11 -05:00
export CCPREFIX = i686-elf-
2017-11-04 02:09:14 -04:00
2017-11-08 04:38:55 -05:00
export AR = $(CCPREFIX)ar
export AS = $(CCPREFIX)as
export CC = $(CCPREFIX)gcc
2017-11-04 03:43:03 -04:00
export INCLUDE = $(shell pwd)/include
2017-11-09 04:58:39 -05:00
export KERNEL = $(shell pwd)/rootfs/boot/kernelmq.multiboot2
export CFLAGS = -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra -I $(INCLUDE)
2017-11-09 04:58:39 -05:00
IMAGE = $(shell pwd)/image.iso
2017-11-09 10:52:58 -05:00
# Architecture-dependent
OBJS = start.s.o
OBJS += main.c.o
OBJS += init.c.o
OBJS += multiboot.c.o
OBJS += panic.c.o panic.asm.cpp.o
OBJS += pfa.c.o
OBJS += paging.c.o paging.asm.cpp.o
OBJS += pagedir.c.o
# Architecture-independent
OBJS += info.c.o
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
OBJS += keyboard.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
run: $(KERNEL)
2017-11-09 04:58:39 -05:00
grub-file --is-x86-multiboot2 $(KERNEL)
grub-mkrescue rootfs -o $(IMAGE)
qemu-system-i386 -cdrom $(IMAGE)
2017-11-01 01:03:52 -04:00
2017-11-09 10:52:58 -05:00
all: $(KERNEL)
2017-11-08 06:06:18 -05:00
2017-11-09 10:52:58 -05:00
clean:
rm -f $(OBJS)
2017-11-09 04:58:39 -05:00
rm -f $(IMAGE)
2017-11-08 04:38:55 -05:00
rm -f $(KERNEL)
2017-11-09 10:52:58 -05:00
$(KERNEL): $(OBJS)
$(CC) -T linker.ld -o $(KERNEL) -ffreestanding -nostdlib -lgcc $(OBJS)
%.c.o: %.c
$(CC) -c $< -o $@ $(CFLAGS)
%.s.o: %.s
$(AS) $< -o $@
2017-11-08 04:38:55 -05:00
2017-11-09 10:52:58 -05:00
%.asm.cpp.o: %.asm.cpp
nasm -felf32 -o $@ $<
2017-11-08 04:38:55 -05:00
2017-11-09 10:52:58 -05:00
%.asm.cpp: %.asm
cpp -P $< $@