StupidOS/Makefile

53 lines
920 B
Makefile
Raw Normal View History

2023-01-15 19:25:25 +00:00
.SUFFIXES:
.DELETE_ON_ERROR:
.DEFAULT_GOAL := all
2020-05-06 10:40:10 +00:00
2023-01-15 19:25:25 +00:00
AS = nasm
LD = ld.lld
OBJDUMP = llvm-objdump
2023-01-17 10:35:11 +00:00
QEMU = qemu-system-i386
2023-01-15 19:25:25 +00:00
RM = rm -f
2023-01-17 10:35:11 +00:00
MKCWD = mkdir -p $(@D)
INSTALL = install
2020-05-06 10:40:10 +00:00
2023-01-15 19:25:25 +00:00
BIN_DIR = bin
2023-01-17 10:35:11 +00:00
DOC_DIR = docs
2023-01-15 19:25:25 +00:00
KERNEL_DIR = kernel
LIB_DIR = lib
TOOLS_DIR = tools
2020-05-06 10:40:10 +00:00
2023-01-15 19:25:25 +00:00
include $(TOOLS_DIR)/build.mk
2020-05-06 10:40:10 +00:00
2023-01-20 13:17:11 +00:00
ASFLAGS = -DSTUPID_VERSION="\"$(shell $(GIT-VERSION))\"" -Ilib \
-DBUILD_DATE="\"$(shell date --iso)\"" \
-DNASM_VERSION="\"$(shell nasm -v)\""
2023-01-17 10:35:11 +00:00
QEMUFLAGS = -serial stdio
2023-01-15 19:25:25 +00:00
2023-01-17 10:35:11 +00:00
GARBADGE = stupid.iso
2023-01-15 19:25:25 +00:00
include $(KERNEL_DIR)/build.mk
2023-01-17 10:35:11 +00:00
include $(LIB_DIR)/build.mk
include $(BIN_DIR)/build.mk
2023-01-15 19:25:25 +00:00
2023-01-17 10:35:11 +00:00
all: stupid.iso
2020-05-06 10:40:10 +00:00
2023-01-17 10:35:11 +00:00
sysroot: $(KERNEL_BIN) $(KERNEL_DUMP) $(LIBS_BIN)
$(INSTALL) -d $@
$(INSTALL) -d $@/bin
$(INSTALL) -d $@/lib
$(INSTALL) $(KERNEL_BIN) $@
$(INSTALL) $(LIBS_BIN) $@/lib
2023-01-15 19:25:25 +00:00
2023-01-17 10:35:11 +00:00
stupid.iso: sysroot
$(CREATE-ISO) $@ $<
2023-01-15 19:25:25 +00:00
2023-01-17 10:35:11 +00:00
run: stupid.iso
$(QEMU) $(QEMUFLAGS) -cdrom $<
2023-01-15 19:25:25 +00:00
clean:
$(RM) $(GARBADGE)
2020-05-06 10:40:10 +00:00
2023-01-15 19:25:25 +00:00
re: clean all
2020-05-06 10:40:10 +00:00
2023-01-15 19:25:25 +00:00
.PHONY: all clean re