os-k/Makefile

97 lines
3.8 KiB
Makefile
Raw Normal View History

2019-02-06 15:41:24 +01:00
#=----------------------------------------------------------------------------=#
# GNU GPL OS/K #
# #
# Desc: Project Makefile #
# #
# #
# 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-01-02 16:27:12 +01:00
kernel:
2019-01-15 14:18:56 +01:00
cpp ./Makefile.in > build/Makefile.out
2019-02-16 23:36:33 +01:00
python build/idttool.py
2019-01-15 14:18:56 +01:00
make kernel -f build/Makefile.out.2
rm build/Makefile.out build/Makefile.out.2
2019-01-02 16:27:12 +01:00
kernel-asm:
2019-01-15 14:18:56 +01:00
cpp -D_TO_ASM ./Makefile.in > build/Makefile.out
2019-02-16 23:36:33 +01:00
python build/idttool.py
2019-01-15 14:18:56 +01:00
make kernel -f build/Makefile.out.2
rm build/Makefile.out build/Makefile.out.2
2019-01-02 16:27:12 +01:00
tests:
2019-01-15 14:18:56 +01:00
cpp -D_TESTS ./Makefile.in > build/Makefile.out
2019-02-16 23:36:33 +01:00
python build/idttool.py
2019-01-15 14:18:56 +01:00
make tests -f build/Makefile.out.2
rm build/Makefile.out build/Makefile.out.2
#Programs
2019-01-14 23:16:26 +01:00
ASM=nasm
ASMFLAGS=
BOOTFLAGS=-f bin
#Folders
MBRDIR=boot/grub
2019-01-16 11:01:18 +01:00
LOADERDIR=boot/loader
2019-01-14 23:16:26 +01:00
OBJDIR=build/obj
BINDIR=build/bin
#Color codes
CL='\033[0;32m'
CL2='\033[1;31m'
CL3='\033[0m'
NC='\033[1;37m'
boot.mbr: $(BINDIR)/disk.img $(MBRDIR)/grub.cfg
@mkdir -p $(BINDIR)/disk
2019-03-04 22:34:07 +01:00
@echo ${CL2}[boot.mbr]${NC} Installing MBR on image...${CL3}
@$(MBRDIR)/grub-install.sh $(BINDIR)/disk.img $(BINDIR)/disk $(MBRDIR)/grub.cfg
@echo ${CL2}[boot.mbr]${CL} OK${CL3}
@rmdir $(BINDIR)/disk
2019-01-14 23:16:26 +01:00
2019-01-16 11:01:18 +01:00
boot.loader.asm: $(LOADERDIR)/loader.asm
@echo ${CL2}[boot.loader.asm]${NC} Making loader.bin...${CL3}
@$(ASM) $(BOOTFLAGS) $(LOADERDIR)/loader.asm -o $(OBJDIR)/boot/loader.bin > /dev/null
@echo ${CL2}[boot.loader.asm]${CL} OK${CL3}
2019-03-04 22:34:07 +01:00
loader: boot.loader.asm
@mkdir -p $(BINDIR)/disk
2019-03-04 22:34:07 +01:00
@echo ${CL2}[loader]${NC} Constructing kernel loader...${CL3}
@$(MBRDIR)/mount.sh $(BINDIR)/disk.img $(BINDIR)/disk
@cp $(OBJDIR)/boot/loader.bin $(BINDIR)/disk/boot/loader.bin
@$(MBRDIR)/umount.sh $(BINDIR)/disk
2019-03-04 22:34:07 +01:00
@echo ${CL2}[loader]${CL} OK${CL3}
@rmdir $(BINDIR)/disk
2019-01-14 23:16:26 +01:00
make_disk:
@echo ${CL2}[make_disk]${NC} Constructing disk image...${CL3}
@$(MBRDIR)/create_disk.sh $(BINDIR)/disk.img
@echo ${CL2}[make_disk]${CL} OK${CL3}
2019-01-14 23:16:26 +01:00
2019-03-04 22:50:35 +01:00
testloader: loader
2019-03-05 19:11:35 +01:00
@qemu-system-x86_64 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int -s -S -enable-kvm 2> qemu.log &
2019-03-04 22:50:35 +01:00
@ndisasm $(OBJDIR)/boot/loader.bin -b 32 > loader_dism.asm
2019-03-04 22:34:07 +01:00
boot: make_disk boot.mbr loader
@echo ${CL2}[[boot]]${CL} Terminated without error.${CL3}
2019-01-14 23:16:26 +01:00
all: boot kernel
@echo ${CL2}[[all]]${CL} Terminated without error.${CL3}
2019-03-04 22:34:07 +01:00