finix/kernel/Makefile
Tyler Murphy 8ad6ef551e time
2023-07-16 19:56:56 -04:00

28 lines
604 B
Makefile

include ../.env
C_SRC = $(shell find src -type f -name "*.c")
C_OBJ = $(patsubst %.c,bin/%.o, $(C_SRC))
ASM_SRC = $(shell find src -type f -name "*.asm")
ASM_OBJ = $(patsubst %.asm,bin/%.asm.o, $(ASM_SRC))
CFLAGS += -Iinclude -Isrc -I../libk/include -std=gnu17
.PHONY: all
all: bin/kernel.bin
$(C_OBJ): bin/%.o : %.c
@mkdir -p $(@D)
$(CC) -c $(CFLAGS) -o $@ $<
$(ASM_OBJ): bin/%.asm.o : %.asm
@mkdir -p $(@D)
$(AS) $< -f elf -o $@
bin/kernel.bin: $(C_OBJ) $(ASM_OBJ)
@mkdir -p $(@D)
$(LD) -o bin/kernel.bin -T linker.ld $(C_OBJ) $(ASM_OBJ) ../libk/bin/libk.a $(LDFLAGS)
clean:
rm -fr bin