Merge branch 'main' of git.chauvet.pro:starnakin/42_KFS
This commit is contained in:
commit
ce350a946c
44
Makefile
44
Makefile
@ -1,3 +1,9 @@
|
||||
BUILDDIR := build
|
||||
SOURCEDIR := src
|
||||
OBJECTDIR := obj
|
||||
|
||||
NAME := bozOS
|
||||
|
||||
AS := i386-elf-as
|
||||
ASFLAGS :=
|
||||
CC := i386-elf-gcc
|
||||
@ -6,39 +12,51 @@ 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))
|
||||
SSRC := $(wildcard $(SOURCEDIR)/*.s)
|
||||
CSRC := $(wildcard $(SOURCEDIR)/*.c)
|
||||
OBJ := $(patsubst $(SOURCEDIR)/%.c,$(OBJECTDIR)/%.o,$(CSRC))\
|
||||
$(patsubst $(SOURCEDIR)/%.s,$(OBJECTDIR)/%.o,$(SSRC))
|
||||
|
||||
NAME := bozOS
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
obj/%.o: src/%.s
|
||||
$(OBJECTDIR)/%.o: $(SOURCEDIR)/%.s
|
||||
mkdir -p $(dir $@)
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
|
||||
obj/%.o: src/%.c
|
||||
$(OBJECTDIR)/%.o: $(SOURCEDIR)/%.c
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) $(CCFLAGS) -c $< -o $@
|
||||
|
||||
$(NAME): $(OBJ)
|
||||
make -C libbozo
|
||||
mkdir -p build/
|
||||
$(LD) $(LDFLAGS) -o build/$(NAME).bin $(OBJ) $(LIBS)
|
||||
mkdir -p $(BUILDDIR)/
|
||||
$(LD) $(LDFLAGS) -o $(BUILDDIR)/$(NAME).bin $(OBJ) $(LIBS)
|
||||
|
||||
run: $(NAME)
|
||||
qemu-system-i386 -kernel build/$(NAME).bin
|
||||
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 obj/
|
||||
rm -rf $(OBJDIR)
|
||||
|
||||
fclean: clean
|
||||
make -C libbozo fclean
|
||||
rm -rf build/
|
||||
rm -rf $(BUILDDIR)/
|
||||
|
||||
re: fclean all
|
||||
|
||||
.PHONY: all clean fclean re run
|
||||
.PHONY: all clean fclean re run iso run_iso
|
||||
|
3
config/grub.cfg
Normal file
3
config/grub.cfg
Normal file
@ -0,0 +1,3 @@
|
||||
menuentry "bozos" {
|
||||
multiboot /boot/bozOS.bin
|
||||
}
|
Loading…
Reference in New Issue
Block a user