Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ else
endif
export CROSS_COMPILING

ifneq ($(CROSS_COMPILING),1)
BASE_CFLAGS ?= -march=native
else
BASE_CFLAGS ?=
endif

ifndef DESTDIR
DESTDIR=/usr/local/games/quake3
endif
Expand Down Expand Up @@ -310,8 +316,6 @@ ifeq ($(ARCH),ppc64)
HAVE_VM_COMPILED = true
endif

BASE_CFLAGS =

ifeq ($(USE_SYSTEM_JPEG),1)
BASE_CFLAGS += -DUSE_SYSTEM_JPEG
endif
Expand Down Expand Up @@ -420,6 +424,12 @@ ifdef MINGW
$(error Cannot find a suitable cross compiler for $(PLATFORM))
endif

# Detect if CC is clang
COMPILER_VERSION := $(shell $(CC) --version)
ifneq '' '$(findstring clang,$(COMPILER_VERSION))'
BASE_CFLAGS += std=gnu2x -Wno-gnu-alignof-expression
endif

BASE_CFLAGS += -Wall -Wimplicit -Wstrict-prototypes -DUSE_ICON -DMINGW=1

BASE_CFLAGS += -Wno-unused-result -fvisibility=hidden
Expand All @@ -428,7 +438,7 @@ ifdef MINGW
ifeq ($(ARCH),x86_64)
ARCHEXT = .x64
BASE_CFLAGS += -m64
OPTIMIZE = -O2 -ffast-math
OPTIMIZE = -mfpmath=sse -O3 -ffast-math
endif
ifeq ($(ARCH),x86)
BASE_CFLAGS += -m32
Expand Down Expand Up @@ -487,14 +497,19 @@ ifeq ($(COMPILE_PLATFORM),darwin)
#############################################################################
# SETUP AND BUILD -- MACOS
#############################################################################
# Detect if CC is clang
COMPILER_VERSION := $(shell $(CC) --version)
ifneq '' '$(findstring clang,$(COMPILER_VERSION))'
BASE_CFLAGS += -std=gnu2x -Wno-gnu-alignof-expression
endif

BASE_CFLAGS += -Wall -Wimplicit -Wstrict-prototypes -pipe

BASE_CFLAGS += -Wno-unused-result

BASE_CFLAGS += -DMACOS_X

OPTIMIZE = -O2 -fvisibility=hidden
OPTIMIZE = -O3 -ftree-vectorize -fopenmp-simd -fvisibility=hidden

SHLIBEXT = dylib
SHLIBCFLAGS = -fPIC -fvisibility=hidden
Expand Down Expand Up @@ -554,10 +569,17 @@ else

BASE_CFLAGS += -I/usr/include -I/usr/local/include

OPTIMIZE = -O2 -fvisibility=hidden
OPTIMIZE = -O3 -ftree-vectorize -fopenmp -fopenmp-simd -fvisibility=hidden

# Detect if CC is clang
COMPILER_VERSION := $(shell $(CC) --version)
ifneq '' '$(findstring clang,$(COMPILER_VERSION))'
BASE_CFLAGS += -std=gnu2x -Wno-gnu-alignof-expression
endif

ifeq ($(ARCH),x86_64)
ARCHEXT = .x64
OPTIMIZE += -mfpmath=sse
else
ifeq ($(ARCH),x86)
OPTIMIZE += -march=i586 -mtune=i686
Expand Down Expand Up @@ -627,7 +649,7 @@ else
endif

DEBUG_CFLAGS = $(BASE_CFLAGS) -DDEBUG -D_DEBUG -g -O0
RELEASE_CFLAGS = $(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
RELEASE_CFLAGS = $(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE) -fdata-sections -ffunction-sections

DEBUG_LDFLAGS = -rdynamic

Expand Down
22 changes: 0 additions & 22 deletions code/qcommon/q_math.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,28 +275,6 @@ void ByteToDir( int b, vec3_t dir ) {
VectorCopy (bytedirs[b], dir);
}


unsigned ColorBytes3 (float r, float g, float b) {
unsigned i;

( (byte *)&i )[0] = r * 255;
( (byte *)&i )[1] = g * 255;
( (byte *)&i )[2] = b * 255;

return i;
}

unsigned ColorBytes4 (float r, float g, float b, float a) {
unsigned i;

( (byte *)&i )[0] = r * 255;
( (byte *)&i )[1] = g * 255;
( (byte *)&i )[2] = b * 255;
( (byte *)&i )[3] = a * 255;

return i;
}

float NormalizeColor( const vec3_t in, vec3_t out ) {
float max;

Expand Down
10 changes: 6 additions & 4 deletions code/qcommon/q_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#if defined( _MSC_VER ) && _MSC_VER >= 1400 // MSVC++ 8.0 at least
#define OS_STRING "win_msvc"
#define ID_INLINE __inline
#elif defined __MINGW32__
#define OS_STRING "win_mingw"
#define ID_INLINE __attribute__((always_inline,flatten)) inline
#elif defined __MINGW64__
#define OS_STRING "win_mingw64"
#define ID_INLINE __attribute__((always_inline,flatten)) inline
#else
#error "Compiler not supported"
#endif

#define ID_INLINE __inline
#define PATH_SEP '\\'
#define PATH_SEP_FOREIGN '/'
#define DLL_EXT ".dll"
Expand Down Expand Up @@ -156,7 +158,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <endian.h>

#define OS_STRING "linux"
#define ID_INLINE inline
#define ID_INLINE __attribute__((always_inline,flatten)) inline

#endif // __linux___

Expand All @@ -176,7 +178,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define OS_STRING "openbsd"
#endif

#define ID_INLINE inline
#define ID_INLINE __attribute__((always_inline,flatten)) inline
#if BYTE_ORDER == BIG_ENDIAN
#define Q3_BIG_ENDIAN
#else
Expand All @@ -190,7 +192,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifdef __APPLE__

#define OS_STRING "macos"
#define ID_INLINE inline
#define ID_INLINE __attribute__((always_inline,flatten)) inline
#undef DLL_EXT
#define DLL_EXT ".dylib"

Expand Down
Loading