2015-07-28 14:19:00 +04:00
|
|
|
CC=gcc
|
|
|
|
LD=ld -m elf_i386
|
|
|
|
CFLAGS=-m32
|
|
|
|
LDFLAGS=-m elf_i386 --entry=_kernelEntry -Ttext=0x100000
|
|
|
|
|
2015-07-20 17:18:27 +04:00
|
|
|
EXEC=kernel.bin
|
2015-07-19 11:52:01 +04:00
|
|
|
|
2015-07-28 14:19:00 +04:00
|
|
|
export CC
|
|
|
|
export LD
|
|
|
|
export CFLAGS
|
|
|
|
export LDFLAGS
|
2015-07-20 17:18:27 +04:00
|
|
|
|
|
|
|
all:$(EXEC)
|
2015-07-20 16:58:34 +04:00
|
|
|
|
|
|
|
#----- Kernel -----
|
2015-07-20 20:06:20 +04:00
|
|
|
$(EXEC):entry.o main.o GDT/gdt.o Helpers/helpers.o
|
2015-07-28 14:19:00 +04:00
|
|
|
$(LD) $(LDFLAGS) -o $@ $^
|
2015-07-20 16:58:34 +04:00
|
|
|
#-----------------
|
|
|
|
|
2015-07-19 11:52:01 +04:00
|
|
|
|
2015-07-20 16:58:34 +04:00
|
|
|
#----- Entry & Main-----
|
2015-07-19 11:52:01 +04:00
|
|
|
entry.o:entry.asm
|
|
|
|
nasm -f elf $^
|
2015-07-28 14:19:00 +04:00
|
|
|
main.o:main.c
|
|
|
|
$(CC) $(CFLAGS) -c $^ -o $@
|
2015-07-20 16:58:34 +04:00
|
|
|
#-----------------------
|
|
|
|
|
|
|
|
|
|
|
|
#----- GDT -----
|
2015-07-20 16:34:46 +04:00
|
|
|
GDT/gdt.o:
|
2015-07-20 16:58:34 +04:00
|
|
|
cd ./GDT && make
|
|
|
|
#---------------
|
|
|
|
|
2015-07-20 20:06:20 +04:00
|
|
|
#----- Helpers -----
|
|
|
|
Helpers/helpers.o:
|
|
|
|
cd ./Helpers/ && make
|
|
|
|
#---------------
|
2015-07-18 20:23:49 +04:00
|
|
|
|
2015-07-28 14:19:00 +04:00
|
|
|
|
2015-07-20 16:58:34 +04:00
|
|
|
#----- Other -----
|
2015-07-20 17:23:21 +04:00
|
|
|
.PHONY:clean
|
|
|
|
|
2015-07-18 20:23:49 +04:00
|
|
|
clean:
|
2015-07-20 16:34:46 +04:00
|
|
|
cd ./GDT/ && make clean
|
2015-07-22 13:22:53 +04:00
|
|
|
cd ./Helpers/ && make clean
|
2015-07-21 16:53:10 +04:00
|
|
|
-rm ./*.o
|
|
|
|
-rm ./$(EXEC)
|
2015-07-20 17:18:27 +04:00
|
|
|
#-----------------
|