os-k/Makefile.in

94 lines
3.0 KiB
Makefile
Raw Normal View History

2019-01-02 17:19:13 +01:00
//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Authors: spectral` //
// NeoX //
// //
// Desc: Project Makefile //
//----------------------------------------------------------------------------//
2019-01-02 16:27:12 +01:00
// The madman's Makefile
2019-01-14 14:31:49 +01:00
#include "build/preproc.h"
2019-01-02 16:27:12 +01:00
CCNAME="/opt/cross-cc/bin/x86_64-elf-gcc"
CC2NAME=gcc
COPTIM=-O2
2019-01-21 09:53:54 +01:00
CWARNS=-Wall -Wextra -Wshadow // -Wpedantic
2019-01-02 16:27:12 +01:00
CINCLUDES=-isystem./kaleid/include
2019-01-14 14:31:49 +01:00
CFLAGS1=-std=gnu11 -nostdlib -ffreestanding -mcmodel=large
CFLAGS2=-m64 -masm=intel -mno-red-zone -mno-mmx -mno-sse -mno-sse2
2019-01-02 16:27:12 +01:00
CFLAGS=$(CFLAGS1) $(CFLAGS2) $(SFLAG)
2019-01-14 14:31:49 +01:00
CC=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS) $(CINCLUDES)
2019-01-02 16:27:12 +01:00
2019-01-14 14:31:49 +01:00
BINDIR=./build/bin
OBJDIR=./build/obj
2019-01-02 16:27:12 +01:00
BOOTDIR=boot
COMMDIR=kaleid/crtlib
2019-01-02 16:27:12 +01:00
KERNDIR=kaleid/kernel
SYSTDIR=kaleid/system
LINXDIR=$(COMMDIR)/test
2019-01-02 16:27:12 +01:00
//----------------------------------------------------------------------------#
// 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)
LOBJDIR=$(OBJDIR)/$(LINXDIR)
2019-01-21 14:58:04 +01:00
COMMOBJS=COBJ6(string, status, rand, memory, arith, strtol) COBJ4(itoa, ltoa, utoa, ultoa) COBJ4(atoi, atol, atou, atoul) COBJ2(../extras/prog, ../extras/argv)
2019-01-02 16:27:12 +01:00
TCC=$(CC2NAME) $(COPTIM) $(CWARNS) $(CINCLUDES)
2019-01-14 14:31:49 +01:00
KCC=$(CC) -T ./build/kernel.ld -D_OSK_SOURCE -D_KALEID_KERNEL
2019-01-02 16:27:12 +01:00
comm-convert:
2019-01-14 14:31:49 +01:00
COMPILE_CONVRT1(itoa) -D_NEED_ITOA
COMPILE_CONVRT1(ltoa) -D_NEED_LTOA
COMPILE_CONVRT1(utoa) -D_NEED_UTOA
COMPILE_CONVRT1(ultoa) -D_NEED_ULTOA
COMPILE_CONVRT2(atoi) -D_NEED_ATOI
COMPILE_CONVRT2(atol) -D_NEED_ATOL
COMPILE_CONVRT2(atou) -D_NEED_ATOU
COMPILE_CONVRT2(atoul) -D_NEED_ATOUL
2019-01-02 16:27:12 +01:00
common: comm-convert
COMPILE_COMMON(rand)
COMPILE_COMMON(arith)
COMPILE_COMMON(string)
COMPILE_COMMON(status)
COMPILE_COMMON(memory)
2019-01-14 14:31:49 +01:00
COMPILE_COMMON(strtol)
2019-01-21 14:58:04 +01:00
COMPILE_COMMON(../extras/prog)
COMPILE_COMMON(../extras/argv)
2019-01-02 16:27:12 +01:00
tests: common
$(TCC) -c $(LINXDIR)/test-common.c -o $(LOBJDIR)/test-common.o
$(TCC) $(COMMOBJS) $(LOBJDIR)/test-common.o -o $(BINDIR)/kaleid-common.elf
//----------------------------------------------------------------------------#
// KERNEL MAKEFILE
KOBJDIR=$(OBJDIR)/$(KERNDIR)
2019-01-14 14:31:49 +01:00
KERNOBJS=KOBJ4(init/init, init/table, ke/panic, ke/terminal)
2019-01-02 16:27:12 +01:00
kernel: common
2019-01-14 14:31:49 +01:00
COMPILE_KERNEL(init/init)
COMPILE_KERNEL(init/table)
2019-01-02 16:27:12 +01:00
COMPILE_KERNEL(ke/panic)
2019-01-14 14:31:49 +01:00
COMPILE_KERNEL(ke/terminal)
2019-01-02 16:27:12 +01:00
LINK_KERNEL(kaleid-kernel.elf)
//----------------------------------------------------------------------------#