104 lines
3.3 KiB
Groff
104 lines
3.3 KiB
Groff
|
# 1 "./Makefile.in"
|
||
|
# 1 "<built-in>"
|
||
|
# 1 "<command-line>"
|
||
|
# 31 "<command-line>"
|
||
|
# 1 "/usr/include/stdc-predef.h" 1 3 4
|
||
|
# 32 "<command-line>" 2
|
||
|
# 1 "./Makefile.in"
|
||
|
# 11 "./Makefile.in"
|
||
|
# 1 "./build/preproc.h" 1
|
||
|
# 12 "./Makefile.in" 2
|
||
|
|
||
|
CCNAME="/opt/cross-cc/bin/x86_64-elf-gcc"
|
||
|
CC2NAME=gcc
|
||
|
COPTIM=-O2
|
||
|
CWARNS=-Wall -Wextra -Wshadow -Wpedantic
|
||
|
CINCLUDES=-isystem./kaleid/include
|
||
|
|
||
|
CFLAGS1=-std=gnu11 -nostdlib -ffreestanding -mcmodel=large
|
||
|
CFLAGS2=-m64 -masm=intel -mno-red-zone -mno-mmx -mno-sse -mno-sse2
|
||
|
CFLAGS=$(CFLAGS1) $(CFLAGS2) $(SFLAG)
|
||
|
|
||
|
CC=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS) $(CINCLUDES)
|
||
|
|
||
|
ASM=nasm
|
||
|
ASMFLAGS=
|
||
|
BOOTFLAGS=-f bin
|
||
|
|
||
|
BINDIR=./build/bin
|
||
|
OBJDIR=./build/obj
|
||
|
|
||
|
BOOTDIR=boot
|
||
|
COMMDIR=kaleid/common
|
||
|
KERNDIR=kaleid/kernel
|
||
|
SYSTDIR=kaleid/system
|
||
|
LINXDIR=kaleid/common/test
|
||
|
|
||
|
all: bootloader kernel
|
||
|
|
||
|
boot.mbr.s: $(BOOTDIR)/mbr.s $(BOOTDIR)/mbr.inc
|
||
|
$(ASM) $(BOOTFLAGS) $(BOOTDIR)/mbr.asm -o $(OBJDIR)/boot/mbr.bin
|
||
|
|
||
|
boot.loader.s: $(BOOTDIR)/loader.s
|
||
|
$(ASM) $(BOOTFLAGS) $(BOOTDIR)/loader.asm -o $(OBJDIR)/boot/loader.bin
|
||
|
|
||
|
bootloader: boot.mbr.s boot.loader.s
|
||
|
cp $(OBJDIR)/boot/mbr.bin $(BINDIR)/mbr.bin
|
||
|
cp $(OBJDIR)/boot/loader.bin $(BINDIR)/loader.bin
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
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
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
COBJDIR=$(OBJDIR)/$(COMMDIR)
|
||
|
LOBJDIR=$(OBJDIR)/$(LINXDIR)
|
||
|
|
||
|
COMMOBJS=$(COBJDIR)/string.o $(COBJDIR)/status.o $(COBJDIR)/rand.o $(COBJDIR)/memory.o $(COBJDIR)/arith.o $(COBJDIR)/strtol.o $(COBJDIR)/itoa.o $(COBJDIR)/ltoa.o $(COBJDIR)/utoa.o $(COBJDIR)/ultoa.o $(COBJDIR)/atoi.o $(COBJDIR)/atol.o $(COBJDIR)/atou.o $(COBJDIR)/atoul.o
|
||
|
|
||
|
TCC=$(CC2NAME) $(COPTIM) $(CWARNS) $(CINCLUDES)
|
||
|
KCC=$(CC) -T ./build/kernel.ld -D_OSK_SOURCE -D_KALEID_KERNEL
|
||
|
|
||
|
comm-convert:
|
||
|
$(KCC) -c $(COMMDIR)/itoa.c -o $(COBJDIR)/itoa.o -D_NEED_ITOA
|
||
|
$(KCC) -c $(COMMDIR)/itoa.c -o $(COBJDIR)/ltoa.o -D_NEED_LTOA
|
||
|
$(KCC) -c $(COMMDIR)/itoa.c -o $(COBJDIR)/utoa.o -D_NEED_UTOA
|
||
|
$(KCC) -c $(COMMDIR)/itoa.c -o $(COBJDIR)/ultoa.o -D_NEED_ULTOA
|
||
|
$(KCC) -c $(COMMDIR)/atoi.c -o $(COBJDIR)/atoi.o -D_NEED_ATOI
|
||
|
$(KCC) -c $(COMMDIR)/atoi.c -o $(COBJDIR)/atol.o -D_NEED_ATOL
|
||
|
$(KCC) -c $(COMMDIR)/atoi.c -o $(COBJDIR)/atou.o -D_NEED_ATOU
|
||
|
$(KCC) -c $(COMMDIR)/atoi.c -o $(COBJDIR)/atoul.o -D_NEED_ATOUL
|
||
|
|
||
|
common: comm-convert
|
||
|
$(KCC) -c $(COMMDIR)/rand.c -o $(COBJDIR)/rand.o
|
||
|
$(KCC) -c $(COMMDIR)/arith.c -o $(COBJDIR)/arith.o
|
||
|
$(KCC) -c $(COMMDIR)/string.c -o $(COBJDIR)/string.o
|
||
|
$(KCC) -c $(COMMDIR)/status.c -o $(COBJDIR)/status.o
|
||
|
$(KCC) -c $(COMMDIR)/memory.c -o $(COBJDIR)/memory.o
|
||
|
$(KCC) -c $(COMMDIR)/strtol.c -o $(COBJDIR)/strtol.o
|
||
|
|
||
|
tests: common
|
||
|
$(TCC) -c $(LINXDIR)/test-common.c -o $(LOBJDIR)/test-common.o
|
||
|
$(TCC) $(COMMOBJS) $(LOBJDIR)/test-common.o -o $(BINDIR)/kaleid-common.elf
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
KOBJDIR=$(OBJDIR)/$(KERNDIR)
|
||
|
|
||
|
KERNOBJS=$(KOBJDIR)/init/init.o $(KOBJDIR)/init/table.o $(KOBJDIR)/ke/panic.o $(KOBJDIR)/ke/terminal.o
|
||
|
|
||
|
kernel: common
|
||
|
$(KCC) -c $(KERNDIR)/init/init.c -o $(KOBJDIR)/init/init.o
|
||
|
$(KCC) -c $(KERNDIR)/init/table.c -o $(KOBJDIR)/init/table.o
|
||
|
$(KCC) -c $(KERNDIR)/ke/panic.c -o $(KOBJDIR)/ke/panic.o
|
||
|
$(KCC) -c $(KERNDIR)/ke/terminal.c -o $(KOBJDIR)/ke/terminal.o
|
||
|
$(KCC) $(CLDSCR) $(COMMOBJS) $(KERNOBJS) -o $(BINDIR)/kaleid-kernel.elf
|