54 lines
1.1 KiB
Makefile
54 lines
1.1 KiB
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
|
|
|
|
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
|
|
|
|
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 iso run_iso
|