2024-09-07 06:04:57 -04:00
|
|
|
NAME := bozOS
|
|
|
|
|
2024-09-06 18:36:03 -04:00
|
|
|
AS := i386-elf-as
|
|
|
|
ASFLAGS :=
|
|
|
|
CC := i386-elf-gcc
|
2024-11-16 08:56:05 -05:00
|
|
|
CFLAGS := -std=gnu99 -ffreestanding -Wall -Wextra -iquotelibbozo/headers -iquoteheaders -MMD -fno-omit-frame-pointer -fstack-protector-all -g
|
2024-09-06 18:36:03 -04:00
|
|
|
LD := $(CC)
|
2024-09-17 05:10:41 -04:00
|
|
|
LDFLAGS := -T boot/linker.ld -ffreestanding -nostdlib
|
2024-09-07 23:03:50 -04:00
|
|
|
LIBS := -L libbozo/build/ -lbozo -lgcc
|
2024-09-06 18:36:03 -04:00
|
|
|
|
2024-09-08 09:32:47 -04:00
|
|
|
SSRC := $(shell find src -name '*.s')
|
|
|
|
CSRC := $(shell find src -name '*.c')
|
|
|
|
OBJ := $(patsubst src/%.c,obj/%.o,$(CSRC))\
|
|
|
|
$(patsubst src/%.s,obj/%.o,$(SSRC))
|
|
|
|
DEP := $(patsubst %.o,%.d,$(OBJ))
|
2024-09-06 18:36:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
all: $(NAME)
|
|
|
|
|
2024-09-08 09:32:47 -04:00
|
|
|
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 $@
|
|
|
|
|
2024-09-08 09:32:47 -04:00
|
|
|
obj/%.o: src/%.c
|
2024-09-06 19:44:40 -04:00
|
|
|
mkdir -p $(dir $@)
|
2024-09-08 09:32:47 -04:00
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
2024-09-06 18:36:03 -04:00
|
|
|
|
|
|
|
$(NAME): $(OBJ)
|
2024-09-06 19:44:40 -04:00
|
|
|
make -C libbozo
|
2024-09-08 09:32:47 -04:00
|
|
|
mkdir -p build
|
|
|
|
$(LD) $(LDFLAGS) -o build/$(NAME).bin $(OBJ) $(LIBS)
|
2024-09-06 18:36:03 -04:00
|
|
|
|
|
|
|
run: $(NAME)
|
2024-12-03 04:41:39 -05:00
|
|
|
qemu-system-i386 -kernel build/$(NAME).bin -vga std
|
2024-09-06 18:36:03 -04:00
|
|
|
|
2024-09-07 05:56:18 -04:00
|
|
|
iso: $(NAME)
|
|
|
|
mkdir -p isodir/boot/grub
|
2024-09-08 09:32:47 -04:00
|
|
|
cp build/$(NAME).bin isodir/boot/$(NAME).bin
|
2024-09-07 05:56:18 -04:00
|
|
|
cp config/grub.cfg isodir/boot/grub/grub.cfg
|
2024-09-22 04:13:13 -04:00
|
|
|
grub-mkrescue -o build/$(NAME).iso --compress=xz --locales=en@quot --themes= isodir
|
2024-09-07 06:04:57 -04:00
|
|
|
rm -rf isodir
|
2024-09-07 05:56:18 -04:00
|
|
|
|
2024-09-08 09:32:47 -04:00
|
|
|
run-iso: iso
|
2024-12-03 04:41:39 -05:00
|
|
|
qemu-system-i386 -cdrom build/$(NAME).iso -vga std
|
2024-09-07 06:04:57 -04:00
|
|
|
|
|
|
|
debug: iso
|
2024-12-03 04:41:39 -05:00
|
|
|
qemu-system-i386 -s -S build/$(NAME).iso -vga std
|
2024-09-06 18:36:03 -04:00
|
|
|
|
|
|
|
clean:
|
2024-09-06 19:44:40 -04:00
|
|
|
make -C libbozo clean
|
2024-09-08 09:32:47 -04:00
|
|
|
rm -rf isodir
|
|
|
|
rm -rf obj
|
2024-09-06 18:36:03 -04:00
|
|
|
|
|
|
|
fclean: clean
|
2024-09-06 19:44:40 -04:00
|
|
|
make -C libbozo fclean
|
2024-09-08 09:32:47 -04:00
|
|
|
rm -rf build
|
2024-09-06 18:36:03 -04:00
|
|
|
|
2024-11-16 08:56:05 -05:00
|
|
|
re:
|
|
|
|
$(MAKE) fclean
|
|
|
|
$(MAKE) all
|
2024-09-06 18:36:03 -04:00
|
|
|
|
2024-09-08 09:32:47 -04:00
|
|
|
.PHONY: all clean fclean re run iso run-iso
|
|
|
|
-include $(DEP)
|