Removed passing machine type from the makefile to the compiler; instead, determine...
authorres <res@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 18 Jan 2008 15:38:00 +0000 (15:38 +0000)
committerres <res@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 18 Jan 2008 15:38:00 +0000 (15:38 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7977 d7cf8633-e32d-0410-b094-e92efae38249

cl_gecko.c
host.c
makefile.inc
quakedef.h

index 133def8..9daec00 100644 (file)
@@ -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 62192c1..f395b47 100644 (file)
--- 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);
 
index a289d6b..9a9c51b 100644 (file)
@@ -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=
index 36221f3..bb9bb84 100644 (file)
@@ -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