Newer
Older
tree-os / Makefile
@Lukas Lukas on 28 Mar 2021 879 bytes Initial commit after relocation
CC = i686-elf-gcc
CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../src/kernel
LD = i686-elf-ld
LDFLAGS = 
AS = nasm
ASFLAGS = -felf32
GENISO = genisoimage
GENISOFLAGS = -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -input-charset utf8 -quiet -boot-info-table -A tree-os
EMU = qemu-system-x86_64
EMUFLAGS = -m 256M -cdrom

default: run clean

run: tree-os.iso
	$(EMU) $(EMUFLAGS) $^

tree-os.iso: iso/boot/tree-os.elf
	$(GENISO) $(GENISOFLAGS) -o $@ iso

iso/boot/tree-os.elf: compile/boot.o compile/kernelFull.o
	$(LD) $(LDFLAGS) -o $@ $^

compile/boot.o: src/multiboot/boot.asm compile
	$(AS) $(ASFLAGS) -o $@ $<

compile/kernelFull.o: compile
	cd compile && all=$$(find ../src/kernel -name *.c) && $(CC) $(CCFLAGS) $$all && all=$$(find . -name '*.o') && $(LD) $(LDFLAGS) -r -o kernelFull.o $$all 

compile:
	mkdir compile

clean:
	rm -r compile