|
|
|
CXXFLAGS := -m32 -ggdb -g3 -O1 -fno-pic -fno-rtti -fno-exceptions -std=c++23 \
|
|
|
|
-Wall -Wextra -pedantic -Werror
|
|
|
|
LDFLAGS := $(CXXFLAGS) -T link.ld -static -nostdlib -fno-use-cxa-atexit
|
|
|
|
|
|
|
|
CXXFILES := $(wildcard src/*.cpp)
|
|
|
|
|
|
|
|
PROJECT := myos
|
|
|
|
PRJISO := $(PROJECT).iso
|
|
|
|
PRJBIN := $(PROJECT).bin
|
|
|
|
OBJS := $(patsubst src/%.cpp,out/%.o,$(CXXFILES))
|
|
|
|
|
|
|
|
all: $(PRJISO)
|
|
|
|
|
|
|
|
$(PRJISO): iso/boot/$(PRJBIN) iso/boot/grub/grub.cfg
|
|
|
|
@echo " ISO " $@
|
|
|
|
@grub-mkrescue -o $@ iso/
|
|
|
|
|
|
|
|
iso/boot/$(PRJBIN): $(OBJS) link.ld
|
|
|
|
@echo " LD " $@
|
|
|
|
@g++ $(LDFLAGS) -o $@ $(OBJS)
|
|
|
|
|
|
|
|
out/:
|
|
|
|
@mkdir out
|
|
|
|
|
|
|
|
out/%.o: src/%.cpp
|
|
|
|
@echo " CXX " $<
|
|
|
|
@g++ $(CXXFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo " CLEAN"
|
|
|
|
@rm -f $(OBJS) $(PRJBIN) $(PRJISO)
|
|
|
|
|
|
|
|
run: myos.iso
|
|
|
|
@echo " QEMU"
|
|
|
|
@qemu-system-i386 -drive file=$<,index=2,media=cdrom -monitor stdio -no-reboot #-s -S #-d int
|
|
|
|
|