// -*- Mode: Makefile -*- //----------------------------------------------------------------------------// // GNU GPL OS/K // // // // Authors: spectral` // // NeoX // // // // Desc: Project Makefile // //----------------------------------------------------------------------------// // The madman's Makefile #include "build/preproc.h" CCNAME="/opt/cross-cc/bin/x86_64-elf-gcc" CC2NAME=gcc COPTIM=-O2 CWARNS=-Wall -Wextra // -Wshadow -Wpedantic CINCLUDES=-Ikaleid/include CFLAGS1=-nostdlib -ffreestanding -mcmodel=large // -std=gnu11 CFLAGS2=_ASMTYPE -mno-red-zone -mno-mmx -mno-sse -mno-sse2 CFLAGS=$(CFLAGS1) $(CFLAGS2) CC=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS) $(CINCLUDES) BINDIR=build/bin OBJDIR=build/obj BOOTDIR=boot COMMDIR=kaleid/crtlib KERNDIR=kaleid/kernel SYSTDIR=kaleid/system LINXDIR=kaleid/test //----------------------------------------------------------------------------# // 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) COMMOBJS=COBJ6(string, status, rand, memory, arith, strtol) COBJ4(itoa, ltoa, utoa, ultoa) COBJ4(atoi, atol, atou, atoul) COBJ2(../extras/prog, ../extras/argv) TCC=$(CC2NAME) $(COPTIM) $(CWARNS) $(CINCLUDES) KCC=$(CC) -D_KALEID_KERNEL comm-convert: 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 common: comm-convert COMPILE_COMMON(rand) COMPILE_COMMON(arith) COMPILE_COMMON(string) COMPILE_COMMON(status) COMPILE_COMMON(memory) COMPILE_COMMON(strtol) COMPILE_COMMON(../extras/prog) COMPILE_COMMON(../extras/argv) tests: common $(TCC) -c $(LINXDIR)/test-common.c -o $(LOBJDIR)/test-common.o $(TCC) $(COMMOBJS) $(LOBJDIR)/test-common.o -o $(BINDIR)/comm-test //----------------------------------------------------------------------------# // KERNEL MAKEFILE KOBJDIR=$(OBJDIR)/$(KERNDIR) KERNOBJS=KOBJ6(init/init, init/table, ke/panic, io/term, io/cursor, io/vga) kernel: common COMPILE_KERNEL(init/init) COMPILE_KERNEL(init/table) COMPILE_KERNEL(ke/panic) COMPILE_KERNEL(io/cursor) COMPILE_KERNEL(io/term) COMPILE_KERNEL(io/vga) LINK_KERNEL(kaleid-kernel.elf) //----------------------------------------------------------------------------#