This repository has been archived by the owner on Feb 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
66 lines (50 loc) · 1.44 KB
/
Makefile
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
55
56
57
58
59
60
61
62
63
64
65
66
ASM=src/asm
LIBCORE=libcore
TARGET=target
LD="x86_64-pc-elf-ld"
MKRESCUE=grub-mkrescue
NASM=nasm
QEMU=qemu-system-x86_64
LIBCORE_URL=http://github.com/intermezzos/libcore
ISO=arOS.iso
KERNEL=kernel.bin
AROS_CFIG=x86_64-unknown-aros-gnu
BOOT_A=boot.asm
BOOT_O=boot.o
GRUB=grub.cfg
LINKER=linker.ld
MULTIBOOT_A=multiboot_header.asm
MULTIBOOT_O=multiboot_header.o
SRC_BOOT=$(ASM)/$(BOOT_A)
SRC_GRUB=$(ASM)/$(GRUB)
SRC_LINKER=$(ASM)/$(LINKER)
SRC_MULTIBOOT=$(ASM)/$(MULTIBOOT_A)
BUILD_BOOT=$(TARGET)/$(BOOT_O)
BUILD_ISO=$(TARGET)/$(ISO)
BUILD_KERNEL=$(TARGET)/$(KERNEL)
BUILD_LIBAROS=$(TARGET)/$(AROS_CFIG)/release/libaros.a
BUILD_LIBCORE=$(TARGET)/$(LIBCORE)
BUILD_LIBCORE_STATIC=$(TARGET)/$(LIBCORE)/$(TARGET)/$(AROS_CFIG)/libcore.rlib
BUILD_MULTIBOOT=$(TARGET)/$(MULTIBOOT_O)
default: build
build: $(BUILD_ISO)
run: $(BUILD_ISO)
$(QEMU) -cdrom $(BUILD_ISO)
$(BUILD_MULTIBOOT): $(SRC_MULTIBOOT)
mkdir -p $(TARGET)/
$(NASM) -f elf64 $< -o $@
$(BUILD_BOOT): $(SRC_BOOT)
mkdir -p $(TARGET)/
$(NASM) -f elf64 $< -o $@
$(BUILD_KERNEL): $(BUILD_MULTIBOOT) $(BUILD_BOOT) $(SRC_LINKER) xargo
$(LD) -n -o $@ -T $(SRC_LINKER) $(BUILD_MULTIBOOT) $(BUILD_BOOT) $(BUILD_LIBAROS)
$(BUILD_ISO): $(BUILD_KERNEL) $(SRC_GRUB)
mkdir -p $(TARGET)/isofiles/boot/grub
cp $(SRC_GRUB) $(TARGET)/isofiles/boot/grub
cp $< $(TARGET)/isofiles/boot/
$(MKRESCUE) -o $@ $(TARGET)/isofiles
xargo:
xargo build --release --target $(AROS_CFIG)
.PHONY: clean
clean:
xargo clean