-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
30 lines (25 loc) · 824 Bytes
/
makefile
File metadata and controls
30 lines (25 loc) · 824 Bytes
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
.PHONY: all
all: assembly bkernel link start clean
CC = gcc
NASM = nasm
LD = ld
CFLAGS = -Wno-builtin-declaration-mismatch -fno-stack-protector -m32 -c
LDFLAGS = -m elf_i386
ASMFLAGS = -f elf32
assembly:
$(NASM) $(ASMFLAGS) boot.asm -o boot.o
bkernel:
if [ -e "objs.txt" ]; then rm objs.txt; fi;
$(CC) -c main.c -o kernel.o $(CFLAGS)
echo -n "boot.o kernel.o " >> objs.txt
cd arch && $(MAKE) $(MFLAGS)
cd lib && $(MAKE) $(MFLAGS)
cd display && $(MAKE) $(MFLAGS)
cd memory && $(MAKE) $(MFLAGS)
link:
$(LD) $(LDFLAGS) -T link.ld -o niallos kernel.o boot.o lib/string.o arch/gdt.o arch/idt.o arch/interrupt_handlers.o display/display.o memory/malloc.o memory/paging.o
start:
qemu-system-i386 -kernel niallos
clean:
@$(foreach obj, $(shell cat objs.txt), rm -f $(obj);)
rm objs.txt