mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
127 lines
2.9 KiB
Makefile
127 lines
2.9 KiB
Makefile
#----------------------------------------------------------------------------#
|
|
# GNU GPL OS/K #
|
|
# #
|
|
# Authors: spectral` #
|
|
# NeoX #
|
|
# #
|
|
# Desc: Project Makefile #
|
|
#----------------------------------------------------------------------------#
|
|
|
|
CC_NAME="/opt/cross-cc/bin/x86_64-elf-gcc"
|
|
CWARNS=-Wall -Wextra -Werror
|
|
CFLAGS=-nostdlib -ffreestanding -mcmodel=large -mno-red-zone -mno-mmx -mno-sse -mno-sse2
|
|
CINCLUDES=-I./kaleid
|
|
CDEFINES=
|
|
|
|
CC=$(CC_NAME) $(CWARNS) $(CFLAGS) $(CDEFINES) $(CINCLUDES)
|
|
|
|
ASM=nasm
|
|
ASMFLAGS=
|
|
BOOTFLAGS=-f bin
|
|
|
|
BINDIR=../bin
|
|
OBJDIR=../obj
|
|
|
|
BOOTDIR=boot
|
|
COMMDIR=kaleid/common
|
|
KERNDIR=kaleid/kernel
|
|
SYSTDIR=kaleid/system
|
|
|
|
all: bootloader
|
|
|
|
boot.mbr.s: $(BOOTDIR)/mbr.s $(BOOTDIR)/mbr.inc
|
|
$(ASM) $(BOOTFLAGS) $(BOOTDIR)/mbr.s -o $(OBJDIR)/boot/mbr.bin
|
|
|
|
boot.loader.s: $(BOOTDIR)/loader.s
|
|
$(ASM) $(BOOTFLAGS) $(BOOTDIR)/loader.s -o $(OBJDIR)/boot/loader.bin
|
|
|
|
bootloader: boot.mbr.s boot.loader.s
|
|
cat $(OBJDIR)/boot/mbr.bin $(OBJDIR)/boot/loader.bin > $(BINDIR)/bootloader.bin
|
|
|
|
#----------------------------------------------------------------------------#
|
|
# TESTING MAKEFILE
|
|
|
|
pseudo_kern:
|
|
$(ASM) $(BOOTFLAGS) $(BOOTDIR)/pseudo_kernel.s -o $(OBJDIR)/boot/pkernel.bin
|
|
|
|
testing: bootloader pseudo_kern
|
|
cat $(BINDIR)/bootloader.bin $(OBJDIR)/boot/pkernel.bin > $(BINDIR)/boot.bin
|
|
|
|
#----------------------------------------------------------------------------#
|
|
# COMMON MAKEFILE
|
|
|
|
COBJDIR=$(OBJDIR)/$(COMMDIR)
|
|
|
|
COMM_DEPS=$(COMMDIR)/common.h $(COMMDIR)/assert.h $(COMMDIR)/atomic.h $(COMMDIR)/config.h \
|
|
$(COMMDIR)/status.h
|
|
|
|
COBJECTS=$(COBJDIR)/lib/string.o
|
|
|
|
common: common.lib.string.c $(COMM_DEPS)
|
|
|
|
common.lib.string.c: $(COMMDIR)/lib/string.c $(COMM_DEPS)
|
|
$(CC) -c $(COMMDIR)/lib/string.c -o $(OBJDIR)/$(COMMDIR)/lib/string.o
|
|
|
|
#----------------------------------------------------------------------------#
|
|
# KERNEL MAKEFILE
|
|
|
|
KOBJDIR=$(OBJDIR)/$(KERNDIR)
|
|
|
|
KERN_DEPS=$(COMM_DEPS) $(KERNDIR)/init.h $(KERNDIR)/io/terminal.h $(KERNDIR)/io/ports.h
|
|
|
|
kernel: common kernel.io.terminal.c kernel.init.c kernel.io.ports.c
|
|
$(CC) -o $(BINDIR)/kaleid-kernel.elf \
|
|
$(COBJECTS) $(KOBJDIR)/init.o \
|
|
$(KOBJDIR)/io/terminal.o $(KOBJDIR)/io/ports.o
|
|
|
|
|
|
kernel.init.c: $(KERNDIR)/init.c $(KERN_DEPS)
|
|
$(CC) -c $(KERNDIR)/init.c -o $(KOBJDIR)/init.o
|
|
|
|
kernel.io.ports.c: $(KERNDIR)/io/ports.c $(KERN_DEPS)
|
|
$(CC) -c $(KERNDIR)/io/ports.c -o $(KOBJDIR)/io/ports.o
|
|
|
|
kernel.io.terminal.c: $(KERNDIR)/io/terminal.c $(KERN_DEPS)
|
|
$(CC) -c $(KERNDIR)/io/terminal.c -o $(KOBJDIR)/io/terminal.o
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|