-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
46 lines (36 loc) · 1.08 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
C_FLAGS := -ffreestanding -nostdlib -nostdinc -fno-builtin -fstrength-reduce -fomit-frame-pointer -Iinclude -Ilib
TARGET := kernel.bin
BUILD_DIR := build
OBJECTS := $(BUILD_DIR)/main.o \
$(BUILD_DIR)/gdt.o \
$(BUILD_DIR)/idt.o \
$(BUILD_DIR)/irq.o \
$(BUILD_DIR)/io.o \
$(BUILD_DIR)/isrs.o \
$(BUILD_DIR)/timer.o \
$(BUILD_DIR)/terminal.o \
$(BUILD_DIR)/cmos.o \
$(BUILD_DIR)/keyboard.o \
$(BUILD_DIR)/memory.o \
$(BUILD_DIR)/string.o \
$(BUILD_DIR)/pmm.o \
$(BUILD_DIR)/shell.o \
$(BUILD_DIR)/start.o
$(BUILD_DIR)/$(TARGET): $(OBJECTS)
i686-elf-gcc $^ -o $@ $(C_FLAGS) -T link.ld
$(BUILD_DIR)/%.o: %.c
i686-elf-gcc -c $< -o $@ $(C_FLAGS)
$(BUILD_DIR)/%.o: cpu/%.c
i686-elf-gcc -c $< -o $@ $(C_FLAGS)
$(BUILD_DIR)/%.o: devices/%.c
i686-elf-gcc -c $< -o $@ $(C_FLAGS)
$(BUILD_DIR)/%.o: lib/memory/%.c
i686-elf-gcc -c $< -o $@ $(C_FLAGS)
$(BUILD_DIR)/%.o: lib/string/%.c
i686-elf-gcc -c $< -o $@ $(C_FLAGS)
$(BUILD_DIR)/%.o: %.asm
nasm -f elf32 -o $@ $<
run: $(BUILD_DIR)/$(TARGET)
qemu-system-x86_64w -kernel $< -m 128 -rtc base=localtime
clean:
del /q .\build\*.*