# # Roo/E, the Kangaroo Punch Portable GUI Toolkit # Copyright (C) 2026 Scott Duensing # # http://kangaroopunch.com # # # This file is part of Roo/E. # # Roo/E is free software: you can redistribute it and/or modify it under the # terms of the GNU Affero General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) # any later version. # # Roo/E is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License # along with Roo/E. If not, see . # # Tools CC := gcc AR := ar DXE3GEN := dxe3gen EXE2COFF := exe2coff # Compiler Settings CFLAGS := -DPLATFORM_DOS -Wall LDFLAGS := # Output Directories OBJ := obj BIN := bin DYN := $(BIN)/dyn APP := $(BIN)/app SDK := $(BIN)/sdk FNT := $(BIN)/fonts FIN := font/in # Include Paths INC := ../include include 3rdparty 3rdparty/pthreads/include # Font Compiler Source and Target - NOTE: This is a Linux binary! FONT_ELF := font FONT_SRC := $(shell find font/src -name '*.c') FONT_OBJ := $(FONT_SRC:%=$(OBJ)/%.o) FONT_LIB := -lm # Roo/E Dynamic Libraries DYNS_EXE := stbimage.dyn DYNS_SRC := $(shell find dyn/stbimage -name '*.c') DYNS_OBJ := $(DYNS_SRC:%=$(OBJ)/%.o) DYNS_LIB := # Roo/E Source and Target ROOE_EXE := roo_e.exe ROOE_SRC := $(shell find roo_e -name '*.c') ROOE_OBJ := $(ROOE_SRC:%=$(OBJ)/%.o) ROOE_LIB := 3rdparty/pthreads/lib/libgthreads.a -lgcc # MultiPlayer Game Client MPGC_EXE := kpsmpgc.app MPGC_SRC := $(shell find kpsmpgc -name '*.c') MPGC_OBJ := $(MPGC_SRC:%=$(OBJ)/%.o) MPGC_LIB := FONTS := $(FNT)/vga4x8.fnt $(FNT)/vga8x8.fnt $(FNT)/vga8x14.fnt $(FNT)/vga8x16.fnt # Wiring FONT_PNGS := $(subst $(FNT),$(FIN),$(FONTS)) FONT_PNGS := $(subst .fnt,.png,$(FONTS_PNGS)) INC_FLAGS := $(addprefix -I,$(INC)) CFLAGS += $(INC_FLAGS) # Force User to Run This Using Toolchains .PHONY: use_build_script use_build_script: @echo "Use build.sh to cross-compile, not make." # Build Everything .PHONY: dos dos: $(BIN)/$(ROOE_EXE) $(APP)/$(MPGC_EXE) $(DYN)/$(DYNS_EXE) .PHONY: linux linux: $(FONTS) # Remove Everything .PHONY: clean clean: rm -rf $(OBJ) $(BIN) # Font Compiler Target $(BIN)/$(FONT_ELF): $(FONT_OBJ) Makefile mkdir -p $(dir $@) $(BIN)/fonts $(CC) $(FONT_OBJ) -o $@ $(LDFLAGS) $(FONT_LIB) $(FONTS) &: $(FIN)/vga4x8.png $(FIN)/vga4x8.png $(FIN)/vga4x8.png $(FIN)/vga4x8.png $(BIN)/$(FONT_ELF) cd $(BIN) && ./$(FONT_ELF) # Roo/E Target $(BIN)/$(ROOE_EXE): $(ROOE_OBJ) Makefile mkdir -p $(dir $@) $(CC) $(ROOE_OBJ) -o $@ $(LDFLAGS) $(ROOE_LIB) # Embed the DPMI Server $(EXE2COFF) $(BIN)/$(ROOE_EXE) cat 3rdparty/CWSDPMI/CWSDSTUB.EXE $(basename $(BIN)/$(ROOE_EXE)) > $(BIN)/$(ROOE_EXE) rm $(basename $(BIN)/$(ROOE_EXE)) # MPGC Target $(APP)/$(MPGC_EXE): $(MPGC_OBJ) Makefile mkdir -p $(dir $@) $(DXE3GEN) -o $@ $(MPGC_OBJ) -U $(LDFLAGS) $(MPGC_LIB) # DYNS Target $(DYN)/$(DYNS_EXE): $(DYNS_OBJ) Makefile mkdir -p $(dir $@) $(AR) rcs $(OBJ)/$(DYNS_EXE).a $(DYNS_OBJ) $(DXE3GEN) -o $@ -Y $@.a --whole-archive -U $(OBJ)/$(DYNS_EXE).a $(LDFLAGS) $(DYNS_LIB) mkdir -p $(SDK) mv $(DYN)/$(DYNS_EXE).a $(SDK)/. # Build C Files $(OBJ)/%.c.o: %.c mkdir -p $(dir $@) $(CC) $(CFLAGS) -c $< -o $@