]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Cleaned the ugly code I committed for DP_FS_BASEDIR support (the environment variable...
authormolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 3 Jul 2006 19:46:07 +0000 (19:46 +0000)
committermolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 3 Jul 2006 19:46:07 +0000 (19:46 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6498 d7cf8633-e32d-0410-b094-e92efae38249

BSDmakefile
fs.c
makefile
makefile.inc

index 1f8bad720d96d952cee345f785d7276cb728eabb..249a2bc960d248f13b649f88cf120e4aea6b0cd4 100644 (file)
@@ -7,8 +7,6 @@ DP_MAKE_TARGET=bsd
 .endif
 DP_ARCH != uname
 
-CFLAGS_MAKEDEP=-MD
-
 # Command used to delete files
 CMD_RM=$(CMD_UNIXRM)
 
@@ -68,6 +66,16 @@ LIB_SOUND=$(LIB_SND_BSD)
 .endif
 
 
+##### Extra CFLAGS #####
+
+CFLAGS_MAKEDEP=-MD
+.ifdef DP_FS_BASEDIR
+CFLAGS_FS=-DDP_FS_BASEDIR='\"$(DP_FS_BASEDIR)\"'
+.else
+CFLAGS_FS=
+.endif
+
+
 ##### BSD Make specific definitions #####
 
 MAKE:=$(MAKE) -f BSDmakefile
diff --git a/fs.c b/fs.c
index ab981f5e6cc2841298d85a1462c0122abbf0856b..3aab0537b24f27f7cb3d4ed84befff07453de7d0 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -1,7 +1,7 @@
 /*
        DarkPlaces file system
 
-       Copyright (C) 2003-2005 Mathieu Olivier
+       Copyright (C) 2003-2006 Mathieu Olivier
 
        This program is free software; you can redistribute it and/or
        modify it under the terms of the GNU General Public License
@@ -1068,11 +1068,10 @@ void FS_Init (void)
        strcpy(fs_basedir, DP_FS_BASEDIR);
 #else
        strcpy(fs_basedir, "");
-#endif
 
 #ifdef MACOSX
        // FIXME: is there a better way to find the directory outside the .app?
-       if (!fs_basedir[0] && strstr(com_argv[0], ".app/"))
+       if (strstr(com_argv[0], ".app/"))
        {
                char *split;
 
@@ -1082,6 +1081,7 @@ void FS_Init (void)
                strlcpy(fs_basedir, com_argv[0], sizeof(fs_basedir));
                fs_basedir[split - com_argv[0]] = 0;
        }
+#endif
 #endif
 
        PK3_OpenLibrary ();
index ba1b76edfa6b7a976ea9dbb5f4e166b778b04ec1..19272f8315aabece2aca056c1201e5642ec032c5 100644 (file)
--- a/makefile
+++ b/makefile
@@ -26,8 +26,6 @@ endif  # ifneq ($(filter %BSD,$(DP_ARCH)),)
 endif  # ifdef windir
 endif  # ifndef DP_MAKE_TARGET
 
-CFLAGS_MAKEDEP=-MD
-
 # If we're not on compiling for Win32, we need additional information
 ifneq ($(DP_MAKE_TARGET), mingw)
        DP_ARCH:=$(shell uname)
@@ -209,6 +207,16 @@ ifeq ($(DP_SOUND_API), WIN)
 endif
 
 
+##### Extra CFLAGS #####
+
+CFLAGS_MAKEDEP?=-MD
+ifdef DP_FS_BASEDIR
+       CFLAGS_FS=-DDP_FS_BASEDIR='\"$(DP_FS_BASEDIR)\"'
+else
+       CFLAGS_FS=
+endif
+
+
 ##### GNU Make specific definitions #####
 
 DO_LD=$(CC) -o $@ $^ $(LDFLAGS)
index 2b2a375d6f254c2368e1b9897879b753693244ec..eca83c29920c78734a4d5cb7c5e30e6fc125a225 100644 (file)
@@ -18,8 +18,6 @@ CPUOPTIMIZATIONS=
 
 SDL_CONFIG?=sdl-config
 
-DP_FS_BASEDIR?=
-
 
 ###### Sound and audio CD #####
 
@@ -140,7 +138,7 @@ OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o $(OBJ_SND_COMMON) snd_sdl.o cd_sdl.o $(
 
 
 # Compilation
-CFLAGS_COMMON=$(CFLAGS_MAKEDEP) -D'DP_FS_BASEDIR=\"$(DP_FS_BASEDIR)\"' -Wall -Wsign-compare
+CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_FS) -Wall -Wsign-compare
 CFLAGS_DEBUG=-ggdb
 CFLAGS_PROFILE=-g -pg -ggdb
 CFLAGS_RELEASE=