mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-24 22:50:28 +00:00
zealbooter: Backport build system improvements from limine-barebones
This commit is contained in:
parent
4f0cdcd551
commit
cca870c059
28 changed files with 25 additions and 19 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -15,4 +15,6 @@
|
|||
*.hdd
|
||||
*.o
|
||||
*.d
|
||||
/zealbooter/limine.h
|
||||
/zealbooter/src/limine.h
|
||||
/zealbooter/bin
|
||||
/zealbooter/obj
|
||||
|
|
|
@ -105,7 +105,7 @@ sudo cp limine/BOOTX64.EFI $TMPISODIR/EFI/BOOT/BOOTX64.EFI
|
|||
sudo cp limine/limine-uefi-cd.bin $TMPISODIR/Boot/Limine-UEFI-CD.BIN
|
||||
sudo cp limine/limine-bios-cd.bin $TMPISODIR/Boot/Limine-BIOS-CD.BIN
|
||||
sudo cp limine/limine-bios.sys $TMPISODIR/Boot/Limine-BIOS.SYS
|
||||
sudo cp ../zealbooter/zealbooter.elf $TMPISODIR/Boot/ZealBooter.ELF
|
||||
sudo cp ../zealbooter/bin/kernel $TMPISODIR/Boot/ZealBooter.ELF
|
||||
sudo cp ../zealbooter/Limine.CFG $TMPISODIR/Boot/Limine.CFG
|
||||
echo "Copying DVDKernel.ZXE over ISO Boot/Kernel.ZXE ..."
|
||||
sudo mv $TMPMOUNT/Tmp/DVDKernel.ZXE $TMPISODIR/Boot/Kernel.ZXE
|
||||
|
|
|
@ -3,7 +3,7 @@ override MAKEFLAGS += -rR
|
|||
|
||||
# This is the name that our final kernel executable will have.
|
||||
# Change as needed.
|
||||
override KERNEL := zealbooter.elf
|
||||
override KERNEL := kernel
|
||||
|
||||
# Convenience macro to reliably declare user overridable variables.
|
||||
define DEFAULT_VAR =
|
||||
|
@ -63,8 +63,8 @@ override CFLAGS += \
|
|||
|
||||
# Internal C preprocessor flags that should not be changed by the user.
|
||||
override CPPFLAGS := \
|
||||
-I. \
|
||||
-I./lib \
|
||||
-I src \
|
||||
-I src/lib \
|
||||
$(CPPFLAGS) \
|
||||
-MMD \
|
||||
-MP
|
||||
|
@ -89,43 +89,47 @@ override NASMFLAGS += \
|
|||
|
||||
# Use "find" to glob all *.c, *.S, and *.asm files in the tree and obtain the
|
||||
# object and header dependency file names.
|
||||
override CFILES := $(shell find -L . -type f -name '*.c')
|
||||
override ASFILES := $(shell find -L . -type f -name '*.S')
|
||||
override NASMFILES := $(shell find -L . -type f -name '*.asm')
|
||||
override OBJ := $(CFILES:.c=.c.o) $(ASFILES:.S=.S.o) $(NASMFILES:.asm=.asm.o)
|
||||
override HEADER_DEPS := $(CFILES:.c=.c.d) $(ASFILES:.S=.S.d)
|
||||
override CFILES := $(shell cd src && find -L . -type f -name '*.c')
|
||||
override ASFILES := $(shell cd src && find -L . -type f -name '*.S')
|
||||
override NASMFILES := $(shell cd src && find -L . -type f -name '*.asm')
|
||||
override OBJ := $(addprefix obj/,$(CFILES:.c=.c.o) $(ASFILES:.S=.S.o) $(NASMFILES:.asm=.asm.o))
|
||||
override HEADER_DEPS := $(addprefix obj/,$(CFILES:.c=.c.d) $(ASFILES:.S=.S.d))
|
||||
|
||||
# Default target.
|
||||
.PHONY: all
|
||||
all: $(KERNEL)
|
||||
all: bin/$(KERNEL)
|
||||
|
||||
limine.h:
|
||||
curl -Lo $@ https://github.com/limine-bootloader/limine/raw/trunk/limine.h || cp ../build/limine/limine.h limine.h || echo "ERROR"
|
||||
src/limine.h:
|
||||
curl -Lo $@ https://github.com/limine-bootloader/limine/raw/trunk/limine.h || cp ../build/limine/limine.h src/limine.h || echo "ERROR"
|
||||
|
||||
# Link rules for the final kernel executable.
|
||||
$(KERNEL): GNUmakefile linker.ld $(OBJ)
|
||||
bin/$(KERNEL): GNUmakefile linker.ld $(OBJ)
|
||||
mkdir -p "$$(dirname $@)"
|
||||
$(LD) $(OBJ) $(LDFLAGS) -o $@
|
||||
|
||||
# Include header dependencies.
|
||||
-include $(HEADER_DEPS)
|
||||
|
||||
# Compilation rules for *.c files.
|
||||
%.c.o: %.c GNUmakefile limine.h
|
||||
obj/%.c.o: src/%.c GNUmakefile src/limine.h
|
||||
mkdir -p "$$(dirname $@)"
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
||||
|
||||
# Compilation rules for *.S files.
|
||||
%.S.o: %.S GNUmakefile limine.h
|
||||
obj/%.S.o: src/%.S GNUmakefile src/limine.h
|
||||
mkdir -p "$$(dirname $@)"
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
||||
|
||||
# Compilation rules for *.asm (nasm) files.
|
||||
%.asm.o: %.asm GNUmakefile
|
||||
obj/%.asm.o: src/%.asm GNUmakefile
|
||||
mkdir -p "$$(dirname $@)"
|
||||
nasm $(NASMFLAGS) $< -o $@
|
||||
|
||||
# Remove object files and the final executable.
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(KERNEL) $(OBJ) $(HEADER_DEPS)
|
||||
rm -rf bin obj
|
||||
|
||||
.PHONY: distclean
|
||||
distclean: clean
|
||||
rm -f limine.h
|
||||
rm -f src/limine.h
|
||||
|
|
Loading…
Reference in a new issue