summaryrefslogtreecommitdiff
path: root/Makefile
blob: eccede7c5bc4a50b1197ceb1b824697c0cb6775b (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
37
38
FILLES = ./build/kernel.asm.o ./build/kernel.o
INCLUDES= -I./src/include
FLAGS= -g -ffreestanding -falign-jumps -falign-functions	\
	-falign-labels -falign-loops -fstrength-reduce		\
	-fomit-frame-pointer -finline-functions			\
	-Wno-unused-function -fno-builtin -Werror		\
	-Wno-unused-label -Wno-cpp -Wno-unused-parameter	\
	-nostdlib -nostartfiles -nodefaultlibs -Wall -O0 -Iinc	\


BOOTLOADER=./src/boot/bootloader.asm
TARGET=./bin/boot.bin

all: ./bin/boot.bin ./bin/kernel.bin
	rm -rf ./bin/os.bin
	dd if=./bin/boot.bin >> ./bin/os.bin
	dd if=./bin/kernel.bin >> ./bin/os.bin
	dd if=/dev/zero bs=512 count=100 >> ./bin/os.bin
./bin/kernel.bin: ./build/kernel.asm.o ./build/kernel.o
	i686-elf-ld -g -relocatable ./build/kernel.asm.o ./build/kernel.o -o ./build/cemOS.o
	i686-elf-gcc $(FLAGS) -T ./src/linker.ld -o ./bin/kernel.bin -ffreestanding -O0 -nostdlib ./build/cemOS.o

./bin/boot.bin: ./src/boot/bootloader.asm
	nasm -f bin $(BOOTLOADER) -o $(TARGET)

./build/kernel.asm.o: ./src/kernel.asm
	nasm -f elf -g ./src/kernel.asm -o ./build/kernel.asm.o

./build/kernel.o: ./src/kernel.c
	i686-elf-gcc $(INCLUDES) $(FLAGS) -std=gnu99 -c ./src/kernel.c -o ./build/kernel.o

clean:
	rm -f $(TARGET)
	rm -f bin/kernel.bin
	rm -f build/cemOS.o
	rm -f build/kernel.asm.o
	rm -f build/kernel.o
	rm -f bin/os.bin