blob: 0dbfe3181e8b9799445f57816d5da8ca738d527d (
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
|
.POSIX:
.PHONY: all clean run
# QFLAGS = -machine type=pc,accel=kvm -cpu Broadwell-v3
CC = x86_64-elf-gcc
CFLAGS = -Wall -Wextra -std=c99 -pedantic -O2 -pipe \
-ffreestanding -mno-red-zone -mno-mmx -mno-sse -mno-sse2
LDFLAGS = -Wl,-O1 -T link.ld
LDLIBS = -lgcc -nostdlib
CSRC = kernel/main.c
FSRC = boot/boot.asm kernel/util.asm
OBJ = ${CSRC:.c=.o} ${FSRC:.asm=.o}
all: providence.img
boot/boot.o: boot/bios.inc boot/page.inc boot/segdesc.inc
kernel/main.o: kernel/util.h
providence.img: ${OBJ}
${CC} ${LDFLAGS} $^ ${LDLIBS} -o $@
@du -b $@
truncate -s 29696 $@
%.o: %.c
${CC} ${CFLAGS} -c -o $@ $<
%.o: %.asm
fasm $< $@
clean:
rm -f ${OBJ} providence.img
run: all
qemu-system-x86_64 ${QFLAGS} -drive file=providence.img,format=raw,index=0,media=disk
|