summaryrefslogtreecommitdiffhomepage
path: root/makefile
blob: 96badf620d736d2443c8c48c9c92bd9ffbce7ae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
CC			= clang
LD			= ld.lld
CCFLAGS		= --target=ppc64le -c -ffreestanding -fno-rtti -fno-exceptions -std=c++20 -D__HAVE_HCORE_APIS__ -D__hCore__ -I./ -I$(HOME)/
ASM			= nasm
ASMFLAGS	= -f elf64

# This file is the kernel, responsible of task management, memory, drivers and more.
KERNEL		= hKernel.bin

# The kernel entrypoint
ENTRY		= __KernelMain

# Where the text segment is.
TEXT		= 0x8000000

# we want a flat binary 
FMT			= binary

.PHONY: kernel-build
kernel-build:
	$(CC) $(CCFLAGS) Source/*.cxx HALKit/PowerPC/PCI/*.cxx Source/Network/*.cpp\
		Source/Storage/*.cxx HALKit/PowerPC/*.cpp HALKit/PowerPC/*.s
	mv *.o Obj/

.PHONY: kernel-link
kernel-link:
	$(LD) -e $(ENTRY) -Ttext $(TEXT) --oformat $(FMT) Obj/*.o -o $(KERNEL)

.PHONY: all
all: kernel-build kernel-link
	echo "[hKernel] you can now link it!"

.PHONY: kernel-clean
kernel-clean:
	rm -f Obj/*.o $(KERNEL)