BUILDDIR := build SOURCEDIR := src OBJECTDIR := obj NAME := bozOS AS := i386-elf-as ASFLAGS := CC := i386-elf-gcc CCFLAGS := -std=gnu99 -ffreestanding -O2 -Wall -Wextra -iquotelibbozo/headers -iquoteheaders -g LD := $(CC) LDFLAGS := -T boot/linker.ld -ffreestanding -O2 -nostdlib LIBS := -L libbozo/build/ -lbozo -lgcc SSRC := $(shell find $(SOURCEDIR) -name '*.s') CSRC := $(shell find $(SOURCEDIR) -name '*.c') OBJ := $(patsubst $(SOURCEDIR)/%.c,$(OBJECTDIR)/%.o,$(CSRC))\ $(patsubst $(SOURCEDIR)/%.s,$(OBJECTDIR)/%.o,$(SSRC)) all: $(NAME) $(OBJECTDIR)/%.o: $(SOURCEDIR)/%.s mkdir -p $(dir $@) $(AS) $(ASFLAGS) $< -o $@ $(OBJECTDIR)/%.o: $(SOURCEDIR)/%.c mkdir -p $(dir $@) $(CC) $(CCFLAGS) -c $< -o $@ $(NAME): $(OBJ) make -C libbozo mkdir -p $(BUILDDIR)/ $(LD) $(LDFLAGS) -o $(BUILDDIR)/$(NAME).bin $(OBJ) $(LIBS) run: $(NAME) qemu-system-i386 -kernel $(BUILDDIR)/$(NAME).bin iso: $(NAME) mkdir -p isodir/boot/grub cp $(BUILDDIR)/$(NAME).bin isodir/boot/bozOS.bin cp config/grub.cfg isodir/boot/grub/grub.cfg grub-mkrescue -o $(BUILDDIR)/bozOS.iso isodir rm -rf isodir run_iso: iso qemu-system-i386 -cdrom $(BUILDDIR)/bozOS.iso debug: iso qemu-system-i386 -s -S $(BUILDDIR)/bozOS.iso clean: make -C libbozo clean rm -rf $(OBJDIR) fclean: clean make -C libbozo fclean rm -rf $(BUILDDIR)/ re: fclean all .PHONY: all clean fclean re run iso run_iso