From 8361bb0775527fb178578c625095a95106c1f8c2 Mon Sep 17 00:00:00 2001 From: seclorum Date: Fri, 31 Jul 2026 21:40:57 +0200 Subject: [PATCH 1/9] Update all Makefiles in the project to use gcc/g++-14 on MacOS (Darwin), fix ask_name() functions to not be Windows-only, update FloppyBuilder to remove c++-20-style code (only one line!) --- Makefile | 36 ++++++++++- osdk/main/FloppyBuilder/Floppy.cpp | 12 +++- osdk/main/FloppyBuilder/Makefile | 29 +++++++-- osdk/main/MemMap/Makefile | 30 ++++++--- osdk/main/TapTool/Makefile | 30 ++++++--- osdk/main/TapTool/sources/TapTool.cpp | 40 +++++++++--- osdk/main/Ym2Mym/Makefile | 29 ++++++--- osdk/main/bas2tap/Makefile | 31 +++++++--- osdk/main/bin2txt/Makefile | 29 ++++++--- osdk/main/common/Makefile | 30 ++++++--- osdk/main/compiler/sources/input.c | 2 +- osdk/main/compiler/sources/main.c | 2 +- osdk/main/compiler/sources/output.c | 2 +- osdk/main/compiler/sources/profio.c | 2 +- osdk/main/header/Makefile | 29 ++++++--- osdk/main/link65/Makefile | 28 ++++++--- osdk/main/macrosplitter/Makefile | 30 ++++++--- osdk/main/pictconv/Makefile | 61 ++++++++++++++----- .../pictconv/sources/dither_riemersma.cpp | 2 +- osdk/main/tap2cd/Makefile | 30 ++++++--- osdk/main/tap2cd/sources/tap2cd.c | 37 ++++++++--- rules.mk | 21 +++++-- .../freeimage/v3.12.0/Makefile.osx | 8 +-- .../soloud/src/backend/miniaudio/miniaudio.h | 2 +- 24 files changed, 419 insertions(+), 133 deletions(-) diff --git a/Makefile b/Makefile index 7213e100..31f0fece 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,39 @@ +# --------------------------------------------------------------- +# Compiler selection (prefer Homebrew GCC if available) +# --------------------------------------------------------------- +CXX ?= g++-14 # or g++-15 / g++-16 if you prefer +CC ?= gcc-14 + +# --------------------------------------------------------------- +# Base flags +# --------------------------------------------------------------- +CFLAGS = -Wall -D_DEBUG -D__cdecl= -DPOSIX -Iincludes +CXXFLAGS = -Wall -D_DEBUG -D__cdecl= -DPOSIX -Iincludes +LDFLAGS = + +# --------------------------------------------------------------- +# macOS-specific adjustments +# --------------------------------------------------------------- +UNAME_S := $(shell uname -s) + +ifeq ($(UNAME_S),Darwin) + # Force C++14 (required for multi-statement constexpr) + CXXFLAGS += -std=c++14 + + # Optional but useful for older codebases on modern macOS + CFLAGS += -Wno-implicit-function-declaration + CXXFLAGS += -Wno-implicit-function-declaration + + # Uncomment if you still hit C23 keyword problems in C files + # CFLAGS += -std=gnu99 +endif + +# Make sure the sub-makes see the flags +export CC CXX CFLAGS CXXFLAGS LDFLAGS + SUBDIRS := shared_libraries euphoric_tools osdk all install clean: @for d in $(SUBDIRS); do \ - $(MAKE) -C "$$d" $(MAKECMDGOALS) || exit $?; \ + $(MAKE) -C "$$d" $(MAKECMDGOALS) || exit $$?; \ done - diff --git a/osdk/main/FloppyBuilder/Floppy.cpp b/osdk/main/FloppyBuilder/Floppy.cpp index 3eeaceb3..e769d5a9 100644 --- a/osdk/main/FloppyBuilder/Floppy.cpp +++ b/osdk/main/FloppyBuilder/Floppy.cpp @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include #include // C++20 @@ -889,10 +891,18 @@ void Floppy::MarkCurrentSectorUsed() bool Floppy::SaveDescription(const char* fileName) const { + auto now = std::chrono::system_clock::now(); + std::time_t t = std::chrono::system_clock::to_time_t(now); std::stringstream layoutInfo; layoutInfo << "//\n"; - layoutInfo << "// Floppy layout generated by FloppyBuilder " << TOOL_VERSION_MAJOR << "." << TOOL_VERSION_MINOR << " on " << std::format("{:%Y-%m-%d %H:%M:%S}", std::chrono::floor(std::chrono::system_clock::now())) << "\n"; + + layoutInfo << "// Floppy layout generated by FloppyBuilder " + << TOOL_VERSION_MAJOR << "." + << TOOL_VERSION_MINOR + << " on " + << std::put_time(std::localtime(&t), "%Y-%m-%d %H:%M:%S") + << "\n"; if (!m_AllFilesAreResolved) { diff --git a/osdk/main/FloppyBuilder/Makefile b/osdk/main/FloppyBuilder/Makefile index b7deaeea..7553563f 100644 --- a/osdk/main/FloppyBuilder/Makefile +++ b/osdk/main/FloppyBuilder/Makefile @@ -1,19 +1,36 @@ include ../../../rules.mk -CPPFLAGS += -Wall -Iincludes +# ------------------------------------------------------------------ +# Force Homebrew GCC on macOS – never use system g++ (Apple Clang) +# Note: FloppyBuilder uses and requires c++-20 features +# ------------------------------------------------------------------ +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + CXX := g++-14 + CC := gcc-14 +endif +CPPFLAGS += -Wall -Iincludes CPPFLAGS += -I ../common/includes -LDLIBS += -lstdc++ -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) + +LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) + +CXXFLAGS += -Wno-unknown-pragmas SOURCES=FloppyBuilder.cpp Floppy.cpp -OBJECTS=$(SOURCES:.cpp=.o) -EXECUTABLE=FloppyBuilder$(EXE) +OBJECTS = $(SOURCES:.cpp=.o) +EXECUTABLE = FloppyBuilder$(EXE) -all: $(SOURCES) $(EXECUTABLE) +.PHONY: all clean + +all: $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ + +sources/Link65.o: sources/Link65.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< clean: rm -f $(EXECUTABLE) $(OBJECTS) - diff --git a/osdk/main/MemMap/Makefile b/osdk/main/MemMap/Makefile index 4137041a..029edc5c 100644 --- a/osdk/main/MemMap/Makefile +++ b/osdk/main/MemMap/Makefile @@ -1,21 +1,35 @@ include ../../../rules.mk -CPPFLAGS += -Wall -Iincludes -CPPFLAGS += -Wno-unknown-pragmas +# ------------------------------------------------------------------ +# Force Homebrew GCC on macOS – never use system g++ (Apple Clang) +# ------------------------------------------------------------------ +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + CXX := g++-14 + CC := gcc-14 +endif +CPPFLAGS += -Wall -Iincludes CPPFLAGS += -I ../common/includes -LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) + +LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) + +CXXFLAGS += -Wno-unknown-pragmas SOURCES=sources/memmap.cpp -OBJECTS=$(SOURCES:.cpp=.o) -EXECUTABLE=memmap$(EXE) +OBJECTS = $(SOURCES:.cpp=.o) +EXECUTABLE = memmap$(EXE) -all: $(SOURCES) $(EXECUTABLE) +.PHONY: all clean + +all: $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) - $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ + +sources/Link65.o: sources/Link65.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< clean: rm -f $(EXECUTABLE) $(OBJECTS) - diff --git a/osdk/main/TapTool/Makefile b/osdk/main/TapTool/Makefile index 9b65aff9..dc8ae4f6 100644 --- a/osdk/main/TapTool/Makefile +++ b/osdk/main/TapTool/Makefile @@ -1,21 +1,35 @@ include ../../../rules.mk -CPPFLAGS += -Wall -Iincludes -CPPFLAGS += -Wno-unknown-pragmas -Wno-deprecated-declarations +# ------------------------------------------------------------------ +# Force Homebrew GCC on macOS – never use system g++ (Apple Clang) +# ------------------------------------------------------------------ +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + CXX := g++-14 + CC := gcc-14 +endif +CPPFLAGS += -Wall -Iincludes CPPFLAGS += -I ../common/includes -LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) -SOURCES=sources/TapTool.cpp +LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) + +CXXFLAGS += -Wno-unknown-pragmas -OBJECTS=$(SOURCES:.cpp=.o) +SOURCES=sources/TapTool.cpp + +OBJECTS = $(SOURCES:.cpp=.o) EXECUTABLE=TapTool$(EXE) -all: $(SOURCES) $(EXECUTABLE) +.PHONY: all clean + +all: $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) - $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ + +sources/Link65.o: sources/Link65.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< clean: rm -f $(EXECUTABLE) $(OBJECTS) - diff --git a/osdk/main/TapTool/sources/TapTool.cpp b/osdk/main/TapTool/sources/TapTool.cpp index 58f5781d..c5b98fb4 100644 --- a/osdk/main/TapTool/sources/TapTool.cpp +++ b/osdk/main/TapTool/sources/TapTool.cpp @@ -8,6 +8,8 @@ #include #include #include +#include +#include #define FALSE 0 @@ -227,19 +229,39 @@ void emit_fast_prog(int start,int end) emit_standard_byte(0xFF); /* marker for last page */ } + void ask_name(char *name) { - char reply[80]; - do { - if (name[0]) - printf("Stored name is %s, enter new name (or RETURN to keep): ",name); - else - printf("Program has no stored name, enter a name: "); - gets_s(reply,sizeof(reply)); - if (reply[0]) strcpy(name,reply); - } while (name[0]==0); + char reply[80]; + + do + { + if (name[0]) + printf("Stored name is %s, enter new name (or RETURN to keep): ", name); + else + printf("Program has no stored name, enter a name: "); + +#ifdef _MSC_VER + gets_s(reply, sizeof(reply)); +#else + if (fgets(reply, sizeof(reply), stdin) == nullptr) + { + reply[0] = '\0'; + } + else + { + // Remove trailing newline (and optional CR for CRLF input) + reply[strcspn(reply, "\r\n")] = '\0'; + } +#endif + + if (reply[0]) + strcpy(name, reply); + + } while (name[0] == 0); } + int main(int argc,char *argv[]) { printf("\nTapTool: A multi-tape-tool based on Tap2CD by Fabrice Frances. Version %d.%3d\n\n",TOOL_VERSION_MAJOR,TOOL_VERSION_MINOR); diff --git a/osdk/main/Ym2Mym/Makefile b/osdk/main/Ym2Mym/Makefile index 04b0087c..39317388 100644 --- a/osdk/main/Ym2Mym/Makefile +++ b/osdk/main/Ym2Mym/Makefile @@ -1,21 +1,36 @@ include ../../../rules.mk -CPPFLAGS += -Wall -Iincludes +# ------------------------------------------------------------------ +# Force Homebrew GCC on macOS – never use system g++ (Apple Clang) +# ------------------------------------------------------------------ +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + CXX := g++-14 + CC := gcc-14 +endif +CPPFLAGS += -Wall -Iincludes CPPFLAGS += -I ../common/includes -LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) + +LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) + +CXXFLAGS += -Wno-unknown-pragmas SOURCES=sources/lzhlib.cpp \ sources/Ym2Mym.cpp -OBJECTS=$(SOURCES:.cpp=.o) -EXECUTABLE=Ym2Mym$(EXE) +OBJECTS = $(SOURCES:.cpp=.o) +EXECUTABLE = Ym2Mym$(EXE) -all: $(SOURCES) $(EXECUTABLE) +.PHONY: all clean + +all: $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) - $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ + +sources/Link65.o: sources/Link65.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< clean: rm -f $(EXECUTABLE) $(OBJECTS) - diff --git a/osdk/main/bas2tap/Makefile b/osdk/main/bas2tap/Makefile index 7afb538c..00893843 100644 --- a/osdk/main/bas2tap/Makefile +++ b/osdk/main/bas2tap/Makefile @@ -1,19 +1,34 @@ include ../../../rules.mk -CPPFLAGS= -Wall -Iincludes +# ------------------------------------------------------------------ +# Force Homebrew GCC on macOS – never use system g++ (Apple Clang) +# ------------------------------------------------------------------ +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + CXX := g++-14 + CC := gcc-14 +endif +CPPFLAGS += -Wall -Iincludes CPPFLAGS += -I ../common/includes -LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) -SOURCES=sources/bas2tap.cpp -OBJECTS=$(SOURCES:.cpp=.o) -EXECUTABLE=bas2tap$(EXE) +LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) -all: $(SOURCES) $(EXECUTABLE) +CXXFLAGS += -Wno-unknown-pragmas + +SOURCES = sources/bas2tap.cpp +OBJECTS = $(SOURCES:.cpp=.o) +EXECUTABLE = bas2tap$(EXE) + +.PHONY: all clean + +all: $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) - $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ + +sources/Link65.o: sources/Link65.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< clean: rm -f $(EXECUTABLE) $(OBJECTS) - diff --git a/osdk/main/bin2txt/Makefile b/osdk/main/bin2txt/Makefile index 412c23b2..4e85b88b 100644 --- a/osdk/main/bin2txt/Makefile +++ b/osdk/main/bin2txt/Makefile @@ -1,20 +1,35 @@ include ../../../rules.mk -CPPFLAGS += -Wall -Iincludes +# ------------------------------------------------------------------ +# Force Homebrew GCC on macOS – never use system g++ (Apple Clang) +# ------------------------------------------------------------------ +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + CXX := g++-14 + CC := gcc-14 +endif +CPPFLAGS += -Wall -Iincludes CPPFLAGS += -I ../common/includes -LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) + +LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) + +CXXFLAGS += -Wno-unknown-pragmas SOURCES=sources/bin2txt.cpp -OBJECTS=$(SOURCES:.cpp=.o) -EXECUTABLE=bin2txt$(EXE) +OBJECTS = $(SOURCES:.cpp=.o) +EXECUTABLE = bin2txt$(EXE) -all: $(SOURCES) $(EXECUTABLE) +.PHONY: all clean + +all: $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) - $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ + +sources/Link65.o: sources/Link65.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< clean: rm -f $(EXECUTABLE) $(OBJECTS) - diff --git a/osdk/main/common/Makefile b/osdk/main/common/Makefile index 732512f6..67d21671 100644 --- a/osdk/main/common/Makefile +++ b/osdk/main/common/Makefile @@ -1,19 +1,33 @@ include ../../../rules.mk -#LDFLAGS += -lstdc++ +# ------------------------------------------------------------------ +# Force Homebrew GCC on macOS – never use system g++ (Apple Clang) +# ------------------------------------------------------------------ +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + CXX := g++-14 + CC := gcc-14 +endif -VPATH = sources +VPATH = sources SOURCES := $(subst sources/,,$(wildcard sources/*.cpp)) -OBJS := $(subst .cpp,.o,$(SOURCES)) +OBJS := $(SOURCES:.cpp=.o) + CPPFLAGS += -I sources -I includes CPPFLAGS += -D_LIB -all: libcommon.a +# macOS extras (append only) +ifeq ($(UNAME_S),Darwin) + CXXFLAGS += -std=c++14 +endif -clean: - rm -f libcommon.a *.o +.PHONY: all clean + +all: libcommon.a libcommon.a: $(OBJS) - $(AR) $(ARFLAGS) $@ $(^) + $(AR) $(ARFLAGS) $@ $^ + # $(RANLIB) $@ # uncomment if you need ranlib -# $(RANLIB) $@ +clean: + rm -f libcommon.a $(OBJS) diff --git a/osdk/main/compiler/sources/input.c b/osdk/main/compiler/sources/input.c index 70b2b3e5..a72c2b26 100644 --- a/osdk/main/compiler/sources/input.c +++ b/osdk/main/compiler/sources/input.c @@ -2,7 +2,7 @@ #include "c.h" #include -#ifdef __unix__ +#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #include #elif defined(_WIN32) || defined(_WIN64) #include diff --git a/osdk/main/compiler/sources/main.c b/osdk/main/compiler/sources/main.c index 2b955c98..aec32adc 100644 --- a/osdk/main/compiler/sources/main.c +++ b/osdk/main/compiler/sources/main.c @@ -4,7 +4,7 @@ #include "c.h" #include #include -#ifdef __unix__ +#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #include #elif defined(_WIN32) || defined(_WIN64) #include diff --git a/osdk/main/compiler/sources/output.c b/osdk/main/compiler/sources/output.c index e0b25aee..1e48e6c8 100644 --- a/osdk/main/compiler/sources/output.c +++ b/osdk/main/compiler/sources/output.c @@ -1,7 +1,7 @@ /* C compiler: output functions */ #include "c.h" -#ifdef __unix__ +#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #include #elif defined(_WIN32) || defined(_WIN64) #include diff --git a/osdk/main/compiler/sources/profio.c b/osdk/main/compiler/sources/profio.c index 07d53ac3..0b10f8fd 100644 --- a/osdk/main/compiler/sources/profio.c +++ b/osdk/main/compiler/sources/profio.c @@ -13,7 +13,7 @@ */ #include #include -#ifdef __unix__ +#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #include #elif defined(_WIN32) || defined(_WIN64) #include diff --git a/osdk/main/header/Makefile b/osdk/main/header/Makefile index c1fbf833..b0431612 100644 --- a/osdk/main/header/Makefile +++ b/osdk/main/header/Makefile @@ -1,20 +1,35 @@ include ../../../rules.mk -CPPFLAGS += -Wall -Iincludes +# ------------------------------------------------------------------ +# Force Homebrew GCC on macOS – never use system g++ (Apple Clang) +# ------------------------------------------------------------------ +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + CXX := g++-14 + CC := gcc-14 +endif +CPPFLAGS += -Wall -Iincludes CPPFLAGS += -I ../common/includes -LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) -SOURCES=sources/header.cpp +LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) + +CXXFLAGS += -Wno-unknown-pragmas -OBJECTS=$(SOURCES:.cpp=.o) +SOURCES=sources/header.cpp + +OBJECTS = $(SOURCES:.cpp=.o) EXECUTABLE=header$(EXE) -all: $(SOURCES) $(EXECUTABLE) +.PHONY: all clean + +all: $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) - $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ + +sources/Link65.o: sources/Link65.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< clean: rm -f $(EXECUTABLE) $(OBJECTS) - diff --git a/osdk/main/link65/Makefile b/osdk/main/link65/Makefile index 3d12caba..fe8c784a 100644 --- a/osdk/main/link65/Makefile +++ b/osdk/main/link65/Makefile @@ -1,22 +1,34 @@ include ../../../rules.mk -CPPFLAGS += -Wall -Iincludes +# ------------------------------------------------------------------ +# Force Homebrew GCC on macOS – never use system g++ (Apple Clang) +# ------------------------------------------------------------------ +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + CXX := g++-14 + CC := gcc-14 +endif +CPPFLAGS += -Wall -Iincludes CPPFLAGS += -I ../common/includes -LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) + +LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) CXXFLAGS += -Wno-unknown-pragmas -SOURCES=sources/Link65.cpp +SOURCES = sources/Link65.cpp +OBJECTS = $(SOURCES:.cpp=.o) +EXECUTABLE = link65$(EXE) -OBJECTS=$(SOURCES:.cpp=.o) -EXECUTABLE=link65$(EXE) +.PHONY: all clean -all: $(SOURCES) $(EXECUTABLE) +all: $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) - $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ + +sources/Link65.o: sources/Link65.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< clean: rm -f $(EXECUTABLE) $(OBJECTS) - diff --git a/osdk/main/macrosplitter/Makefile b/osdk/main/macrosplitter/Makefile index 6d8f771d..e0df0a2a 100644 --- a/osdk/main/macrosplitter/Makefile +++ b/osdk/main/macrosplitter/Makefile @@ -1,21 +1,35 @@ include ../../../rules.mk -CPPFLAGS += -Wall -Iincludes -CPPFLAGS += -Wno-unknown-pragmas +# ------------------------------------------------------------------ +# Force Homebrew GCC on macOS – never use system g++ (Apple Clang) +# ------------------------------------------------------------------ +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + CXX := g++-14 + CC := gcc-14 +endif +CPPFLAGS += -Wall -Iincludes CPPFLAGS += -I ../common/includes -LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) -SOURCES=sources/macrosplitter.cpp +LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) + +CXXFLAGS += -Wno-unknown-pragmas -OBJECTS=$(SOURCES:.cpp=.o) +SOURCES=sources/macrosplitter.cpp + +OBJECTS = $(SOURCES:.cpp=.o) EXECUTABLE=macrosplitter$(EXE) -all: $(SOURCES) $(EXECUTABLE) +.PHONY: all clean + +all: $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) - $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ + +sources/Link65.o: sources/Link65.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< clean: rm -f $(EXECUTABLE) $(OBJECTS) - diff --git a/osdk/main/pictconv/Makefile b/osdk/main/pictconv/Makefile index a39586a9..a1d5cbbc 100644 --- a/osdk/main/pictconv/Makefile +++ b/osdk/main/pictconv/Makefile @@ -1,37 +1,70 @@ include ../../../rules.mk +# ------------------------------------------------------------------ +# Force Homebrew GCC on macOS so we never fall back to system g++ +# (Apple Clang → libc++). This must be consistent with libcommon. +# ------------------------------------------------------------------ +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + CXX := g++-14 + CC := gcc-14 +endif + CPPFLAGS += -I ../common/includes +CPPFLAGS += -DFREEIMAGE_LIB FI_PATH := ../../../shared_libraries/freeimage/v3.12.0 NS_PATH := ../../../shared_libraries/nanosvg -CPPFLAGS += -DFREEIMAGE_LIB + ifeq ($(PLATFORM),win32) -CPPFLAGS += -I libs -LDFLAGS += -L libs -lFreeImage + CPPFLAGS += -I libs + LDFLAGS += -L libs -lFreeImage else -CPPFLAGS += -I $(FI_PATH)/ -I$(FI_PATH)/Source/ -LDFLAGS += -L $(FI_PATH)/ -lfreeimage $(MATH_LIBS) + # Prefer Homebrew FreeImage on macOS when available + ifeq ($(UNAME_S),Darwin) + FI_PREFIX := $(shell brew --prefix freeimage 2>/dev/null) + ifneq ($(FI_PREFIX),) + CPPFLAGS += -I $(FI_PREFIX)/include + LDFLAGS += -L $(FI_PREFIX)/lib -lfreeimage $(MATH_LIBS) + else + # Fallback to the bundled copy + CPPFLAGS += -I $(FI_PATH)/ -I $(FI_PATH)/Source/ + LDFLAGS += -L $(FI_PATH)/ -lfreeimage $(MATH_LIBS) + endif + else + # Non-macOS Unix: use the bundled FreeImage + CPPFLAGS += -I $(FI_PATH)/ -I $(FI_PATH)/Source/ + LDFLAGS += -L $(FI_PATH)/ -lfreeimage $(MATH_LIBS) + endif +endif + +# macOS-specific extras (append, do not overwrite flags from rules.mk) +ifeq ($(UNAME_S),Darwin) + CXXFLAGS += -std=c++14 + CFLAGS += -Wno-implicit-function-declaration + # CFLAGS += -std=gnu99 # uncomment if C23 keyword problems appear endif CPPFLAGS += -I $(NS_PATH)/src +CPPFLAGS += -I sources -I includes -LDFLAGS += -lstdc++ +# common library + curses / C++ runtime (from rules.mk) LDFLAGS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) SOURCES := $(notdir $(wildcard sources/*.cpp)) # filter out some test sources... SOURCES := $(filter-out %video.cpp,$(SOURCES)) -VPATH = sources -CPPFLAGS += -I sources -I includes -OBJS := $(subst .cpp,.o,$(SOURCES)) -#OBJS := $(SOURCES:.cpp,.o) +VPATH = sources +OBJS := $(SOURCES:.cpp=.o) + +EXECUTABLE = pictconv$(EXE) -EXECUTABLE=pictconv$(EXE) +.PHONY: all clean all: $(EXECUTABLE) -pictconv$(EXE): $(OBJS) - $(LINK.c) -o $@ $(OBJS) $(LDFLAGS) +$(EXECUTABLE): $(OBJS) + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $(OBJS) $(LDFLAGS) clean: - rm -f pictconv$(EXE) $(OBJS) + rm -f $(EXECUTABLE) $(OBJS) diff --git a/osdk/main/pictconv/sources/dither_riemersma.cpp b/osdk/main/pictconv/sources/dither_riemersma.cpp index 0f6b3634..2b896013 100644 --- a/osdk/main/pictconv/sources/dither_riemersma.cpp +++ b/osdk/main/pictconv/sources/dither_riemersma.cpp @@ -8,7 +8,7 @@ * large memory model. For other compilers, you may have to replace the * calls to malloc() and _ffree() with straight malloc() and free() calls. */ -#include // for malloc() and _ffree() +#include // for malloc() and _ffree() #include // for exp() and log() #include // memmove() diff --git a/osdk/main/tap2cd/Makefile b/osdk/main/tap2cd/Makefile index dd9e5581..61de0c5b 100644 --- a/osdk/main/tap2cd/Makefile +++ b/osdk/main/tap2cd/Makefile @@ -1,21 +1,35 @@ include ../../../rules.mk -CPPFLAGS += -Wall -Iincludes -CPPFLAGS += -Wno-deprecated-declarations +# ------------------------------------------------------------------ +# Force Homebrew GCC on macOS – never use system g++ (Apple Clang) +# ------------------------------------------------------------------ +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + CXX := g++-14 + CC := gcc-14 +endif +CPPFLAGS += -Wall -Iincludes CPPFLAGS += -I ../common/includes -LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) -SOURCES=sources/tap2cd.c +LDLIBS += -L ../common -lcommon $(COMMON_EXTRA_LDFLAGS) + +CXXFLAGS += -Wno-unknown-pragmas -OBJECTS=$(SOURCES:.c=.o) +SOURCES=sources/tap2cd.c + +OBJECTS = $(SOURCES:.c=.o) EXECUTABLE=tap2cd$(EXE) -all: $(SOURCES) $(EXECUTABLE) +.PHONY: all clean + +all: $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) - $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ + +sources/Link65.o: sources/Link65.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< clean: rm -f $(EXECUTABLE) $(OBJECTS) - diff --git a/osdk/main/tap2cd/sources/tap2cd.c b/osdk/main/tap2cd/sources/tap2cd.c index 637163f2..61889a2f 100644 --- a/osdk/main/tap2cd/sources/tap2cd.c +++ b/osdk/main/tap2cd/sources/tap2cd.c @@ -319,17 +319,36 @@ void emit_fast_prog(int start,int end) emit_standard_byte(0); /* marker for last page */ } + void ask_name(char *name) { - char reply[80]; - do { - if (name[0]) - printf("Stored name is %s, enter new name (or RETURN to keep): ",name); - else - printf("Program has no stored name, enter a name: "); - gets_s(reply,sizeof(reply)); - if (reply[0]) strcpy(name,reply); - } while (name[0]==0); + char reply[80]; + + do + { + if (name[0]) + printf("Stored name is %s, enter new name (or RETURN to keep): ", name); + else + printf("Program has no stored name, enter a name: "); + +#ifdef _MSC_VER + gets_s(reply, sizeof(reply)); +#else + if (fgets(reply, sizeof(reply), stdin) == NULL) + { + reply[0] = '\0'; + } + else + { + // Remove trailing newline (and optional CR for CRLF input) + reply[strcspn(reply, "\r\n")] = '\0'; + } +#endif + + if (reply[0]) + strcpy(name, reply); + + } while (name[0] == 0); } int main(int argc,char *argv[]) diff --git a/rules.mk b/rules.mk index 889b4835..a290dcc6 100644 --- a/rules.mk +++ b/rules.mk @@ -1,4 +1,3 @@ - # Quiet #Q ?= @ @@ -31,10 +30,10 @@ CPPFLAGS += -DWIN32 # add default rules for exe files %.exe: %.o - $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ %.exe: %.c - $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@ + $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@ endif @@ -45,9 +44,21 @@ endif ifneq ($(PLATFORM),win32) CURSES_LIB ?= -lcurses + +ifeq ($(PLATFORM),Darwin) +STDCXX_LIB ?= -lstdc++ +CXXSTD ?= -std=c++14 +CC = gcc-14 +CXX = g++-14 +# do NOT add -stdlib=libc++ here +else STDCXX_LIB ?= -lstdc++ +CXXSTD ?= -std=c++11 +endif + + COMMON_EXTRA_LDFLAGS += $(CURSES_LIB) $(STDCXX_LIB) -CXXSTD ?= -std=c++11 +override CXXFLAGS := $(filter-out -std=c++11 -std=c++14 -std=c++17 -std=c++20,$(CXXFLAGS)) CXXFLAGS += $(CXXSTD) CPPFLAGS += -D__cdecl= -DPOSIX CFLAGS += -Wall @@ -67,4 +78,4 @@ install: $(Q)for B in $(BINS) $(EXECUTABLE); do b="`echo "$$B" | tr A-Z a-z`"; if [ "$$B" != "$$b" ]; then ln -sf "$$B" "$(OSDK)/bin/$$b"; fi; done endif -endif \ No newline at end of file +endif diff --git a/shared_libraries/freeimage/v3.12.0/Makefile.osx b/shared_libraries/freeimage/v3.12.0/Makefile.osx index 25b8631b..27d34959 100644 --- a/shared_libraries/freeimage/v3.12.0/Makefile.osx +++ b/shared_libraries/freeimage/v3.12.0/Makefile.osx @@ -5,10 +5,10 @@ include Makefile.srcs # General configuration variables: -CC_PPC = gcc-4.0 -CC_I386 = gcc-4.0 -CPP_PPC = g++-4.0 -CPP_I386 = g++-4.0 +CC_PPC = gcc +CC_I386 = gcc +CPP_PPC = g++ +CPP_I386 = g++ COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden COMPILERFLAGS_PPC = -arch ppc COMPILERFLAGS_I386 = -arch i386 diff --git a/shared_libraries/soloud/src/backend/miniaudio/miniaudio.h b/shared_libraries/soloud/src/backend/miniaudio/miniaudio.h index e740f236..141e3750 100644 --- a/shared_libraries/soloud/src/backend/miniaudio/miniaudio.h +++ b/shared_libraries/soloud/src/backend/miniaudio/miniaudio.h @@ -495,7 +495,7 @@ extern "C" { #include /* Unfortunate #include, but needed for pthread_t, pthread_mutex_t and pthread_cond_t types. */ #include - #ifdef __unix__ +#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #define MA_UNIX #if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) #define MA_BSD From 3687efa7a81ba232a2bfeba6a2f333056877e050 Mon Sep 17 00:00:00 2001 From: seclorum Date: Fri, 31 Jul 2026 21:44:01 +0200 Subject: [PATCH 2/9] readme.OSX: explain homebrew dependencies --- readme.OSX | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 readme.OSX diff --git a/readme.OSX b/readme.OSX new file mode 100644 index 00000000..76db70e6 --- /dev/null +++ b/readme.OSX @@ -0,0 +1,5 @@ + +To get OSDK built for MacOS (Tahoe 26.5.2), you must first use homebrew thus: + + $ brew install gcc-14 freeimage + From e2ffdb50380d17bc25efea6db471c5d624496b22 Mon Sep 17 00:00:00 2001 From: seclorum Date: Sat, 1 Aug 2026 01:19:38 +0200 Subject: [PATCH 3/9] rules.mk: cleanup, fix HACK bug, make rules more coherent. --- rules.mk | 89 ++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 64 insertions(+), 25 deletions(-) diff --git a/rules.mk b/rules.mk index a290dcc6..2786b913 100644 --- a/rules.mk +++ b/rules.mk @@ -1,13 +1,23 @@ +# Notes: +# MacOS: +# This project intentionally uses GNU libstdc++ on macOS. +# + # Quiet #Q ?= @ RANLIB ?= ranlib +AR ?= ar +CC ?= cc +CXX ?= c++ HOSTOS := $(shell uname -s) + ifeq ($(PLATFORM),) PLATFORM := $(HOSTOS) endif +# Debug/release selection ifeq ($(RELEASE),) DEBUG = 1 CPPFLAGS += -D_DEBUG @@ -17,65 +27,94 @@ endif MATH_LIBS ?= -lm +# Windows cross build ifeq ($(PLATFORM),win32) -EXE = .exe +EXE := .exe .SUFFIXES: .exe CROSS_COMPILE ?= i586-mingw32msvc- CC := $(CROSS_COMPILE)$(CC) CXX := $(CROSS_COMPILE)$(CXX) -AR := $(CROSS_COMPILE)$(AR) -RANLIB := $(CROSS_COMPILE)$(RANLIB) +AR := $(CROSS_COMPILE)$(AR) +RANLIB := $(CROSS_COMPILE)$(RANLIB) WINDRES := $(CROSS_COMPILE)windres CPPFLAGS += -DWIN32 -# add default rules for exe files %.exe: %.o - $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ %.exe: %.c - $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@ + $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@ endif +# Haiku ifeq ($(PLATFORM),Haiku) CURSES_LIB := -lncurses MATH_LIBS := endif +# Non-Windows, i.e. POSIX platforms ifneq ($(PLATFORM),win32) CURSES_LIB ?= -lcurses ifeq ($(PLATFORM),Darwin) +# IMPORTANT: +# The project is not currently compatible with Apple clang/libc++. +# Mixing clang/libc++ with these objects causes linker failures. +CC := gcc-14 +CXX := g++-14 STDCXX_LIB ?= -lstdc++ -CXXSTD ?= -std=c++14 -CC = gcc-14 -CXX = g++-14 -# do NOT add -stdlib=libc++ here +CXXSTD ?= -std=c++14 else +# Linux STDCXX_LIB ?= -lstdc++ -CXXSTD ?= -std=c++11 +CXXSTD ?= -std=c++11 endif - +# Linker additions COMMON_EXTRA_LDFLAGS += $(CURSES_LIB) $(STDCXX_LIB) -override CXXFLAGS := $(filter-out -std=c++11 -std=c++14 -std=c++17 -std=c++20,$(CXXFLAGS)) + +# Platforms share CXXFLAGS, but avoid multiple incompatible -std options. +CXXFLAGS := $(filter-out \ + -std=c++11 \ + -std=c++14 \ + -std=c++17 \ + -std=c++20 \ + -std=c++23, \ + $(CXXFLAGS)) + CXXFLAGS += $(CXXSTD) -CPPFLAGS += -D__cdecl= -DPOSIX -CFLAGS += -Wall -endif +# +# POSIX compatibility +# +CPPFLAGS += -D__cdecl= -DPOSIX +CFLAGS += -Wall +endif # Non-Windows platforms + + +# +# OSDK installation support +# ifneq ($(OSDK),) -#FIXME: This is a HACK to avoid install being the default target. -# TODO: move the include to bottom of makefiles -ifeq ($(MAKECMDGOALS),install) -#$(info OSDK=$(OSDK)) -#ifneq ($(BINS),) -#$(info BINS=$(BINS)) + + +.PHONY: install + + install: $(Q)install -d $(OSDK)/bin - $(Q)for B in $(BINS) $(EXECUTABLE); do install $$B $(OSDK)/bin/; done - $(Q)for B in $(BINS) $(EXECUTABLE); do b="`echo "$$B" | tr A-Z a-z`"; if [ "$$B" != "$$b" ]; then ln -sf "$$B" "$(OSDK)/bin/$$b"; fi; done + $(Q)for B in $(BINS) $(EXECUTABLE); do \ + install $$B $(OSDK)/bin/; \ + done + + $(Q)for B in $(BINS) $(EXECUTABLE); do \ + b="$$(echo "$$B" | tr A-Z a-z)"; \ + if [ "$$B" != "$$b" ]; then \ + ln -sf "$$B" "$(OSDK)/bin/$$b"; \ + fi; \ + done + -endif endif From 38bc716e1bf311d52f67556f8da66192c42f047c Mon Sep 17 00:00:00 2001 From: seclorum Date: Sat, 1 Aug 2026 01:24:25 +0200 Subject: [PATCH 4/9] Makefile: MacOS tooling assert. --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 31f0fece..65c3105d 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,11 @@ LDFLAGS = UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) + +ifeq (, $(shell which g++-14)) +$(error g++-14 not found. Run: brew install gcc@14 freeimage) +endif + # Force C++14 (required for multi-statement constexpr) CXXFLAGS += -std=c++14 From 596ae2983b0798fb5b8a7672be8bac171fd057fc Mon Sep 17 00:00:00 2001 From: seclorum Date: Sat, 1 Aug 2026 01:26:36 +0200 Subject: [PATCH 5/9] Address dbug's formatting rule: ({}'s not withstanding..) .. --- osdk/main/TapTool/sources/TapTool.cpp | 34 ++++++++------------------ osdk/main/tap2cd/sources/tap2cd.c | 35 ++++++++------------------- 2 files changed, 20 insertions(+), 49 deletions(-) diff --git a/osdk/main/TapTool/sources/TapTool.cpp b/osdk/main/TapTool/sources/TapTool.cpp index c5b98fb4..c7f2fe14 100644 --- a/osdk/main/TapTool/sources/TapTool.cpp +++ b/osdk/main/TapTool/sources/TapTool.cpp @@ -232,33 +232,19 @@ void emit_fast_prog(int start,int end) void ask_name(char *name) { - char reply[80]; - - do - { - if (name[0]) - printf("Stored name is %s, enter new name (or RETURN to keep): ", name); - else - printf("Program has no stored name, enter a name: "); - + char reply[80]; + do { + if (name[0]) { printf("Stored name is %s, enter new name (or RETURN to keep): ", name); } + else { printf("Program has no stored name, enter a name: "); } #ifdef _MSC_VER - gets_s(reply, sizeof(reply)); + gets_s(reply, sizeof(reply)); #else - if (fgets(reply, sizeof(reply), stdin) == nullptr) - { - reply[0] = '\0'; - } - else - { - // Remove trailing newline (and optional CR for CRLF input) - reply[strcspn(reply, "\r\n")] = '\0'; - } + if (fgets(reply, sizeof(reply), stdin) == nullptr) { reply[0] = '\0'; } + else { reply[strcspn(reply, "\r\n")] = '\0'; } + // Remove trailing newline (and optional CR for CRLF input) #endif - - if (reply[0]) - strcpy(name, reply); - - } while (name[0] == 0); + if (reply[0]) { strcpy(name, reply); } + } while (name[0] == 0); } diff --git a/osdk/main/tap2cd/sources/tap2cd.c b/osdk/main/tap2cd/sources/tap2cd.c index 61889a2f..f5f4c879 100644 --- a/osdk/main/tap2cd/sources/tap2cd.c +++ b/osdk/main/tap2cd/sources/tap2cd.c @@ -319,36 +319,21 @@ void emit_fast_prog(int start,int end) emit_standard_byte(0); /* marker for last page */ } - void ask_name(char *name) { - char reply[80]; - - do - { - if (name[0]) - printf("Stored name is %s, enter new name (or RETURN to keep): ", name); - else - printf("Program has no stored name, enter a name: "); - + char reply[80]; + do { + if (name[0]) { printf("Stored name is %s, enter new name (or RETURN to keep): ", name); } + else { printf("Program has no stored name, enter a name: "); } #ifdef _MSC_VER - gets_s(reply, sizeof(reply)); + gets_s(reply, sizeof(reply)); #else - if (fgets(reply, sizeof(reply), stdin) == NULL) - { - reply[0] = '\0'; - } - else - { - // Remove trailing newline (and optional CR for CRLF input) - reply[strcspn(reply, "\r\n")] = '\0'; - } + if (fgets(reply, sizeof(reply), stdin) == NULL) { reply[0] = '\0'; } + else { reply[strcspn(reply, "\r\n")] = '\0'; } + // Remove trailing newline (and optional CR for CRLF input) #endif - - if (reply[0]) - strcpy(name, reply); - - } while (name[0] == 0); + if (reply[0]) { strcpy(name, reply); } + } while (name[0] == 0); } int main(int argc,char *argv[]) From 26c9d010ffb0d2c9a26e9cda818a2decff952ab6 Mon Sep 17 00:00:00 2001 From: seclorum Date: Sat, 1 Aug 2026 01:26:36 +0200 Subject: [PATCH 6/9] Address dbug's formatting rule: ({}'s not withstanding..) .. --- osdk/main/TapTool/sources/TapTool.cpp | 34 ++++++++------------------ osdk/main/tap2cd/sources/tap2cd.c | 35 ++++++++------------------- rules.mk | 15 +----------- 3 files changed, 21 insertions(+), 63 deletions(-) diff --git a/osdk/main/TapTool/sources/TapTool.cpp b/osdk/main/TapTool/sources/TapTool.cpp index c5b98fb4..c7f2fe14 100644 --- a/osdk/main/TapTool/sources/TapTool.cpp +++ b/osdk/main/TapTool/sources/TapTool.cpp @@ -232,33 +232,19 @@ void emit_fast_prog(int start,int end) void ask_name(char *name) { - char reply[80]; - - do - { - if (name[0]) - printf("Stored name is %s, enter new name (or RETURN to keep): ", name); - else - printf("Program has no stored name, enter a name: "); - + char reply[80]; + do { + if (name[0]) { printf("Stored name is %s, enter new name (or RETURN to keep): ", name); } + else { printf("Program has no stored name, enter a name: "); } #ifdef _MSC_VER - gets_s(reply, sizeof(reply)); + gets_s(reply, sizeof(reply)); #else - if (fgets(reply, sizeof(reply), stdin) == nullptr) - { - reply[0] = '\0'; - } - else - { - // Remove trailing newline (and optional CR for CRLF input) - reply[strcspn(reply, "\r\n")] = '\0'; - } + if (fgets(reply, sizeof(reply), stdin) == nullptr) { reply[0] = '\0'; } + else { reply[strcspn(reply, "\r\n")] = '\0'; } + // Remove trailing newline (and optional CR for CRLF input) #endif - - if (reply[0]) - strcpy(name, reply); - - } while (name[0] == 0); + if (reply[0]) { strcpy(name, reply); } + } while (name[0] == 0); } diff --git a/osdk/main/tap2cd/sources/tap2cd.c b/osdk/main/tap2cd/sources/tap2cd.c index 61889a2f..f5f4c879 100644 --- a/osdk/main/tap2cd/sources/tap2cd.c +++ b/osdk/main/tap2cd/sources/tap2cd.c @@ -319,36 +319,21 @@ void emit_fast_prog(int start,int end) emit_standard_byte(0); /* marker for last page */ } - void ask_name(char *name) { - char reply[80]; - - do - { - if (name[0]) - printf("Stored name is %s, enter new name (or RETURN to keep): ", name); - else - printf("Program has no stored name, enter a name: "); - + char reply[80]; + do { + if (name[0]) { printf("Stored name is %s, enter new name (or RETURN to keep): ", name); } + else { printf("Program has no stored name, enter a name: "); } #ifdef _MSC_VER - gets_s(reply, sizeof(reply)); + gets_s(reply, sizeof(reply)); #else - if (fgets(reply, sizeof(reply), stdin) == NULL) - { - reply[0] = '\0'; - } - else - { - // Remove trailing newline (and optional CR for CRLF input) - reply[strcspn(reply, "\r\n")] = '\0'; - } + if (fgets(reply, sizeof(reply), stdin) == NULL) { reply[0] = '\0'; } + else { reply[strcspn(reply, "\r\n")] = '\0'; } + // Remove trailing newline (and optional CR for CRLF input) #endif - - if (reply[0]) - strcpy(name, reply); - - } while (name[0] == 0); + if (reply[0]) { strcpy(name, reply); } + } while (name[0] == 0); } int main(int argc,char *argv[]) diff --git a/rules.mk b/rules.mk index 2786b913..239ba99d 100644 --- a/rules.mk +++ b/rules.mk @@ -37,14 +37,13 @@ CXX := $(CROSS_COMPILE)$(CXX) AR := $(CROSS_COMPILE)$(AR) RANLIB := $(CROSS_COMPILE)$(RANLIB) WINDRES := $(CROSS_COMPILE)windres + CPPFLAGS += -DWIN32 %.exe: %.o $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ - %.exe: %.c $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@ - endif # Haiku @@ -85,24 +84,14 @@ CXXFLAGS := $(filter-out \ CXXFLAGS += $(CXXSTD) -# # POSIX compatibility -# CPPFLAGS += -D__cdecl= -DPOSIX CFLAGS += -Wall endif # Non-Windows platforms - -# # OSDK installation support -# - ifneq ($(OSDK),) - - .PHONY: install - - install: $(Q)install -d $(OSDK)/bin $(Q)for B in $(BINS) $(EXECUTABLE); do \ @@ -115,6 +104,4 @@ install: ln -sf "$$B" "$(OSDK)/bin/$$b"; \ fi; \ done - - endif From a1756db40c59d0c48f6371192f29189933d617cd Mon Sep 17 00:00:00 2001 From: seclorum Date: Sat, 1 Aug 2026 01:52:26 +0200 Subject: [PATCH 7/9] .gitignore: exclude *.o and *.a files, as well as build MacOS/Linux build products. --- .gitignore | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 110aecd0..e88dd626 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,12 @@ -################################################################################ -# This .gitignore file was automatically created by Microsoft(R) Visual Studio. -################################################################################ -# see: https://github.com/github/gitignore/blob/main/VisualStudio.gitignore - -*.user +*.user *.vcxproj.FileListAbsolute.txt *.vcxproj.filter *.pdb *.idb *.tmp *.obj +*.o +*.a *.db *.tlog *.recipe @@ -53,3 +50,27 @@ osdk/main/Osdk/_final_/Oricutron/videos/ osdk/OldVersions/ osdk/main/Osdk/_final_/sample/assembly/known_issues/ osdk/main/osdk_issues.md + +euphoric_tools/4k8/4k8totap +euphoric_tools/4k8/4k8towav +euphoric_tools/txt2bas/txt2bas +osdk/main/DskTool/DskTool +osdk/main/FloppyBuilder/FloppyBuilder +osdk/main/MemMap/memmap +osdk/main/TapTool/TapTool +osdk/main/Ym2Mym/Ym2Mym +osdk/main/bas2tap/bas2tap +osdk/main/bin2txt/bin2txt +osdk/main/common/libcommon.a +osdk/main/compiler/compiler +osdk/main/filepack/filepack +osdk/main/header/header +osdk/main/link65/link65 +osdk/main/macrosplitter/macrosplitter +osdk/main/old2mfm/old2mfm +osdk/main/opt65/opt65 +osdk/main/pictconv/pictconv +osdk/main/tap2cd/tap2cd +osdk/main/tap2dsk/tap2dsk +osdk/main/xa/xa + From e925704a8aad49d50fc0076f46654d77d38d3801 Mon Sep 17 00:00:00 2001 From: seclorum Date: Sat, 1 Aug 2026 02:05:42 +0200 Subject: [PATCH 8/9] readme.OSX: use of OSDK environment variable --- readme.OSX | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/readme.OSX b/readme.OSX index 76db70e6..438ebf60 100644 --- a/readme.OSX +++ b/readme.OSX @@ -3,3 +3,16 @@ To get OSDK built for MacOS (Tahoe 26.5.2), you must first use homebrew thus: $ brew install gcc-14 freeimage +Then 'make' .. and to install in a local OSDK directory: + + $ OSDK=/Users//Desktop/OSDK2.0/ make install # for example + +.. and then, naturally, + + $ export OSDK=/Users//Desktop/OSDK2.0/ + # Or wherever you installed it .. + +.. will give you a base path to the installed toolchain - set PATH accordingly, e.g. + + $ export PATH=$PATH:$OSDK/bin + From f26359e6ca4e2ba5a05ea7dc78986366ba7bde06 Mon Sep 17 00:00:00 2001 From: seclorum Date: Sat, 1 Aug 2026 02:16:47 +0200 Subject: [PATCH 9/9] readme.OSX note re: OSDK unset requirement --- readme.OSX | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/readme.OSX b/readme.OSX index 438ebf60..81f693bf 100644 --- a/readme.OSX +++ b/readme.OSX @@ -16,3 +16,12 @@ Then 'make' .. and to install in a local OSDK directory: $ export PATH=$PATH:$OSDK/bin +Note: + + If OSDK is set, 'make' will attempt to install a build into it! + Only set the OSDK variable after a complete, successful build. + To build again, unset OSDK - i.e. + + $ export OSDK= + $ make # etc. +