2024-09-06 18:36:03 -04:00
|
|
|
AS := i386-elf-as
|
|
|
|
ASFLAGS :=
|
|
|
|
CC := i386-elf-gcc
|
2024-09-06 19:44:40 -04:00
|
|
|
CCFLAGS := -std=gnu99 -ffreestanding -O2 -Wall -Wextra -iquotelibbozo/headers
|
2024-09-06 18:36:03 -04:00
|
|
|
LD := $(CC)
|
|
|
|
LDFLAGS := -T boot/linker.ld -ffreestanding -O2 -nostdlib
|
2024-09-06 19:44:40 -04:00
|
|
|
LIBS := ./libbozo/build/libbozo.a -lgcc
|
2024-09-06 18:36:03 -04:00
|
|
|
|
|
|
|
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
|
2024-09-06 19:44:40 -04:00
|
|
|
mkdir -p $(dir $@)
|
2024-09-06 18:36:03 -04:00
|
|
|
$(AS) $(ASFLAGS) $< -o $@
|
|
|
|
|
|
|
|
obj/%.o: src/%.c
|
2024-09-06 19:44:40 -04:00
|
|
|
mkdir -p $(dir $@)
|
2024-09-06 18:36:03 -04:00
|
|
|
$(CC) $(CCFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
$(NAME): $(OBJ)
|
2024-09-06 19:44:40 -04:00
|
|
|
make -C libbozo
|
2024-09-06 18:36:03 -04:00
|
|
|
mkdir -p build/
|
|
|
|
$(LD) $(LDFLAGS) -o build/$(NAME).bin $(OBJ) $(LIBS)
|
|
|
|
|
|
|
|
run: $(NAME)
|
|
|
|
qemu-system-i386 -kernel build/$(NAME).bin
|
|
|
|
|
2024-09-07 05:56:18 -04:00
|
|
|
iso: $(NAME)
|
|
|
|
mkdir -p isodir/boot/grub
|
|
|
|
cp build/$(NAME).bin isodir/boot/bozOS.bin
|
|
|
|
cp config/grub.cfg isodir/boot/grub/grub.cfg
|
|
|
|
grub-mkrescue -o build/bozOS.iso isodir
|
|
|
|
|
|
|
|
run_iso: iso
|
|
|
|
qemu-system-i386 -cdrom build/bozOS.iso
|
|
|
|
|
2024-09-06 18:36:03 -04:00
|
|
|
clean:
|
2024-09-06 19:44:40 -04:00
|
|
|
make -C libbozo clean
|
2024-09-06 18:36:03 -04:00
|
|
|
rm -rf obj/
|
|
|
|
|
|
|
|
fclean: clean
|
2024-09-06 19:44:40 -04:00
|
|
|
make -C libbozo fclean
|
2024-09-06 18:36:03 -04:00
|
|
|
rm -rf build/
|
|
|
|
|
|
|
|
re: fclean all
|
|
|
|
|
2024-09-07 05:56:18 -04:00
|
|
|
.PHONY: all clean fclean re run iso run_iso
|