42_KFS/Makefile

42 lines
724 B
Makefile
Raw Normal View History

2024-09-06 18:36:03 -04:00
AS := i386-elf-as
ASFLAGS :=
CC := i386-elf-gcc
CCFLAGS := -std=gnu99 -ffreestanding -O2 -Wall -Wextra
LD := $(CC)
LDFLAGS := -T boot/linker.ld -ffreestanding -O2 -nostdlib
LIBS := -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 obj/
$(AS) $(ASFLAGS) $< -o $@
obj/%.o: src/%.c
mkdir -p obj/
$(CC) $(CCFLAGS) -c $< -o $@
$(NAME): $(OBJ)
mkdir -p build/
$(LD) $(LDFLAGS) -o build/$(NAME).bin $(OBJ) $(LIBS)
run: $(NAME)
qemu-system-i386 -kernel build/$(NAME).bin
clean:
rm -rf obj/
fclean: clean
rm -rf build/
re: fclean all
.PHONY: all clean fclean re run