From d07bf88ce98542b46ca2b5edca2c5fd8249a0904 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Thu, 31 Jul 2025 20:25:13 +0100 Subject: [PATCH] Add USE_ARCHLESS_FILENAMES --- Makefile | 34 ++++++++++++++++++++++++++-------- README.md | 1 + code/client/cl_main.c | 10 ++++++++-- code/qcommon/files.c | 2 +- code/qcommon/q_platform.h | 6 ++++++ 5 files changed, 42 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 459ca6f4..37f000af 100644 --- a/Makefile +++ b/Makefile @@ -243,6 +243,10 @@ ifndef USE_RENDERER_DLOPEN USE_RENDERER_DLOPEN=1 endif +ifndef USE_ARCHLESS_FILENAMES +USE_ARCHLESS_FILENAMES=0 +endif + ifndef USE_YACC USE_YACC=0 endif @@ -1067,11 +1071,21 @@ endif TARGETS = ifndef FULLBINEXT - FULLBINEXT=.$(ARCH)$(BINEXT) + ifeq ($(USE_ARCHLESS_FILENAMES),1) + FULLBINEXT=$(BINEXT) + else + FULLBINEXT=.$(ARCH)$(BINEXT) + endif endif ifndef SHLIBNAME - SHLIBNAME=$(ARCH).$(SHLIBEXT) + ifeq ($(USE_ARCHLESS_FILENAMES),1) + SHLIBNAME=.$(SHLIBEXT) + RSHLIBNAME=$(SHLIBNAME) + else + SHLIBNAME=$(ARCH).$(SHLIBEXT) + RSHLIBNAME=_$(SHLIBNAME) + endif endif ifneq ($(BUILD_SERVER),0) @@ -1083,10 +1097,10 @@ ifneq ($(BUILD_CLIENT),0) TARGETS += $(B)/$(CLIENTBIN)$(FULLBINEXT) ifneq ($(BUILD_RENDERER_OPENGL1),0) - TARGETS += $(B)/renderer_opengl1_$(SHLIBNAME) + TARGETS += $(B)/renderer_opengl1$(RSHLIBNAME) endif ifneq ($(BUILD_RENDERER_OPENGL2),0) - TARGETS += $(B)/renderer_opengl2_$(SHLIBNAME) + TARGETS += $(B)/renderer_opengl2$(RSHLIBNAME) endif else ifneq ($(BUILD_RENDERER_OPENGL1),0) @@ -1308,6 +1322,10 @@ ifeq ($(BUILD_STANDALONE),1) BASE_CFLAGS += -DSTANDALONE endif +ifeq ($(USE_ARCHLESS_FILENAMES),1) + BASE_CFLAGS += -DUSE_ARCHLESS_FILENAMES +endif + ifeq ($(GENERATE_DEPENDENCIES),1) DEPEND_CFLAGS = -MMD else @@ -2369,12 +2387,12 @@ $(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(LIBSDLMAIN) -o $@ $(Q3OBJ) \ $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS) -$(B)/renderer_opengl1_$(SHLIBNAME): $(Q3ROBJ) $(JPGOBJ) +$(B)/renderer_opengl1$(RSHLIBNAME): $(Q3ROBJ) $(JPGOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3ROBJ) $(JPGOBJ) \ $(THREAD_LIBS) $(LIBSDLMAIN) $(RENDERER_LIBS) $(LIBS) -$(B)/renderer_opengl2_$(SHLIBNAME): $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) +$(B)/renderer_opengl2$(RSHLIBNAME): $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) \ $(THREAD_LIBS) $(LIBSDLMAIN) $(RENDERER_LIBS) $(LIBS) @@ -3096,10 +3114,10 @@ ifneq ($(BUILD_CLIENT),0) ifneq ($(USE_RENDERER_DLOPEN),0) $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(CLIENTBIN)$(FULLBINEXT) $(COPYBINDIR)/$(CLIENTBIN)$(FULLBINEXT) ifneq ($(BUILD_RENDERER_OPENGL1),0) - $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/renderer_opengl1_$(SHLIBNAME) $(COPYBINDIR)/renderer_opengl1_$(SHLIBNAME) + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/renderer_opengl1$(RSHLIBNAME) $(COPYBINDIR)/renderer_opengl1$(RSHLIBNAME) endif ifneq ($(BUILD_RENDERER_OPENGL2),0) - $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/renderer_opengl2_$(SHLIBNAME) $(COPYBINDIR)/renderer_opengl2_$(SHLIBNAME) + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/renderer_opengl2$(RSHLIBNAME) $(COPYBINDIR)/renderer_opengl2$(RSHLIBNAME) endif else ifneq ($(BUILD_RENDERER_OPENGL1),0) diff --git a/README.md b/README.md index 6cada23a..fa90572a 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,7 @@ Makefile.local: BUILD_STANDALONE - build binaries suited for stand-alone games SERVERBIN - rename 'ioq3ded' server binary CLIENTBIN - rename 'ioquake3' client binary + USE_ARCHLESS_FILENAMES don't include the architecture in binary filenames USE_RENDERER_DLOPEN - build and use the renderer in a library BUILD_RENDERER_OPENGL1 build the opengl1 client / renderer library BUILD_RENDERER_OPENGL2 build the opengl2 client / renderer library diff --git a/code/client/cl_main.c b/code/client/cl_main.c index 0658fb5c..d47354b7 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -3254,6 +3254,12 @@ void CL_InitRef( void ) { #ifdef USE_RENDERER_DLOPEN GetRefAPI_t GetRefAPI; char dllName[MAX_OSPATH]; + +#ifdef USE_ARCHLESS_FILENAMES +#define RENDERER_ARCH_DLL_EXT ARCH_DLL_EXT +#else +#define RENDERER_ARCH_DLL_EXT "_" ARCH_DLL_EXT +#endif #endif Com_Printf( "----- Initializing Renderer ----\n" ); @@ -3261,14 +3267,14 @@ void CL_InitRef( void ) { #ifdef USE_RENDERER_DLOPEN cl_renderer = Cvar_Get("cl_renderer", "opengl2", CVAR_ARCHIVE | CVAR_LATCH); - Com_sprintf(dllName, sizeof(dllName), "renderer_%s_" ARCH_STRING DLL_EXT, cl_renderer->string); + Com_sprintf(dllName, sizeof(dllName), "renderer_%s" RENDERER_ARCH_DLL_EXT, cl_renderer->string); if(!(rendererLib = Sys_LoadDll(dllName, qfalse)) && strcmp(cl_renderer->string, cl_renderer->resetString)) { Com_Printf("failed:\n\"%s\"\n", Sys_LibraryError()); Cvar_ForceReset("cl_renderer"); - Com_sprintf(dllName, sizeof(dllName), "renderer_opengl2_" ARCH_STRING DLL_EXT); + Com_sprintf(dllName, sizeof(dllName), "renderer_opengl2" RENDERER_ARCH_DLL_EXT); rendererLib = Sys_LoadDll(dllName, qfalse); } diff --git a/code/qcommon/files.c b/code/qcommon/files.c index 0a9714b6..3635c363 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -1456,7 +1456,7 @@ int FS_FindVM(void **startSearch, char *found, int foundlen, const char *name, i Com_Error(ERR_FATAL, "Filesystem call made without initialization"); if(enableDll) - Com_sprintf(dllName, sizeof(dllName), "%s" ARCH_STRING DLL_EXT, name); + Com_sprintf(dllName, sizeof(dllName), "%s" ARCH_DLL_EXT, name); Com_sprintf(qvmName, sizeof(qvmName), "vm/%s.qvm", name); diff --git a/code/qcommon/q_platform.h b/code/qcommon/q_platform.h index c1cb0334..0e09ea5b 100644 --- a/code/qcommon/q_platform.h +++ b/code/qcommon/q_platform.h @@ -406,6 +406,12 @@ float FloatSwap (const float *f); #define PLATFORM_STRING OS_STRING "-" ARCH_STRING "-debug" #endif +#ifdef USE_ARCHLESS_FILENAMES +#define ARCH_DLL_EXT DLL_EXT +#else +#define ARCH_DLL_EXT ARCH_STRING DLL_EXT +#endif + #endif #endif