summaryrefslogtreecommitdiff
path: root/test/Makefile
blob: 2cfdf95b753d55eb0395a11694b1023c74b28f1d (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
36
#
# Copyright (c) 2026, Apollo Telephone Laboratories.
# Provided under the BSD-3 clause.
#

IMG_PATH = sboot.img

CC = clang
LD = ld.lld
OBJCOPY = llvm-objcopy

CFLAGS =			\
	-Wall			\
	-pedantic		\
	-ffreestanding	\
	-mno-red-zone	\
	-mno-avx		\
	-mno-avx2		\
	-mno-sse2		\
	-nostdlib		\
	-nostdinc

.PHONY: all
all: test
	rm -f $(IMG_PATH)
	mkfs.fat -C $(IMG_PATH) 4096
	mmd -i $(IMG_PATH) ::/EFI
	mmd -i $(IMG_PATH) ::/EFI/BOOT
	mcopy -i $(IMG_PATH) kernel.bin ::
	mcopy -i $(IMG_PATH) ../BOOTX64.EFI ::EFI/BOOT

.PHONY: test
test:
	$(CC) -c $(CFLAGS) test.c -o test.o
	$(LD) -Tlink.ld test.o -o kernel.sys
	$(OBJCOPY) -O binary kernel.sys kernel.bin