42_KFS/Makefile
2024-09-07 01:44:40 +02:00

45 lines
847 B
Makefile

AS := i386-elf-as
ASFLAGS :=
CC := i386-elf-gcc
CCFLAGS := -std=gnu99 -ffreestanding -O2 -Wall -Wextra -iquotelibbozo/headers
LD := $(CC)
LDFLAGS := -T boot/linker.ld -ffreestanding -O2 -nostdlib
LIBS := ./libbozo/build/libbozo.a -lgcc
SSRC := $(wildcard src/*.s)
CSRC := $(wildcard src/*.c)
OBJ := $(patsubst src/%.c,obj/%.o,$(CSRC))\
$(patsubst src/%.s,obj/%.o,$(SSRC))
NAME := bozOS
all: $(NAME)
obj/%.o: src/%.s
mkdir -p $(dir $@)
$(AS) $(ASFLAGS) $< -o $@
obj/%.o: src/%.c
mkdir -p $(dir $@)
$(CC) $(CCFLAGS) -c $< -o $@
$(NAME): $(OBJ)
make -C libbozo
mkdir -p build/
$(LD) $(LDFLAGS) -o build/$(NAME).bin $(OBJ) $(LIBS)
run: $(NAME)
qemu-system-i386 -kernel build/$(NAME).bin
clean:
make -C libbozo clean
rm -rf obj/
fclean: clean
make -C libbozo fclean
rm -rf build/
re: fclean all
.PHONY: all clean fclean re run