-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (40 loc) · 1.44 KB
/
Makefile
File metadata and controls
53 lines (40 loc) · 1.44 KB
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
FRAMEBUFFEROBJ = io/framebuffer.o io/io.o io/write.o io/serial.o io/log.o
MEMORYOBJ = memory/gdt.o memory/gdt_x86.o memory/idt.o memory/idt_x86.o
LIBOBJ = lib/string.o
OBJECTS = loader.o kmain.o $(FRAMEBUFFEROBJ) $(MEMORYOBJ)
CC = gcc
CFLAGS = -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles -nodefaultlibs -Wall -Wextra -Werror -c
LDFLAGS = -T link.ld -melf_i386
AS = nasm
ASFLAGS = -f elf
DEPENDENCIES = io memory
all: kernel
kernel: $(OBJECTS)
ld $(LDFLAGS) $(OBJECTS) -o kernel.elf
iso: kernel dependencies
cp kernel.elf iso/boot/kernel.elf
genisoimage -R \
-b boot/grub/stage2_eltorito \
-no-emul-boot \
-boot-load-size 4 \
-A os \
-input-charset utf8 \
-quiet \
-boot-info-table \
-o oreOS.iso \
iso
run: iso
bochs -f bochsrc.txt -q
%.o: %.c
$(CC) $(CFLAGS) $< -o $@
%.o: %.s
$(AS) $(ASFLAGS) $< -o $@
.PHONY: dependencies
dependencies: $(DEPENDENCIES)
-for d in $(DEPENDENCIES); do ( cd $$d; make all); done
.PHONY: clean
clean: clean_dependencies
rm -rf *.o kernel.elf oreOS.iso
.PHONY: clean_dependencies
clean_dependencies: $(DEPENDENCIES)
-for d in $(DEPENDENCIES); do ( cd $$d; make clean); done