-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (24 loc) · 847 Bytes
/
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
NASMPARAMS = -felf32
GCCPARAMS = -nostdlib -MMD -Iinclude -std=gnu99 -ffreestanding -O2 -Wall -Wextra -Wno-unused-function -g
LDPARAMS = -ffreestanding -O2 -nostdlib -lgcc
CPATHS = ./drivers** ./include** ./kernel** ./lib**
SRCS := $(shell find $(CPATHS) -name "*.c")
all: build run
debug: build run_debug
clean:
@rm -rf ./build/*
boot:
@nasm $(NASMPARAMS) ./boot/boot.asm -o ./build/boot.o
gcc:
@$(foreach SRC,$(SRCS),i686-elf-gcc $(GCCPARAMS) -c $(SRC) -o ./build/$(notdir $(SRC:.c=.o));)
ld:
@i686-elf-gcc $(LDPARAMS) -T ./utils/linker.ld -o ./output/os.bin ./build/*.o
grub:
@cp ./output/os.bin ./utils/grub/boot/os.bin
@grub-mkrescue -o ./output/os.iso ./utils/grub
build: clean boot gcc ld grub
run:
@./utils/start.sh
run_debug:
@./utils/debug.sh
.PHONY: all debug boot gcc ld grub build debug run_debug