From: res <res@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Fri, 18 Jan 2008 15:38:00 +0000 (+0000)
Subject: Removed passing machine type from the makefile to the compiler; instead, determine... 
X-Git-Tag: xonotic-v0.1.0preview~2531
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2b547fdfd42dfbfb891a3b2c762442a3316e6ec1;p=xonotic%2Fdarkplaces.git

Removed passing machine type from the makefile to the compiler; instead, determine that stuff through preprocessor conditions.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7977 d7cf8633-e32d-0410-b094-e92efae38249
---

diff --git a/cl_gecko.c b/cl_gecko.c
index 133def8b..9daec009 100644
--- a/cl_gecko.c
+++ b/cl_gecko.c
@@ -364,8 +364,8 @@ void CL_Gecko_GetTextureExtent( clgecko_t *instance, float* pwidth, float* pheig
 # define XULRUNNER_DIR_SUFFIX	"win64"
 #elif defined(WIN32)
 # define XULRUNNER_DIR_SUFFIX	"win32"
-#elif defined(DP_ARCH) && defined(DP_MACHINE)
-# define XULRUNNER_DIR_SUFFIX	DP_ARCH "-" DP_MACHINE
+#elif defined(DP_OS_STR) && defined(DP_ARCH_STR)
+# define XULRUNNER_DIR_SUFFIX	DP_OS_STR "-" DP_ARCH_STR
 #endif
 
 clgecko_t * CL_Gecko_CreateBrowser( const char *name ) {
@@ -639,7 +639,7 @@ void CL_Gecko_Init( void )
 	#elif defined(MACOSX)
 		"OffscreenGecko.dylib",
 	#else
-		"OffscreenGecko.so",
+		"libOffscreenGecko.so",
 	#endif
 		NULL
 	};
diff --git a/host.c b/host.c
index 62192c14..f395b478 100644
--- a/host.c
+++ b/host.c
@@ -992,23 +992,7 @@ static void Host_Init (void)
 	COM_InitGameType();
 
 	// construct a version string for the corner of the console
-#if defined(__linux__)
-	os = "Linux";
-#elif defined(WIN32)
-	os = "Windows";
-#elif defined(__FreeBSD__)
-	os = "FreeBSD";
-#elif defined(__NetBSD__)
-	os = "NetBSD";
-#elif defined(__OpenBSD__)
-	os = "OpenBSD";
-#elif defined(MACOSX)
-	os = "Mac OS X";
-#elif defined(__MORPHOS__)
-	os = "MorphOS";
-#else
-	os = "Unknown";
-#endif
+	os = DP_OS_NAME;
 	dpsnprintf (engineversion, sizeof (engineversion), "%s %s %s", gamename, os, buildstring);
 	Con_Printf("%s\n", engineversion);
 
diff --git a/makefile.inc b/makefile.inc
index a289d6b9..9a9c51bb 100644
--- a/makefile.inc
+++ b/makefile.inc
@@ -152,12 +152,6 @@ OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o $(OBJ_SND_COMMON) snd_sdl.o cd_sdl.o $(
 
 # Compilation
 CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) -Wall -Wsign-compare -Wdeclaration-after-statement
-ifdef DP_ARCH
-CFLAGS_COMMON+=-DDP_ARCH=\"\\\"$(DP_ARCH)\\\"\"
-endif
-ifdef DP_MACHINE
-CFLAGS_COMMON+=-DDP_MACHINE=\"\\\"$(DP_MACHINE)\\\"\"
-endif
 CFLAGS_DEBUG=-ggdb
 CFLAGS_PROFILE=-g -pg -ggdb
 CFLAGS_RELEASE=
diff --git a/quakedef.h b/quakedef.h
index 36221f3a..bb9bb840 100644
--- a/quakedef.h
+++ b/quakedef.h
@@ -259,9 +259,55 @@ extern char engineversion[128];
 
 extern qboolean noclip_anglehack;
 
-extern char engineversion[128];
 extern cvar_t developer;
 
+/* Preprocessor macros to identify platform
+    DP_OS_NAME 	- "friendly" name of the OS, for humans to read
+    DP_OS_STR	- "identifier" of the OS, more suited for code to use
+    DP_ARCH_STR	- "identifier" of the processor architecture
+ */
+#if defined(__linux__)
+# define DP_OS_NAME		"Linux"
+# define DP_OS_STR		"linux"
+#elif defined(WIN64)
+# define DP_OS_NAME		"Windows64"
+# define DP_OS_STR		"win64"
+#elif defined(WIN32)
+# define DP_OS_NAME		"Windows"
+# define DP_OS_STR		"win32"
+#elif defined(__FreeBSD__)
+# define DP_OS_NAME		"FreeBSD"
+# define DP_OS_STR		"freebsd"
+#elif defined(__NetBSD__)
+# define DP_OS_NAME		"NetBSD"
+# define DP_OS_STR		"netbsd"
+#elif defined(__OpenBSD__)
+# define DP_OS_NAME		"OpenBSD"
+# define DP_OS_STR		"openbsd"
+#elif defined(MACOSX)
+# define DP_OS_NAME		"Mac OS X"
+# define DP_OS_STR		"osx"
+#elif defined(__MORPHOS__)
+# define DP_OS_NAME		"MorphOS"
+# define DP_OS_STR		"morphos"
+#else
+# define DP_OS_NAME		"Unknown"
+#endif
+
+#if defined(__GNUC__)
+# if defined(__i386__)
+#  define DP_ARCH_STR		"686"
+# elif defined(__x86_64__)
+#  define DP_ARCH_STR		"x86_64"
+# elif defined(__powerpc__)
+#  define DP_ARCH_STR		"ppc"
+# endif
+#elif defined(WIN64)
+# define DP_ARCH_STR		"x86_64"
+#elif defined(WIN32)
+# define DP_ARCH_STR		"x86"
+#endif
+
 // incremented every frame, never reset
 extern int host_framecount;
 // not bounded in any way, changed at start of every frame, never reset