2019-02-06 14:07:38 +01:00
|
|
|
// -*- Mode: Makefile -*-
|
2019-02-06 15:41:24 +01:00
|
|
|
|
2019-02-16 23:36:33 +01:00
|
|
|
//----------------------------------------------------------------------------//
|
2019-01-02 17:19:13 +01:00
|
|
|
// GNU GPL OS/K //
|
|
|
|
// //
|
|
|
|
// Desc: Project Makefile //
|
2019-02-06 15:41:24 +01:00
|
|
|
// //
|
|
|
|
// //
|
|
|
|
// Copyright © 2018-2019 The OS/K Team //
|
|
|
|
// //
|
|
|
|
// This file is part of OS/K. //
|
|
|
|
// //
|
|
|
|
// OS/K is free software: you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or //
|
|
|
|
// any later version. //
|
|
|
|
// //
|
|
|
|
// OS/K is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
|
2019-02-16 23:36:33 +01:00
|
|
|
//----------------------------------------------------------------------------//
|
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
|
|
|
|
2019-03-11 19:22:37 +01:00
|
|
|
CCNAME=x86_64-elf-gcc
|
2019-01-02 16:27:12 +01:00
|
|
|
CC2NAME=gcc
|
|
|
|
COPTIM=-O2
|
2019-03-08 09:00:55 +01:00
|
|
|
CWARNS=-Wall -Wextra // -Werror=implicit-function-declaration
|
2019-02-06 14:07:38 +01:00
|
|
|
CINCLUDES=-Ikaleid/include
|
2019-01-02 16:27:12 +01:00
|
|
|
|
2019-02-06 14:07:38 +01:00
|
|
|
CFLAGS1=-nostdlib -ffreestanding -mcmodel=large // -std=gnu11
|
|
|
|
CFLAGS2=_ASMTYPE -mno-red-zone -mno-mmx -mno-sse -mno-sse2
|
2019-03-11 19:22:37 +01:00
|
|
|
CFLAGS=$(CFLAGS1) $(CFLAGS2) -DNDEBUG
|
2019-01-02 16:27:12 +01:00
|
|
|
|
2019-01-14 14:31:49 +01:00
|
|
|
CC=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS) $(CINCLUDES)
|
2019-01-02 16:27:12 +01:00
|
|
|
|
2019-02-06 14:07:38 +01:00
|
|
|
BINDIR=build/bin
|
|
|
|
OBJDIR=build/obj
|
2019-01-02 16:27:12 +01:00
|
|
|
|
|
|
|
BOOTDIR=boot
|
2019-01-21 11:07:11 +01:00
|
|
|
COMMDIR=kaleid/crtlib
|
2019-01-02 16:27:12 +01:00
|
|
|
KERNDIR=kaleid/kernel
|
|
|
|
SYSTDIR=kaleid/system
|
2019-02-06 14:07:38 +01:00
|
|
|
LINXDIR=kaleid/test
|
2019-01-02 16:27:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
// COMMON MAKEFILE
|
|
|
|
|
|
|
|
COBJDIR=$(OBJDIR)/$(COMMDIR)
|
|
|
|
LOBJDIR=$(OBJDIR)/$(LINXDIR)
|
|
|
|
|
2019-03-08 09:00:55 +01:00
|
|
|
COMMOBJS=COBJ6(string, status, rand, memory, strtol, sprintf) COBJ4(itoa, ltoa, utoa, ultoa) COBJ4(atoi, atol, atou, atoul) COBJ3(../extras/prog, ../extras/argv, ctype)
|
2019-01-02 16:27:12 +01:00
|
|
|
|
|
|
|
TCC=$(CC2NAME) $(COPTIM) $(CWARNS) $(CINCLUDES)
|
2019-03-08 09:00:55 +01:00
|
|
|
KCC=$(CC) -D_OSK_SOURCE -D_KALEID_KERNEL
|
2019-01-02 16:27:12 +01:00
|
|
|
|
|
|
|
comm-convert:
|
2019-03-11 19:22:37 +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
|
2019-03-11 19:22:37 +01:00
|
|
|
@COMPILE_COMMON(rand)
|
|
|
|
@COMPILE_COMMON(ctype)
|
|
|
|
@COMPILE_COMMON(string)
|
|
|
|
@COMPILE_COMMON(status)
|
|
|
|
@COMPILE_COMMON(memory) -fno-strict-aliasing
|
|
|
|
@COMPILE_COMMON(strtol)
|
|
|
|
@COMPILE_COMMON(sprintf)
|
|
|
|
@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
|
2019-02-06 14:07:38 +01:00
|
|
|
$(TCC) $(COMMOBJS) $(LOBJDIR)/test-common.o -o $(BINDIR)/comm-test
|
2019-01-02 16:27:12 +01:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------#
|
|
|
|
// KERNEL MAKEFILE
|
|
|
|
|
|
|
|
KOBJDIR=$(OBJDIR)/$(KERNDIR)
|
|
|
|
|
2019-02-06 14:07:38 +01:00
|
|
|
KERNOBJS=KOBJ6(init/init, init/table, ke/panic, io/term, io/cursor, io/vga)
|
2019-01-02 16:27:12 +01:00
|
|
|
|
|
|
|
kernel: common
|
2019-03-11 19:22:37 +01:00
|
|
|
@COMPILE_KERNEL(init/init)
|
|
|
|
@COMPILE_KERNEL(init/table)
|
|
|
|
@COMPILE_KERNEL(ke/panic)
|
|
|
|
@COMPILE_KERNEL(io/cursor)
|
|
|
|
@COMPILE_KERNEL(io/term)
|
|
|
|
@COMPILE_KERNEL(io/vga)
|
2019-03-08 08:43:44 +01:00
|
|
|
//LINK_KERNEL(kaleid-kernel.elf)
|
2019-01-02 16:27:12 +01:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------#
|
|
|
|
|