mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
BSD: Build system fixes/improvements. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@5037 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
97c944a505
commit
17906349b4
8 changed files with 57 additions and 46 deletions
|
@ -288,7 +288,11 @@ ifneq (0,$(LUNATIC))
|
|||
endif
|
||||
|
||||
ifeq ($(SUBPLATFORM),LINUX)
|
||||
LIBS += -lFLAC -lvorbisfile -lvorbis -logg
|
||||
LIBS += -lFLAC -lvorbisfile -lvorbis -logg
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),BSD)
|
||||
LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lexecinfo
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),DARWIN)
|
||||
|
|
|
@ -102,39 +102,39 @@ SYSBITS=32
|
|||
# the outside world. This allows cross-compilation by overriding
|
||||
# CC and giving us PLATFORM specifically.
|
||||
#
|
||||
ifndef HOST
|
||||
ifndef HOSTPLATFORM
|
||||
uname:=$(strip $(shell uname -s))
|
||||
HOST=UNKNOWN
|
||||
HOSTPLATFORM=UNKNOWN
|
||||
ifeq ($(findstring Linux,$(uname)),Linux)
|
||||
HOST=LINUX
|
||||
HOSTPLATFORM=LINUX
|
||||
endif
|
||||
ifeq ($(findstring BSD,$(uname)),BSD)
|
||||
HOST=BSD
|
||||
HOSTPLATFORM=BSD
|
||||
endif
|
||||
ifeq ($(findstring MINGW,$(uname)),MINGW)
|
||||
HOST=WINDOWS
|
||||
HOSTPLATFORM=WINDOWS
|
||||
endif
|
||||
ifeq ($(findstring Darwin,$(uname)),Darwin)
|
||||
HOST=DARWIN
|
||||
HOSTPLATFORM=DARWIN
|
||||
endif
|
||||
ifeq ($(findstring BeOS,$(uname)),BeOS)
|
||||
HOST=BEOS
|
||||
HOSTPLATFORM=BEOS
|
||||
endif
|
||||
ifeq ($(findstring skyos,$(uname)),skyos)
|
||||
HOST=SKYOS
|
||||
HOSTPLATFORM=SKYOS
|
||||
endif
|
||||
ifeq ($(findstring QNX,$(uname)),QNX)
|
||||
HOST=QNX
|
||||
HOSTPLATFORM=QNX
|
||||
endif
|
||||
ifeq ($(findstring SunOS,$(uname)),SunOS)
|
||||
HOST=SUNOS
|
||||
HOSTPLATFORM=SUNOS
|
||||
endif
|
||||
ifeq ($(findstring syllable,$(uname)),syllable)
|
||||
HOST=SYLLABLE
|
||||
HOSTPLATFORM=SYLLABLE
|
||||
endif
|
||||
endif
|
||||
ifndef PLATFORM
|
||||
PLATFORM=$(HOST)
|
||||
PLATFORM=$(HOSTPLATFORM)
|
||||
endif
|
||||
|
||||
ifndef SUBPLATFORM
|
||||
|
@ -205,7 +205,7 @@ endif
|
|||
# KRANDDEBUG - 1 = include logging of krand() calls for debugging the demo system
|
||||
# MEMMAP - 1 = produce .memmap file when linking
|
||||
# EFENCE - 1 = compile with Electric Fence for malloc() debugging
|
||||
# OPTLEVEL - 0..3 = GCC optimization strategy
|
||||
# OPTLEVEL - 0..3 = GCC optimization strategy
|
||||
# LTO - 1 = enable link-time optimization, for GCC 4.5 and up
|
||||
#
|
||||
CPLUSPLUS?=1
|
||||
|
@ -298,11 +298,11 @@ ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \>= 4)))
|
|||
W_STRICT_OVERFLOW := -Wno-strict-overflow
|
||||
endif
|
||||
|
||||
ifeq ($(HOST),WINDOWS)
|
||||
ifeq ($(HOSTPLATFORM),WINDOWS)
|
||||
# MSYS2 lets you create files named NUL but has a /dev/null. Go figure.
|
||||
ifeq (,$(wildcard /dev/null))
|
||||
DONT_PRINT = > NUL 2>&1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),WINDOWS)
|
||||
|
@ -334,8 +334,8 @@ ifeq ($(PLATFORM),DARWIN)
|
|||
DARWINVERSION:=$(strip $(shell uname -r | cut -d . -f 1))
|
||||
endif
|
||||
|
||||
DARWIN9 ?= 0
|
||||
DARWIN10 ?= 0
|
||||
DARWIN9 ?= 0
|
||||
DARWIN10 ?= 0
|
||||
ifeq (1,$(strip $(shell expr $(DARWINVERSION) \< 10)))
|
||||
override DARWIN9 := 1
|
||||
endif
|
||||
|
@ -683,7 +683,7 @@ ifeq ($(SUBPLATFORM),LINUX)
|
|||
|
||||
LIBS+= -lrt
|
||||
ifeq (0,$(CLANG))
|
||||
COMMONFLAGS += -fno-pic
|
||||
COMMONFLAGS += -fno-pic
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),DARWIN)
|
||||
|
@ -742,7 +742,7 @@ ifeq ($(PLATFORM),DARWIN)
|
|||
endif
|
||||
|
||||
ifeq (0,$(CLANG))
|
||||
COMMONFLAGS += -fno-pic
|
||||
COMMONFLAGS += -fno-pic
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),WINDOWS)
|
||||
|
@ -786,7 +786,7 @@ ifeq ($(PLATFORM),WINDOWS)
|
|||
COMMONFLAGS += -fno-pic
|
||||
endif
|
||||
ifeq ($(PLATFORM),BSD)
|
||||
COMPILERFLAGS+= -I/usr/X11R6/include
|
||||
COMPILERFLAGS+= -I/usr/local/include
|
||||
|
||||
RENDERTYPE=SDL
|
||||
MIXERTYPE=SDL
|
||||
|
@ -995,7 +995,9 @@ endif
|
|||
|
||||
ifneq ($(PLATFORM),WINDOWS)
|
||||
ifneq ($(PLATFORM),WII)
|
||||
LIBS+= -ldl
|
||||
ifneq ($(PLATFORM),BSD)
|
||||
LIBS+= -ldl
|
||||
endif
|
||||
ifneq ($(PLATFORM),DARWIN)
|
||||
LIBS+= -pthread
|
||||
endif
|
||||
|
|
|
@ -28,7 +28,7 @@ typedef int64_t inthi_t;
|
|||
|
||||
#if !defined(NOASM) && (defined(_MSC_VER) || (defined(__GNUC__) && defined(__i386__)))
|
||||
|
||||
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__SYLLABLE__)
|
||||
#if defined __linux || defined __APPLE__ || defined EDUKE32_BSD || defined __SYLLABLE__
|
||||
#define __cdecl
|
||||
#endif
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
#define max(x,y) ((x) > (y) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#ifndef __APPLE__
|
||||
#if !defined __APPLE__ && (!defined EDUKE32_BSD || !__STDC__)
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
|
@ -91,6 +91,10 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __bsdi__ || defined __DragonFly__
|
||||
# define EDUKE32_BSD
|
||||
#endif
|
||||
|
||||
#if defined __ANDROID__ || defined EDUKE32_IOS
|
||||
# define EDUKE32_TOUCH_DEVICES
|
||||
# define EDUKE32_GLES
|
||||
|
@ -264,7 +268,7 @@
|
|||
# define B_SWAP32(x) __swap32(x)
|
||||
# define B_SWAP16(x) __swap16(x)
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
#elif defined EDUKE32_BSD
|
||||
# include <sys/endian.h>
|
||||
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define B_LITTLE_ENDIAN 1
|
||||
|
@ -860,7 +864,7 @@ FORCE_INLINE void *xaligned_malloc(const bsize_t alignment, const bsize_t size)
|
|||
{
|
||||
#ifdef _WIN32
|
||||
void *ptr = _aligned_malloc(size, alignment);
|
||||
#elif defined __APPLE__
|
||||
#elif defined __APPLE__ || defined EDUKE32_BSD
|
||||
void *ptr = NULL;
|
||||
posix_memalign(&ptr, alignment, size);
|
||||
#else
|
||||
|
|
|
@ -156,7 +156,7 @@ void readjoybstatus(int32_t *b)
|
|||
#if defined _WIN32
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#elif defined __linux || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
#elif defined __linux || defined EDUKE32_BSD || defined __APPLE__
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
|
@ -181,7 +181,7 @@ int32_t nx_unprotect(intptr_t beg, intptr_t end)
|
|||
initprintf("VirtualProtect() error! Crashing in 3... 2... 1...\n");
|
||||
return 1;
|
||||
}
|
||||
# elif defined __linux || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
# elif defined __linux || defined EDUKE32_BSD || defined __APPLE__
|
||||
int32_t pagesize;
|
||||
size_t dep_begin_page;
|
||||
pagesize = sysconf(_SC_PAGE_SIZE);
|
||||
|
|
|
@ -27,10 +27,11 @@
|
|||
# include <dirent.h>
|
||||
#endif
|
||||
|
||||
#if defined(__linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#if defined __linux || defined EDUKE32_BSD
|
||||
# include <libgen.h> // for dirname()
|
||||
#endif
|
||||
#if defined(__FreeBSD__)
|
||||
#if defined __FreeBSD__
|
||||
# include <limits.h> // for PATH_MAX
|
||||
# include <sys/sysctl.h> // for sysctl() to get path to executable
|
||||
#endif
|
||||
|
||||
|
@ -304,7 +305,19 @@ char *Bgetappdir(void)
|
|||
|
||||
#elif defined EDUKE32_OSX
|
||||
dir = osx_getappdir();
|
||||
#elif defined(__linux) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#elif defined __FreeBSD__
|
||||
// the sysctl should also work when /proc/ is not mounted (which seems to
|
||||
// be common on FreeBSD), so use it..
|
||||
char buf[PATH_MAX] = {0};
|
||||
int name[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
|
||||
size_t len = sizeof(buf)-1;
|
||||
int ret = sysctl(name, sizeof(name)/sizeof(name[0]), buf, &len, NULL, 0);
|
||||
if(ret == 0 && buf[0] != '\0') {
|
||||
// again, remove executable name with dirname()
|
||||
// on FreeBSD dirname() seems to use some internal buffer
|
||||
dir = strdup(dirname(buf));
|
||||
}
|
||||
#elif defined __linux || defined EDUKE32_BSD
|
||||
char buf[PATH_MAX] = {0};
|
||||
char buf2[PATH_MAX] = {0};
|
||||
# ifdef __linux
|
||||
|
@ -319,18 +332,6 @@ char *Bgetappdir(void)
|
|||
// on FreeBSD it seems to use some internal buffer instead.. anyway, just strdup()
|
||||
dir = Bstrdup(dirname(buf2));
|
||||
}
|
||||
#elif defined(__FreeBSD__)
|
||||
// the sysctl should also work when /proc/ is not mounted (which seems to
|
||||
// be common on FreeBSD), so use it..
|
||||
char buf[PATH_MAX] = {0};
|
||||
int name[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
|
||||
size_t len = sizeof(buf)-1;
|
||||
int ret = sysctl(name, sizeof(name)/sizeof(name[0]), buf, &len, NULL, 0);
|
||||
if(ret == 0 && buf[0] != '\0') {
|
||||
// again, remove executable name with dirname()
|
||||
// on FreeBSD dirname() seems to use some internal buffer
|
||||
dir = strdup(dirname(buf));
|
||||
}
|
||||
#endif
|
||||
|
||||
return dir;
|
||||
|
|
|
@ -99,4 +99,4 @@ void initcrc32table(void)
|
|||
crc32table[7][i] = (crc32table[6][i] >> 8) ^ crc32table[0][crc32table[6][i] & 0xFF];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -599,7 +599,7 @@ static void G_LoadAddon(void)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined EDUKE32_OSX || defined __linux__ || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__
|
||||
#if defined EDUKE32_OSX || defined __linux__ || defined EDUKE32_BSD
|
||||
static void G_AddSteamPaths(const char *basepath)
|
||||
{
|
||||
char buf[BMAX_PATH];
|
||||
|
@ -803,7 +803,7 @@ static void G_ParseSteamKeyValuesForPaths(const char *vdf)
|
|||
|
||||
void G_AddSearchPaths(void)
|
||||
{
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#if defined __linux__ || defined EDUKE32_BSD
|
||||
char buf[BMAX_PATH];
|
||||
char *homepath = Bgethomedir();
|
||||
|
||||
|
|
Loading…
Reference in a new issue