blob: d8535bc391b4e3565c8826187954c4e6e93955f8 (
plain) (
blame)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# The makefile
OS_NAME := emuos
export ARCH ?= x86_64
export SYSROOT = $(PWD)/sysroot
# Variables for easy access of tools like gcc and nasm
export CC = $(ARCH)-elf-gcc
export CXX = $(ARCH)-elf-g++
export AR = $(ARCH)-elf-ar
export NASM = nasm
QEMU = qemu-system-$(ARCH)
#ASMFLAGS = -felf32
#CXXFLAGS := -ffreestanding -O2 -Wall -Wextra -fno-exceptions -fno-rtti
#LDFLAGS := -ffreestanding -O2 -nostdlib
.PHONY: all limine clean build-all
all: build-all limine
build-all: kernel/kernel.bin libc/libc.a
libc/libc.a: install-headers
$(info [INFO] Building libc)
$(MAKE) -C ./libc/ all
kernel/kernel.bin: libc/libc.a install-headers
$(info [INFO] Building kernel)
$(MAKE) -C ./kernel/ all
limine: build-all
cp kernel/kernel.bin isodir/boot
xorriso -as mkisofs -b boot/limine/limine-bios-cd.bin \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot boot/limine/limine-uefi-cd.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
isodir -o emuos.iso
qemu: limine
$(QEMU) -no-shutdown -no-reboot --serial stdio -s -m 512 -hda $(OS_NAME).iso
install: install-headers install-libraries
install-headers:
$(MAKE) -C ./kernel/ install-headers
$(MAKE) -C ./libc/ install-headers
install-libraries:
$(MAKE) -C ./libc/ install-lib
clean:
-@$(MAKE) -C ./kernel/ clean
-@$(MAKE) -C ./libc/ clean
-@$(RM) $(wildcard *.bin *.a)
|