48 lines
708 B
Makefile
48 lines
708 B
Makefile
CC=gcc
|
|
LD=ld -m elf_i386
|
|
CFLAGS=-m32
|
|
LDFLAGS=-m elf_i386 --entry=_kernelEntry -Ttext=0x100000
|
|
|
|
EXEC=kernel.bin
|
|
|
|
export CC
|
|
export LD
|
|
export CFLAGS
|
|
export LDFLAGS
|
|
|
|
all:$(EXEC)
|
|
|
|
#----- Kernel -----
|
|
$(EXEC):entry.o main.o GDT/gdt.o Helpers/helpers.o
|
|
$(LD) $(LDFLAGS) -o $@ $^
|
|
#-----------------
|
|
|
|
|
|
#----- Entry & Main-----
|
|
entry.o:entry.asm
|
|
nasm -f elf $^
|
|
main.o:main.c
|
|
$(CC) $(CFLAGS) -c $^ -o $@
|
|
#-----------------------
|
|
|
|
|
|
#----- GDT -----
|
|
GDT/gdt.o:
|
|
cd ./GDT && make
|
|
#---------------
|
|
|
|
#----- Helpers -----
|
|
Helpers/helpers.o:
|
|
cd ./Helpers/ && make
|
|
#---------------
|
|
|
|
|
|
#----- Other -----
|
|
.PHONY:clean
|
|
|
|
clean:
|
|
cd ./GDT/ && make clean
|
|
cd ./Helpers/ && make clean
|
|
-rm ./*.o
|
|
-rm ./$(EXEC)
|
|
#-----------------
|