Compare commits
2 Commits
4e302452c1
...
bfaa31de54
Author | SHA1 | Date | |
---|---|---|---|
bfaa31de54 | |||
6cd9c377b2 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,2 @@
|
|||||||
build
|
build
|
||||||
obj
|
obj
|
||||||
isodir
|
|
37
Makefile
37
Makefile
@ -1,3 +1,9 @@
|
|||||||
|
BUILDDIR := build
|
||||||
|
SOURCEDIR := src
|
||||||
|
OBJECTDIR := obj
|
||||||
|
|
||||||
|
NAME := bozOS
|
||||||
|
|
||||||
AS := i386-elf-as
|
AS := i386-elf-as
|
||||||
ASFLAGS :=
|
ASFLAGS :=
|
||||||
CC := i386-elf-gcc
|
CC := i386-elf-gcc
|
||||||
@ -6,39 +12,42 @@ LD := $(CC)
|
|||||||
LDFLAGS := -T boot/linker.ld -ffreestanding -O2 -nostdlib
|
LDFLAGS := -T boot/linker.ld -ffreestanding -O2 -nostdlib
|
||||||
LIBS := ./libbozo/build/libbozo.a -lgcc
|
LIBS := ./libbozo/build/libbozo.a -lgcc
|
||||||
|
|
||||||
SSRC := $(wildcard src/*.s)
|
SSRC := $(wildcard $(SOURCEDIR)/*.s)
|
||||||
CSRC := $(wildcard src/*.c)
|
CSRC := $(wildcard $(SOURCEDIR)/*.c)
|
||||||
OBJ := $(patsubst src/%.c,obj/%.o,$(CSRC))\
|
OBJ := $(patsubst $(SOURCEDIR)/%.c,$(OBJECTDIR)/%.o,$(CSRC))\
|
||||||
$(patsubst src/%.s,obj/%.o,$(SSRC))
|
$(patsubst $(SOURCEDIR)/%.s,$(OBJECTDIR)/%.o,$(SSRC))
|
||||||
|
|
||||||
NAME := bozOS
|
|
||||||
|
|
||||||
all: $(NAME)
|
all: $(NAME)
|
||||||
|
|
||||||
obj/%.o: src/%.s
|
$(OBJECTDIR)/%.o: $(SOURCEDIR)/%.s
|
||||||
mkdir -p $(dir $@)
|
mkdir -p $(dir $@)
|
||||||
$(AS) $(ASFLAGS) $< -o $@
|
$(AS) $(ASFLAGS) $< -o $@
|
||||||
|
|
||||||
obj/%.o: src/%.c
|
$(OBJECTDIR)/%.o: $(SOURCEDIR)/%.c
|
||||||
mkdir -p $(dir $@)
|
mkdir -p $(dir $@)
|
||||||
$(CC) $(CCFLAGS) -c $< -o $@
|
$(CC) $(CCFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(NAME): $(OBJ)
|
$(NAME): $(OBJ)
|
||||||
make -C libbozo
|
make -C libbozo
|
||||||
mkdir -p build/
|
mkdir -p $(BUILDDIR)/
|
||||||
$(LD) $(LDFLAGS) -o build/$(NAME).bin $(OBJ) $(LIBS)
|
$(LD) $(LDFLAGS) -o $(BUILDDIR)/$(NAME).bin $(OBJ) $(LIBS)
|
||||||
|
|
||||||
run: $(NAME)
|
run: $(NAME)
|
||||||
qemu-system-i386 -kernel build/$(NAME).bin
|
qemu-system-i386 -kernel $(BUILDDIR)/$(NAME).bin
|
||||||
|
|
||||||
iso: $(NAME)
|
iso: $(NAME)
|
||||||
mkdir -p isodir/boot/grub
|
mkdir -p isodir/boot/grub
|
||||||
cp build/$(NAME).bin isodir/boot/bozOS.bin
|
cp $(BUILDDIR)/$(NAME).bin isodir/boot/bozOS.bin
|
||||||
cp config/grub.cfg isodir/boot/grub/grub.cfg
|
cp config/grub.cfg isodir/boot/grub/grub.cfg
|
||||||
grub-mkrescue -o build/bozOS.iso isodir
|
grub-mkrescue -o $(BUILDDIR)/bozOS.iso isodir
|
||||||
|
rm -rf isodir
|
||||||
|
|
||||||
run_iso: iso
|
run_iso: iso
|
||||||
qemu-system-i386 -cdrom build/bozOS.iso
|
qemu-system-i386 -cdrom $(BUILDDIR)/bozOS.iso
|
||||||
|
|
||||||
|
debug: iso
|
||||||
|
qemu-system-i386 -s -S $(BUILDDIR)/bozOS.iso
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
make -C libbozo clean
|
make -C libbozo clean
|
||||||
@ -46,7 +55,7 @@ clean:
|
|||||||
|
|
||||||
fclean: clean
|
fclean: clean
|
||||||
make -C libbozo fclean
|
make -C libbozo fclean
|
||||||
rm -rf build/
|
rm -rf $(BUILDDIR)/
|
||||||
|
|
||||||
re: fclean all
|
re: fclean all
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user