2010-12-19 22:29:01 +00:00
2014-07-22 11:19:25 +00:00
# OS package maintainers: Please try invoking make with PACKAGE_REPOSITORY=1 to see if that meets your needs before patching out our optimizations entirely.
PACKAGE_REPOSITORY ?= 0
# Use colored output. Disable for build system debugging.
2011-02-12 13:25:24 +00:00
PRETTY_OUTPUT ?= 1
2010-12-19 22:29:01 +00:00
2012-10-29 04:26:25 +00:00
# Tools
2013-07-20 03:36:54 +00:00
CROSS=
2014-07-22 11:19:25 +00:00
ifneq ($(CROSS),)
undefine CC
undefine CXX
undefine AR
undefine RC
undefine RANLIB
undefine STRIP
endif
2014-10-19 00:44:23 +00:00
CC=$(CROSS)gcc
CXX=$(CROSS)g++
AR=$(CROSS)ar
RC=$(CROSS)windres
RANLIB=$(CROSS)ranlib
STRIP=$(CROSS)strip
AS=nasm
PKG_CONFIG=pkg-config
2014-07-22 11:19:25 +00:00
2016-06-15 07:08:31 +00:00
NULLSTREAM = /dev/null
DONT_PRINT = > $(NULLSTREAM) 2>&1
DONT_PRINT_STDERR = 2> $(NULLSTREAM)
2014-12-09 23:56:31 +00:00
DONT_FAIL = ; exit 0
2014-07-22 11:19:25 +00:00
# Override defaults that absolutely will not work.
ifeq ($(CC),cc)
override CC=gcc
endif
ifeq ($(AS),as)
override AS=nasm
endif
2012-10-29 04:26:25 +00:00
2016-06-03 04:50:55 +00:00
COBJC=$(CC) -x objective-c
COBJCXX=$(CXX) -x objective-c++
2012-11-06 07:49:44 +00:00
L_CC=$(CC)
L_CXX=$(CXX)
2014-07-22 07:25:54 +00:00
CCFULLPATH=$(CC)
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
ifeq ($(PLATFORM),WII)
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
include $(DEVKITPPC)/wii_rules
2014-07-22 07:25:54 +00:00
CCFULLPATH=$(DEVKITPPC)/bin/$(CC)
2014-10-19 00:44:23 +00:00
CROSS=powerpc-eabi-
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
RANLIB=powerpc-eabi-ranlib
STRIP=powerpc-eabi-strip
2014-12-18 18:15:05 +00:00
ELF2DOL=elf2dol
DOLSUFFIX=.dol
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
endif
2014-10-16 21:03:24 +00:00
CLANG?=0
CLANG_POTENTIAL_VERSION := $(shell $(CCFULLPATH) --version)
ifeq ($(findstring clang,$(CC)),clang)
override CLANG=1
2016-09-16 21:55:42 +00:00
CLANGNAME:=$(CC)
else
CLANGNAME:=clang
2014-10-16 21:03:24 +00:00
endif
# detect clang symlinked as gcc, as in OS X
ifeq ($(findstring clang,$(CLANG_POTENTIAL_VERSION)),clang)
override CLANG=1
endif
ifneq (0,$(CLANG))
2016-09-16 21:55:42 +00:00
override CC=$(CLANGNAME) -x c
override CXX=$(CLANGNAME) -x c++
override COBJC=$(CLANGNAME) -x objective-c
override COBJCXX=$(CLANGNAME) -x objective-c++
override L_CC=$(CLANGNAME)
override L_CXX=$(CLANGNAME)
2014-10-16 21:03:24 +00:00
endif
2012-10-29 04:26:25 +00:00
# GCC version, for conditional selection of flags.
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
ifndef GCC_MAJOR
2014-07-22 07:25:54 +00:00
GCC_MAJOR := $(shell $(CCFULLPATH) -dumpversion 2>&1 | cut -d'.' -f1)
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
endif
ifeq ($(GCC_MAJOR),)
GCC_MAJOR := 4
endif
ifndef GCC_MINOR
2014-07-22 07:25:54 +00:00
GCC_MINOR := $(shell $(CCFULLPATH) -dumpversion 2>&1 | cut -d'.' -f2)
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
endif
ifeq ($(GCC_MINOR),)
2014-07-22 07:25:54 +00:00
GCC_MINOR := 8
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
endif
2012-10-29 04:26:25 +00:00
# Detect the platform if it wasn't explicitly given to us from
# the outside world. This allows cross-compilation by overriding
# CC and giving us PLATFORM specifically.
#
2015-03-02 07:54:24 +00:00
ifndef HOSTPLATFORM
HOSTPLATFORM=UNKNOWN
2016-05-23 04:46:46 +00:00
ifeq ($(findstring Windows,$(OS)),Windows)
2015-03-02 07:54:24 +00:00
HOSTPLATFORM=WINDOWS
2016-05-23 04:46:46 +00:00
else
uname:=$(strip $(shell uname -s))
ifeq ($(findstring Linux,$(uname)),Linux)
HOSTPLATFORM=LINUX
else ifeq ($(findstring BSD,$(uname)),BSD)
HOSTPLATFORM=BSD
else ifeq ($(findstring MINGW,$(uname)),MINGW)
HOSTPLATFORM=WINDOWS
else ifeq ($(findstring MSYS,$(uname)),MSYS)
HOSTPLATFORM=WINDOWS
else ifeq ($(findstring Darwin,$(uname)),Darwin)
HOSTPLATFORM=DARWIN
else ifeq ($(findstring BeOS,$(uname)),BeOS)
HOSTPLATFORM=BEOS
else ifeq ($(findstring skyos,$(uname)),skyos)
HOSTPLATFORM=SKYOS
else ifeq ($(findstring QNX,$(uname)),QNX)
HOSTPLATFORM=QNX
else ifeq ($(findstring SunOS,$(uname)),SunOS)
HOSTPLATFORM=SUNOS
else ifeq ($(findstring syllable,$(uname)),syllable)
HOSTPLATFORM=SYLLABLE
endif
2012-10-29 04:26:25 +00:00
endif
endif
2014-12-09 23:56:31 +00:00
ifndef PLATFORM
2015-03-02 07:54:24 +00:00
PLATFORM=$(HOSTPLATFORM)
2014-12-09 23:56:31 +00:00
endif
2012-10-29 04:26:25 +00:00
2012-12-13 02:32:59 +00:00
ifndef SUBPLATFORM
SUBPLATFORM=
ifeq ($(PLATFORM),LINUX)
SUBPLATFORM=LINUX
endif
ifeq ($(PLATFORM),DINGOO)
SUBPLATFORM=LINUX
2013-07-20 03:36:54 +00:00
CROSS=mipsel-linux-
2012-12-13 02:32:59 +00:00
endif
ifeq ($(PLATFORM),GCW)
SUBPLATFORM=LINUX
2013-07-20 03:36:54 +00:00
CROSS=mipsel-linux-
2012-12-13 02:32:59 +00:00
endif
ifeq ($(PLATFORM),CAANOO)
SUBPLATFORM=LINUX
endif
endif
2012-03-14 06:27:45 +00:00
# Binary suffix override:
EXESUFFIX_OVERRIDE ?=
2013-08-18 21:14:37 +00:00
# Are we running from synthesis?
SYNTHESIS ?= 0
2012-03-04 09:31:37 +00:00
# Mac OS X Frameworks location
# Like above, use absolute paths.
APPLE_FRAMEWORKS ?=/Library/Frameworks
2013-01-04 17:28:13 +00:00
# Without the resource files packaged in the .app bundle, the startupwindow produces errors, so give it an off switch.
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
OSX_STARTUPWINDOW ?= 1
2012-03-04 09:31:37 +00:00
2010-12-19 22:29:01 +00:00
# Engine options
2011-03-04 08:50:58 +00:00
# USE_OPENGL - enables basic OpenGL Polymost renderer
# POLYMER - enables fancy Polymer renderer
2010-12-19 22:29:01 +00:00
# NOASM - disables the use of inline assembly pragmas
# LINKED_GTK - enables compile-time linkage to GTK
#
POLYMER = 1
USE_OPENGL = 1
NOASM = 0
LINKED_GTK = 0
2011-06-17 13:11:19 +00:00
BUILD32_ON_64 ?= 0
2012-07-20 21:57:53 +00:00
USE_LIBPNG ?= 1
2011-10-11 16:53:52 +00:00
USE_LIBVPX ?= 1
2014-11-02 05:34:49 +00:00
HAVE_VORBIS ?= 1
HAVE_FLAC ?= 1
2016-11-08 02:59:05 +00:00
ifeq ($(PLATFORM),WINDOWS)
HAVE_XMP ?= 1
else
HAVE_XMP ?= 0
endif
2012-12-09 13:24:44 +00:00
NETCODE ?= 1
2016-11-09 22:51:33 +00:00
STARTUP_WINDOW ?= 1
2013-10-16 19:43:06 +00:00
2013-07-13 21:05:05 +00:00
LUNATIC ?= 0
2013-10-16 19:43:06 +00:00
USE_LUAJIT_2_1 ?= 0
2012-10-29 04:26:25 +00:00
2013-09-21 13:37:31 +00:00
# EXPERIMENTAL, unfinished x86_64 assembly routines. DO NOT ENABLE.
USE_ASM64 ?= 0
2010-12-19 22:29:01 +00:00
ifeq (0,$(USE_OPENGL))
POLYMER = 0
2011-07-18 19:06:29 +00:00
USE_LIBVPX = 0
2010-12-19 22:29:01 +00:00
endif
# Debugging/Build options
2012-11-05 02:49:08 +00:00
# CPLUSPLUS - 1 = enable C++ building
2010-12-19 22:29:01 +00:00
# RELEASE - 1 = no debugging
2014-11-22 18:37:19 +00:00
# DEBUGANYWAY:
# 1 = Include debug symbols even when generating release code.
# 2 = Also enable sanitizers with Clang. On the C side, make 'sprite' etc. be real arrays.
2014-01-12 14:04:02 +00:00
# DISABLEINLINING - 1 = compile inline functions as extern __fastcall instead of static inline
2010-12-19 22:29:01 +00:00
# KRANDDEBUG - 1 = include logging of krand() calls for debugging the demo system
2014-07-22 07:25:54 +00:00
# MEMMAP - 1 = produce .memmap file when linking
2010-12-19 22:29:01 +00:00
# EFENCE - 1 = compile with Electric Fence for malloc() debugging
2015-03-02 07:54:24 +00:00
# OPTLEVEL - 0..3 = GCC optimization strategy
2011-03-25 11:42:07 +00:00
# LTO - 1 = enable link-time optimization, for GCC 4.5 and up
2010-12-19 22:29:01 +00:00
#
2014-10-29 17:07:21 +00:00
CPLUSPLUS?=1
2010-12-19 22:29:01 +00:00
RELEASE?=1
DEBUGANYWAY?=0
KRANDDEBUG?=0
2014-07-22 07:25:54 +00:00
MEMMAP?=0
2012-11-05 02:49:08 +00:00
DISABLEINLINING?=0
2010-12-19 22:29:01 +00:00
EFENCE?=0
2012-01-12 20:49:34 +00:00
DMALLOC?=0
2010-12-19 22:29:01 +00:00
PROFILER?=0
2011-03-19 17:59:09 +00:00
MUDFLAP?=0
2012-11-06 07:49:44 +00:00
2014-02-08 14:37:41 +00:00
# Make allocache() a wrapper around malloc()? Useful for debugging
# allocache()-allocated memory accesses with e.g. Valgrind.
# For debugging with Valgrind + GDB, see
# http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.gdbserver
ALLOCACHE_AS_MALLOC?=0
2013-05-04 16:36:10 +00:00
# Select the default optimization level for release and debug builds.
2013-05-06 03:12:29 +00:00
ifeq ($(RELEASE),0)
2013-05-04 16:36:10 +00:00
OPTLEVEL?=0
else
OPTLEVEL?=2
endif
2013-01-20 21:17:36 +00:00
ifeq ($(RELEASE),0)
2013-01-21 21:18:10 +00:00
override STRIP=
2013-01-20 21:17:36 +00:00
endif
ifneq ($(DEBUGANYWAY),0)
2013-01-21 21:18:10 +00:00
override STRIP=
2013-01-20 21:17:36 +00:00
endif
2013-07-13 21:05:05 +00:00
ifneq ($(LUNATIC),0)
# FIXME: Lunatic builds with LTO don't start up properly as the required
# symbol names are apparently not exported.
override LTO=0
2015-02-10 17:50:23 +00:00
2015-02-22 19:31:15 +00:00
ifneq ($(CPLUSPLUS),0)
2015-02-10 17:50:23 +00:00
$(error "Lunatic C++ build not supported")
endif
2013-07-13 21:05:05 +00:00
endif
2012-11-06 07:49:44 +00:00
ifndef LTO
LTO=1
ifneq (0,$(CLANG))
ifeq ($(PLATFORM), WINDOWS)
LTO=0
endif
endif
endif
2014-07-22 11:19:25 +00:00
COMMONFLAGS=$(ARCH)
2014-07-22 07:25:54 +00:00
COMPILERFLAGS=
2014-07-22 11:19:25 +00:00
ifeq ($(PACKAGE_REPOSITORY),0)
COMMONFLAGS += $(OPTIMIZATIONS)
2014-07-22 07:25:54 +00:00
endif
2014-07-22 11:19:25 +00:00
OPTIMIZATIONS=-O$(OPTLEVEL) $(OPTOPT)
2014-07-22 07:25:54 +00:00
2014-07-22 11:19:25 +00:00
DEBUGFLAG=-g
2014-11-28 08:14:00 +00:00
ifeq (0,$(CLANG))
2014-07-22 11:19:25 +00:00
ifneq ($(PLATFORM),WII)
2014-12-15 19:50:52 +00:00
DEBUGFLAG=-ggdb -fno-omit-frame-pointer
2014-07-22 11:19:25 +00:00
endif
endif
2014-07-22 07:25:54 +00:00
ifneq ($(RELEASE)$(DEBUGANYWAY),10)
# debug build or DEBUGANYWAY=1 --> -g flag
2014-07-22 11:19:25 +00:00
OPTIMIZATIONS += $(DEBUGFLAG)
2014-07-22 07:25:54 +00:00
endif
2014-11-24 08:19:50 +00:00
CONLYFLAGS=-std=gnu99 -Wimplicit -Werror-implicit-function-declaration
2016-05-23 04:47:06 +00:00
CXXONLYFLAGS= -fno-exceptions -fno-rtti
2016-06-03 04:50:47 +00:00
ASFORMAT=elf$(BITS)
2014-07-22 07:25:54 +00:00
ASFLAGS=-s -f $(ASFORMAT) #-g
LINKERFLAGS=
2016-05-23 04:47:12 +00:00
L_CXXONLYFLAGS=
2014-07-22 07:25:54 +00:00
LIBS=-lm
2015-09-27 21:18:06 +00:00
GUI_LIBS=
2014-07-22 07:25:54 +00:00
LIBDIRS=
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \>= 4)))
2012-10-29 04:26:25 +00:00
F_NO_STACK_PROTECTOR := -fno-stack-protector
# there are some link-time issues with stack protectors, so make it possible to override
F_STACK_PROTECTOR_ALL ?= -fstack-protector-all
ifeq (0,$(CLANG))
F_JUMP_TABLES := -fjump-tables
endif
M_TUNE_GENERIC := -mtune=generic
M_STACKREALIGN := -mstackrealign
endif
2016-01-12 10:31:07 +00:00
W_STRICT_OVERFLOW := -Wno-strict-overflow
2015-03-02 07:54:24 +00:00
ifeq ($(HOSTPLATFORM),WINDOWS)
2015-01-16 06:30:48 +00:00
# MSYS2 lets you create files named NUL but has a /dev/null. Go figure.
ifeq (,$(wildcard /dev/null))
2016-06-15 07:08:31 +00:00
NULLSTREAM = NUL
2015-03-02 07:54:24 +00:00
endif
2014-12-09 23:56:31 +00:00
endif
2016-06-03 04:50:47 +00:00
# Detect machine architecture
BITS=32
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
ifeq ($(PLATFORM),WINDOWS)
ifndef COMPILERTARGET
COMPILERTARGET:=$(strip $(shell $(CC) -dumpmachine))
endif
2016-06-03 04:50:47 +00:00
IMPLICIT_ARCH=i386
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
ifeq ($(findstring x86_64,$(COMPILERTARGET)),x86_64)
2016-06-03 04:50:47 +00:00
IMPLICIT_ARCH=x86_64
BITS=64
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
endif
2016-06-03 04:50:47 +00:00
WINLIB?=/$(BITS)
else ifeq ($(PLATFORM),WII)
IMPLICIT_ARCH=ppc
2016-10-29 16:59:28 +00:00
else
2016-06-03 04:50:47 +00:00
ifneq ($(ARCH),)
override ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(strip $(ARCH)))))
IMPLICIT_ARCH=$(ARCH)
else
IMPLICIT_ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(strip $(shell uname -m)))))
endif
ifeq ($(findstring x86_64,$(IMPLICIT_ARCH)),x86_64)
BITS=64
2014-07-23 06:04:44 +00:00
endif
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
endif
2012-10-29 04:26:25 +00:00
ifeq ($(PLATFORM),DARWIN)
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
ifndef DARWINVERSION
DARWINVERSION:=$(strip $(shell uname -r | cut -d . -f 1))
endif
2014-10-16 21:03:24 +00:00
2015-03-02 07:54:24 +00:00
DARWIN9 ?= 0
DARWIN10 ?= 0
2012-10-29 04:26:25 +00:00
ifeq (1,$(strip $(shell expr $(DARWINVERSION) \< 10)))
2014-10-16 21:03:24 +00:00
override DARWIN9 := 1
endif
ifeq (1,$(strip $(shell expr $(DARWINVERSION) \< 11)))
override DARWIN10 := 1
2012-10-29 04:26:25 +00:00
endif
2014-07-22 07:25:54 +00:00
# COMMONFLAGS += -fno-leading-underscore
2012-10-29 04:26:25 +00:00
ifeq (1,$(DARWIN9))
F_JUMP_TABLES :=
W_STRICT_OVERFLOW :=
endif
2016-10-29 16:59:28 +00:00
ifneq ($(ARCH),)
ifneq ($(findstring -arch,$(ARCH)),-arch)
override ARCH := -arch $(ARCH)
endif
endif
2012-10-29 04:26:25 +00:00
ifeq (1,$(BUILD32_ON_64))
2014-07-22 07:25:54 +00:00
COMMONFLAGS += $(F_NO_STACK_PROTECTOR)
2016-10-29 16:59:28 +00:00
ifeq ($(ARCH),)
override ARCH:=-arch i386
endif
2012-10-29 04:26:25 +00:00
else
2016-06-03 04:50:47 +00:00
ifeq ($(findstring ppc,$(IMPLICIT_ARCH)),ppc)
2014-07-22 07:25:54 +00:00
COMMONFLAGS += $(F_NO_STACK_PROTECTOR)
2012-10-29 04:26:25 +00:00
endif
endif
2012-12-29 10:54:35 +00:00
ifneq (0,$(OSX_STARTUPWINDOW))
2014-07-22 07:25:54 +00:00
COMPILERFLAGS+= -DOSX_STARTUPWINDOW
2012-12-29 10:54:35 +00:00
endif
2012-10-29 04:26:25 +00:00
endif
2014-07-22 07:25:54 +00:00
2014-07-24 14:01:44 +00:00
ifneq (0,$(RELEASE))
# Debugging disabled
COMMONFLAGS += $(F_NO_STACK_PROTECTOR)
else
# Debugging enabled
ifneq (0,$(KRANDDEBUG))
COMMONFLAGS += -fno-inline -fno-inline-functions -fno-inline-functions-called-once
endif
endif
2012-10-29 04:26:25 +00:00
ifndef OPTOPT
2016-06-05 04:46:01 +00:00
ifeq ($(findstring x86_64, $(IMPLICIT_ARCH)),x86_64)
2016-06-15 07:08:26 +00:00
ifeq ($(findstring x86_64h, $(IMPLICIT_ARCH)),x86_64h)
OPTOPT=-march=haswell -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mpopcnt -mpclmul -mavx -mrdrnd -mf16c -mfsgsbase -mavx2 -maes -mfma -mbmi -mbmi2
# -mcrc32 -mmovbe
else
ifeq ($(PLATFORM),DARWIN)
OPTOPT=-march=core2 -mmmx -msse -msse2 -msse3 -mssse3
endif
2016-06-05 04:46:01 +00:00
endif
endif
2016-06-03 04:50:47 +00:00
ifeq ($(findstring i386, $(IMPLICIT_ARCH)),i386)
2016-06-03 04:50:52 +00:00
ifeq ($(PLATFORM),DARWIN)
OPTOPT=-march=nocona -mmmx -msse -msse2 -msse3
else
OPTOPT=-march=pentium3 $(M_TUNE_GENERIC) -mmmx
# -msse2 -mfpmath=sse,387 -malign-double $(M_STACKREALIGN)
endif
endif
2012-10-29 04:26:25 +00:00
endif
2010-12-19 22:29:01 +00:00
ifneq (0,$(KRANDDEBUG))
RELEASE=0
endif
ifneq (0,$(PROFILER))
2014-11-22 18:37:19 +00:00
# XXX: Why?
2010-12-19 22:29:01 +00:00
DEBUGANYWAY=1
endif
2012-05-20 07:25:25 +00:00
ifeq ($(PLATFORM),WII)
override USE_LIBVPX = 0
2014-03-22 13:21:03 +00:00
override NETCODE = 0
2014-11-02 05:34:49 +00:00
override HAVE_FLAC = 0
2016-11-08 02:59:05 +00:00
override HAVE_XMP = 0
2012-05-20 07:25:25 +00:00
endif
2013-07-20 03:36:54 +00:00
ifeq ($(PLATFORM),GCW)
override USE_LIBVPX = 0
endif
ifeq ($(PLATFORM),DINGOO)
override USE_LIBVPX = 0
endif
2012-05-20 07:25:25 +00:00
2011-07-18 19:06:29 +00:00
ifneq (0,$(USE_LIBVPX))
2011-09-21 22:38:37 +00:00
# On Windows, we link statically to libvpx
2014-07-22 07:25:54 +00:00
LIBS+= -lvpx
2011-07-18 19:06:29 +00:00
endif
2011-03-19 18:07:12 +00:00
2012-01-28 14:36:52 +00:00
2014-02-08 14:37:41 +00:00
ifneq ($(ALLOCACHE_AS_MALLOC),0)
2014-07-22 07:25:54 +00:00
COMPILERFLAGS += -DDEBUG_ALLOCACHE_AS_MALLOC
2014-02-08 14:37:41 +00:00
endif
2013-08-18 19:24:15 +00:00
# See http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
# for a list of possible UBSan options.
# Clang 3.2 does only supports -fsanitize=address for the AddressSanitizer
2014-11-22 18:37:19 +00:00
CLANG_DEBUG_FLAGS := -fsanitize=address -fsanitize=bounds,enum,float-cast-overflow,object-size
#CLANG_DEBUG_FLAGS := $(CLANG_DEBUG_FLAGS),signed-integer-overflow
#CLANG_DEBUG_FLAGS := $(CLANG_DEBUG_FLAGS),unsigned-integer-overflow
#CLANG_DEBUG_FLAGS := $(CLANG_DEBUG_FLAGS) -fsanitize-undefined-trap-on-error
2013-08-18 19:24:15 +00:00
2010-12-19 22:29:01 +00:00
ifneq (0,$(RELEASE))
2014-11-22 18:37:19 +00:00
## Debugging disabled
2012-05-18 21:40:38 +00:00
ifeq (0,$(CLANG))
2014-07-22 07:25:54 +00:00
COMMONFLAGS += -funswitch-loops
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \< 4)))
2014-10-25 10:17:15 +00:00
override LTO=0
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
endif
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) = 4)))
2014-10-25 10:17:15 +00:00
ifeq ($(PLATFORM),WII)
ifeq (1,$(strip $(shell expr $(GCC_MINOR) \< 8)))
override LTO=0
endif
else
ifeq (1,$(strip $(shell expr $(GCC_MINOR) \< 6)))
override LTO=0
endif
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
endif
endif
2011-12-15 22:43:01 +00:00
endif
2014-11-22 18:37:19 +00:00
2011-09-22 16:52:55 +00:00
ifeq (0,$(DEBUGANYWAY))
2014-07-22 07:25:54 +00:00
COMMONFLAGS += -fomit-frame-pointer
COMPILERFLAGS += -DNDEBUG
2012-11-09 22:31:02 +00:00
else
2014-11-22 18:37:19 +00:00
# Our $(DEBUGANYWAY) -> DEBUGGINGAIDS #define
COMPILERFLAGS += -DDEBUGGINGAIDS=$(DEBUGANYWAY)
ifneq (0,$(CLANG))
ifeq (2,$(DEBUGANYWAY))
COMMONFLAGS += $(CLANG_DEBUG_FLAGS)
endif
endif
2011-09-22 16:52:55 +00:00
endif
2014-11-22 18:37:19 +00:00
2011-03-25 11:42:07 +00:00
ifneq (0,$(LTO))
2014-07-22 07:25:54 +00:00
COMPILERFLAGS += -DUSING_LTO
2016-02-07 03:15:46 +00:00
COMMONFLAGS += -flto
2011-03-25 11:42:07 +00:00
endif
2010-12-19 22:29:01 +00:00
else
2014-11-22 18:37:19 +00:00
## Debugging enabled
# Our $(DEBUGANYWAY) -> DEBUGGINGAIDS #define
COMPILERFLAGS += -DDEBUGGINGAIDS=$(DEBUGANYWAY)
ifneq (0,$(CLANG))
ifeq (2,$(DEBUGANYWAY))
COMMONFLAGS += $(CLANG_DEBUG_FLAGS)
endif
Inreased debugging level for catching oob accesses to 'main' arrays.
If enabled, this makes the following arrays be allocated statically:
spriteext, spritesmooth, sector, wall, sprite, tsprite, while
necessarily disabling the clipshape feature (because it relies on
setting sector/wall to different malloc'd block temporarily).
To compile, pass DEBUGANYWAY=1 in addition to RELEASE=0 to 'make',
and it's really only useful with CC=clang, of course.
git-svn-id: https://svn.eduke32.com/eduke32@2270 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-19 23:17:34 +00:00
endif
2012-12-13 02:32:59 +00:00
ifeq ($(SUBPLATFORM),LINUX)
2014-07-22 07:25:54 +00:00
LIBS+=-rdynamic
2011-01-16 07:19:29 +00:00
endif
2014-11-22 18:37:19 +00:00
2011-03-19 17:59:09 +00:00
ifneq (0,$(MUDFLAP))
2014-07-22 07:25:54 +00:00
LIBS+= -lmudflapth
COMMONFLAGS += -fmudflapth
2011-03-19 17:59:09 +00:00
endif
2010-12-19 22:29:01 +00:00
ifneq (0,$(PROFILER))
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
ifneq ($(PLATFORM),DARWIN)
2014-07-22 07:25:54 +00:00
LIBS+= -lprofiler
Win64 support! (Meaning it works, not that we recommend it for everyday use.)
This includes a complete Windows header and library refresh, including the addition of 64-bit compiled libs:
*libogg 1.3.0
*libvorbis 1.3.3
*zlib 1.2.7
*libpng 1.5.13
*libvpx 9a3de881c0e681ba1a79a166a86308bbc84b4acd
*SDL_mixer 1.2.12 (for RENDERTYPE=SDL)
*DirectX import libraries: dsound and dxguid (now included)
To build in 64-bit, you essentially need MinGW's MSYS (but not MinGW itself) and MinGW-w64 at the top of your PATH. The target is automatically detected using `$(CC) -dumpmachine`. The EDukeWiki will get detailed instrucitons.
All compiler and linker warnings when building in 64-bit mode have been fixed.
Remaining 64-bit to-do:
- The ebacktrace dll does not build under 64-bit. It uses code specific to the format of 32-bit executables and will have to be ported to work with 64-bit executables. A future 64-bit version will be named ebacktrace1-64.dll.
- RENDERTYPE=SDL crashes in SDL_mixer's Mix_Linked_Version().
- DirectInput gives an error and does not function. This only affects joysticks, and the error never happens without any plugged in.
- Port the classic renderer ASM to 64-bit. (Just kidding, this is way out of my league.)
This commit includes a fair bit of Makefile development spanning all platforms, including simplifying the SDLCONFIG code, fixing build on Mac OS X (thanks rhoenie!), globally factoring Apple brew/port inclusion, enforcing that all -L come before all -l, and ensuring that $(shell ) is always :='d.
In addition, I have resurrected the old GCC_MAJOR and GCC_MINOR detection using `$(CC) -dumpversion`, but I have made it failsafe in case the command fails or the version is manually specified. I have applied this new fine-grained detection where applicable, including allowing LTO, and restraining -W's to versions that support them.
git-svn-id: https://svn.eduke32.com/eduke32@3278 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 02:37:20 +00:00
endif
2014-07-22 07:25:54 +00:00
COMMONFLAGS += -pg
2010-12-19 22:29:01 +00:00
endif
ifneq (0,$(KRANDDEBUG))
2014-07-22 07:25:54 +00:00
COMPILERFLAGS += -DKRANDDEBUG=1
2010-12-19 22:29:01 +00:00
endif
endif
2016-01-12 10:31:07 +00:00
W_UNINITIALIZED := -Wuninitialized
W_GCC_4_1 := -Wno-attributes
W_GCC_4_2 := $(W_STRICT_OVERFLOW)
W_GCC_4_4 := -Wno-unused-result
W_GCC_4_5 := -Wlogical-op -Wcast-qual
2011-02-12 13:25:24 +00:00
2016-01-12 10:31:07 +00:00
CWARNS = -W -Wall \
2012-07-01 22:11:35 +00:00
-Wextra \
2016-01-12 10:31:07 +00:00
-Wpointer-arith \
2014-07-22 07:25:54 +00:00
-Wno-char-subscripts \
2015-10-10 06:57:51 +00:00
-Wno-missing-braces \
2016-01-11 05:06:10 +00:00
-Wwrite-strings \
2016-01-12 10:31:07 +00:00
$(W_UNINITIALIZED) \
$(W_GCC_4_1) \
$(W_GCC_4_2) \
$(W_GCC_4_4) \
$(W_GCC_4_5) \
2012-07-01 22:11:35 +00:00
#-Wstrict-prototypes \
#-Waggregate-return \
2016-01-11 05:05:50 +00:00
#-Wcast-align \
2016-06-05 04:46:28 +00:00
#-Waddress
2012-07-01 22:11:35 +00:00
2012-05-18 21:40:38 +00:00
ifneq (0,$(CLANG))
2016-01-12 10:31:07 +00:00
CWARNS+= -Wno-unused-value -Wno-parentheses -Wno-unknown-warning-option
else
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \< 4)))
W_GCC_4_5 :=
W_GCC_4_4 :=
ifeq (0,$(OPTLEVEL))
W_UNINITIALIZED :=
endif
W_GCC_4_2 :=
W_GCC_4_1 :=
endif
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) = 4)))
ifeq (1,$(strip $(shell expr $(GCC_MINOR) \< 5)))
W_GCC_4_5 :=
ifeq (1,$(strip $(shell expr $(GCC_MINOR) \< 4)))
W_GCC_4_4 :=
ifeq (0,$(OPTLEVEL))
W_UNINITIALIZED :=
endif
ifeq (1,$(strip $(shell expr $(GCC_MINOR) \< 2)))
W_GCC_4_2 :=
ifeq (1,$(strip $(shell expr $(GCC_MINOR) \< 1)))
W_GCC_4_1 :=
endif
endif
endif
endif
endif
2011-12-09 19:08:47 +00:00
endif
2014-07-22 07:25:54 +00:00
COMMONFLAGS+= -funsigned-char -fno-strict-aliasing $(F_JUMP_TABLES)
2012-12-09 13:24:44 +00:00
2016-01-12 10:31:07 +00:00
COMPILERFLAGS+= $(CWARNS) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
2012-11-10 20:59:00 +00:00
2014-07-22 07:25:54 +00:00
ifeq (0,$(NETCODE))
COMPILERFLAGS+= -DNETCODE_DISABLE
2013-07-20 03:36:54 +00:00
endif
2012-12-13 02:34:30 +00:00
2014-07-22 07:25:54 +00:00
2013-07-13 21:05:05 +00:00
#### Lunatic development
# LuaJIT standalone interpreter executable:
2013-08-11 15:28:42 +00:00
LUAJIT:=luajit
2013-08-18 21:14:37 +00:00
# Options to "luajit -b" for synthesis. Since it runs on Linux, we need to tell
# the native LuaJIT to emit PE object files.
2014-02-10 10:58:38 +00:00
ifeq ($(PLATFORM),WINDOWS)
LUAJIT_BCOPTS := -o windows
2016-06-03 04:50:47 +00:00
ifeq (32,$(BITS))
2014-02-10 10:58:38 +00:00
LUAJIT_BCOPTS += -a x86
endif
2016-06-03 04:50:47 +00:00
ifeq (64,$(BITS))
2014-02-10 10:58:38 +00:00
LUAJIT_BCOPTS += -a x64
endif
2013-08-18 21:14:37 +00:00
endif
2012-11-10 20:59:00 +00:00
ifneq ($(LUNATIC),0)
2014-01-31 21:13:03 +00:00
ifneq ($(CPLUSPLUS),0)
# FIXME: Lunatic C++ doesn't build because otherwise it doesn't find
# INT32_MIN and the like.
2014-07-22 07:25:54 +00:00
COMPILERFLAGS+= -D__STDC_LIMIT_MACROS
2014-01-31 21:13:03 +00:00
endif
2014-07-22 07:25:54 +00:00
COMPILERFLAGS+= -Isource/lunatic -DLUNATIC
2013-10-16 19:43:06 +00:00
ifneq ($(USE_LUAJIT_2_1),0)
2014-07-22 07:25:54 +00:00
COMPILERFLAGS+= -DUSE_LUAJIT_2_1
2013-10-16 19:43:06 +00:00
endif
2012-11-10 20:59:00 +00:00
2013-05-17 10:41:57 +00:00
# Determine size of defs.ilua bytecode once.
ifndef DEFS_BC_SIZE
2014-07-22 07:25:54 +00:00
DEFS_BC_SIZE := $(shell $(LUAJIT) -bg -t h source/lunatic/defs.ilua -)
2013-05-17 10:41:57 +00:00
DEFS_BC_SIZE := $(word 3, $(DEFS_BC_SIZE))
2014-01-02 00:08:36 +00:00
# Pass it to the sub-makes, too.
2013-05-17 10:41:57 +00:00
export DEFS_BC_SIZE
endif
2014-01-02 00:08:36 +00:00
# Determine size of defs_m32.ilua bytecode once.
ifndef DEFS_M32_BC_SIZE
2014-07-22 07:25:54 +00:00
DEFS_M32_BC_SIZE := $(shell $(LUAJIT) -bg -t h source/lunatic/defs_m32.ilua -)
2014-01-02 00:08:36 +00:00
DEFS_M32_BC_SIZE := $(word 3, $(DEFS_M32_BC_SIZE))
export DEFS_M32_BC_SIZE
endif
2014-07-22 07:25:54 +00:00
COMPILERFLAGS+= -DLUNATIC_DEFS_BC_SIZE=$(DEFS_BC_SIZE) -DLUNATIC_DEFS_M32_BC_SIZE=$(DEFS_M32_BC_SIZE)
2013-02-24 16:05:31 +00:00
2012-11-10 20:59:00 +00:00
ifeq ($(PLATFORM),WINDOWS)
2014-07-22 07:25:54 +00:00
LIBS+= -lluajit
2012-11-10 20:59:00 +00:00
else
2014-07-22 07:25:54 +00:00
LIBS+= -lluajit-5.1
2012-11-10 20:59:00 +00:00
endif
endif
####
2012-11-05 02:49:08 +00:00
ifneq (0,$(DISABLEINLINING))
2014-07-22 07:25:54 +00:00
COMPILERFLAGS+= -DDISABLE_INLINING
2012-11-05 02:49:08 +00:00
endif
2012-06-01 20:09:27 +00:00
# This should come from the environment:
ifdef EDUKE32_MY_DEVELOPER_ID
2014-07-22 07:25:54 +00:00
COMPILERFLAGS+= -DMY_DEVELOPER_ID=$(EDUKE32_MY_DEVELOPER_ID)
2012-06-01 20:09:27 +00:00
endif
2011-03-19 18:07:12 +00:00
ifneq (0,$(USE_LIBPNG))
2014-07-22 07:25:54 +00:00
COMPILERFLAGS+= -DUSE_LIBPNG
2011-03-19 18:07:12 +00:00
endif
2011-07-18 19:06:29 +00:00
ifneq (0,$(USE_LIBVPX))
2014-07-22 07:25:54 +00:00
COMPILERFLAGS+= -DUSE_LIBVPX
2011-07-18 19:06:29 +00:00
endif
2010-12-19 22:29:01 +00:00
2016-11-09 22:51:33 +00:00
ifneq (0,$(STARTUP_WINDOW))
COMPILERFLAGS+= -DSTARTUP_WINDOW
endif
2014-11-02 05:34:49 +00:00
ifneq (0,$(HAVE_VORBIS))
COMPILERFLAGS+= -DHAVE_VORBIS
endif
ifneq (0,$(HAVE_FLAC))
COMPILERFLAGS+= -DHAVE_FLAC
endif
2016-11-08 02:59:05 +00:00
ifneq (0,$(HAVE_XMP))
COMPILERFLAGS+= -DHAVE_XMP
endif
2011-10-02 07:16:57 +00:00
ifneq (0,$(EFENCE))
2014-07-22 07:25:54 +00:00
LIBS+= -lefence
COMPILERFLAGS+= -DEFENCE
2011-10-02 07:16:57 +00:00
endif
2012-01-12 20:49:34 +00:00
ifneq (0,$(DMALLOC))
2014-07-22 07:25:54 +00:00
LIBS+= -ldmalloc
COMPILERFLAGS+= -DDMALLOC
2012-01-12 20:49:34 +00:00
endif
2011-10-02 07:16:57 +00:00
2014-07-22 07:25:54 +00:00
# may be overridden
2010-12-19 22:29:01 +00:00
EXESUFFIX=
2014-07-22 07:25:54 +00:00
DLLSUFFIX=.so
SDL_TARGET ?= 2
2014-10-16 21:03:24 +00:00
SDL_FRAMEWORK ?= 0
2014-07-22 07:25:54 +00:00
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \>= 4)))
L_SSP := -lssp
endif
2016-02-13 21:06:15 +00:00
# ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \>= 5)))
# ifneq (0,$(LTO))
# COMMONFLAGS += -fno-lto-odr-type-merging
# endif
# endif
2016-02-07 03:15:46 +00:00
2014-07-22 07:25:54 +00:00
# NOTE: If your setup doesn't have libstdc++, you can try using libsupc++.
# Search for STDCPPLIB below and change it to -lsupc++.
ifeq ($(SUBPLATFORM),LINUX)
COMPILERFLAGS+= -DHAVE_INTTYPES
GTKCOMPAT32=0
# On Linux, we don't need to specify libstdc++ manually, the linker will
# presumably take care for us.
STDCPPLIB:=
ifeq ($(PLATFORM),GCW)
override USE_OPENGL=0
override NOASM=1
endif
ifeq ($(PLATFORM),DINGOO)
override USE_OPENGL=0
override NOASM=1
endif
2016-06-03 04:50:47 +00:00
ifneq ($(findstring i386,$(IMPLICIT_ARCH)),i386)
2014-07-22 07:25:54 +00:00
ifeq (1,$(BUILD32_ON_64))
# On my 64bit Gentoo these are the 32bit emulation libs
LIBDIRS+= -L/emul/linux/x86/usr/lib
COMMONFLAGS+= -m32
# Override WITHOUT_GTK=0
GTKCOMPAT32=1
endif
endif
2014-07-24 14:01:44 +00:00
LIBS+= -lrt
2014-07-22 07:25:54 +00:00
endif
ifeq ($(PLATFORM),DARWIN)
COMPILERFLAGS+= -DUNDERSCORES
2016-05-29 21:11:24 +00:00
ASFORMAT=macho
2014-07-22 07:25:54 +00:00
ASFLAGS+= -DUNDERSCORES
2016-05-29 21:11:24 +00:00
2016-06-03 04:50:47 +00:00
ifeq ($(findstring x86_64,$(IMPLICIT_ARCH)),x86_64)
ASFORMAT+=64
override NOASM=1
2016-05-29 21:11:24 +00:00
endif
2014-07-22 07:25:54 +00:00
2014-10-18 04:50:47 +00:00
# LIBDIRS+= -Lplatform/Apple/lib
# COMPILERFLAGS+= -Iplatform/Apple/include
2014-10-16 21:03:24 +00:00
ifneq ($(shell port --version &>/dev/null; echo $$?),127)
LIBDIRS+= -L/opt/local/lib
COMPILERFLAGS+= -I/opt/local/include
endif
ifneq ($(shell brew --version &>/dev/null; echo $$?),127)
LIBDIRS+= -L/usr/local/lib
COMPILERFLAGS+= -I/usr/local/include
endif
ifneq ($(shell fink --version &>/dev/null; echo $$?),127)
LIBDIRS+= -L/sw/lib
COMPILERFLAGS+= -I/sw/include
endif
2014-07-22 07:25:54 +00:00
STDCPPLIB:=-lstdc++
COMPILERFLAGS += -DHAVE_INTTYPES
2014-10-16 21:03:24 +00:00
DLLSUFFIX=.dylib
2014-07-22 07:25:54 +00:00
GTKCOMPAT32 = 0
2014-07-22 11:19:45 +00:00
WITHOUT_GTK ?= 1
2014-07-22 07:25:54 +00:00
ifeq (1,$(DARWIN9))
COMPILERFLAGS += -DDARWIN9
endif
2014-06-16 23:16:23 +00:00
2016-06-03 04:50:47 +00:00
ifneq ($(findstring x86_64,$(IMPLICIT_ARCH)),x86_64)
LINKERFLAGS += -read_only_relocs suppress
2014-07-22 07:25:54 +00:00
endif
endif
ifeq ($(PLATFORM),WINDOWS)
COMPILERFLAGS+= -DUNDERSCORES -DHAVE_INTTYPES -Iplatform/Windows/include
LINKERFLAGS+= -static-libgcc
2016-05-23 04:47:12 +00:00
ifeq (0,$(CLANG))
L_CXXONLYFLAGS += -static-libstdc++
endif
2016-06-03 04:50:47 +00:00
ASFORMAT=win$(BITS)
2014-07-22 07:25:54 +00:00
ASFLAGS+= -DUNDERSCORES
# Windows types can be SDL or WIN
RENDERTYPE?=SDL
MIXERTYPE?=WIN
ifneq ($(RENDERTYPE),SDL)
ifeq ($(MIXERTYPE),SDL)
2016-06-15 07:08:35 +00:00
override MIXERTYPE:=WIN
2014-07-22 07:25:54 +00:00
endif
endif
WITHOUT_GTK?=1
EXESUFFIX=.exe
DLLSUFFIX=.dll
2014-07-23 07:21:29 +00:00
LIBDIRS+= -Lplatform/Windows/lib$(WINLIB)
2014-07-22 07:25:54 +00:00
LIBS+= -Wl,--enable-auto-import -lmingwex -lgdi32 -lcomctl32 -lwinmm $(L_SSP) -lwsock32 -lws2_32 -lshlwapi
ifeq (0,$(CLANG))
2015-09-27 21:18:06 +00:00
GUI_LIBS += -mwindows
2014-07-22 07:25:54 +00:00
endif
#-lshfolder
STDCPPLIB:=-lstdc++
2016-06-15 07:08:35 +00:00
else
RENDERTYPE?=SDL
MIXERTYPE?=SDL
2014-07-22 07:25:54 +00:00
endif
ifeq ($(PLATFORM),BSD)
2015-03-02 07:54:24 +00:00
COMPILERFLAGS+= -I/usr/local/include
2014-07-22 07:25:54 +00:00
COMPILERFLAGS+= -DHAVE_INTTYPES
STDCPPLIB:=-lstdc++
endif
ifeq ($(PLATFORM),BEOS)
override NOASM=1
STDCPPLIB:=-lstdc++
endif
ifeq ($(PLATFORM),SKYOS)
EXESUFFIX=.app
override NOASM=1
COMPILERFLAGS+= -DUNDERSCORES -I/boot/programs/sdk/include/sdl
SDLCONFIG=
LIBS+= -lSDL -lnet
endif
ifeq ($(PLATFORM),WII)
EXESUFFIX=.elf
override USE_OPENGL=0
override POLYMER=0
override NOASM=1
override WITHOUT_GTK=1
# -msdata=eabi
COMMONFLAGS+= -g -mtune=750 -meabi -mhard-float
COMPILERFLAGS+= -DGEKKO -DHAVE_INTTYPES -D__POWERPC__ -I$(LIBOGC_INC) -I$(PORTLIBS)/include -Iplatform/Wii/include
SDLCONFIG=
SDL_TARGET=1
2014-07-23 07:21:29 +00:00
LIBDIRS += -L$(LIBOGC_LIB) -L$(PORTLIBS)/lib -Lplatform/Wii/lib
2014-07-22 07:25:54 +00:00
endif
ifeq ($(PLATFORM),QNX)
override USE_OPENGL=0
override NOASM=1
STDCPPLIB:=-lstdc++
LIBS+= -lsocket
endif
ifeq ($(PLATFORM),SUNOS)
override USE_OPENGL=0
override NOASM=1
STDCPPLIB:=-lstdc++
LIBS+= -lsocket -lnsl
endif
ifeq ($(PLATFORM),SYLLABLE)
override USE_OPENGL=0
override NOASM=1
endif
ifeq ($(PLATFORM),GCW)
COMPILERFLAGS += -D__OPENDINGUX__
endif
ifeq ($(PLATFORM),DINGOO)
COMPILERFLAGS += -D__OPENDINGUX__
endif
2016-06-03 04:50:47 +00:00
ifneq ($(findstring i386,$(IMPLICIT_ARCH)),i386)
override NOASM=1
endif
2014-07-22 07:25:54 +00:00
ifneq ($(EXESUFFIX_OVERRIDE),)
EXESUFFIX=$(EXESUFFIX_OVERRIDE)
endif
ifneq (0,$(CLANG))
ifneq (,$(STDCPPLIB))
STDCPPLIB:=-Xlinker $(STDCPPLIB)
endif
endif
ifeq ($(RENDERTYPE),SDL)
2016-06-15 07:08:35 +00:00
ifeq ($(SDL_TARGET),2)
SDLCONFIG ?= sdl2-config
SDLNAME ?= SDL2
endif
ifeq ($(SDL_TARGET),1)
SDLCONFIG ?= sdl-config
SDLNAME ?= SDL
ifeq (0,$(RELEASE))
COMPILERFLAGS += -DNOSDLPARACHUTE
endif
endif
2014-07-22 07:25:54 +00:00
2016-06-15 07:08:35 +00:00
ifneq ($(strip $(SDLCONFIG)),)
ifeq ($(strip $(shell $(SDLCONFIG) --version $(DONT_PRINT_STDERR))),)
override SDLCONFIG =
endif
2014-07-22 07:25:54 +00:00
endif
2016-06-15 07:08:35 +00:00
COMPILERFLAGS += -DSDL_TARGET=$(SDL_TARGET)
2014-07-22 07:25:54 +00:00
2016-06-15 07:08:35 +00:00
ifneq ($(SDL_FRAMEWORK),0)
ifeq ($(PLATFORM),DARWIN)
LIBDIRS += -F$(APPLE_FRAMEWORKS)
ifeq ($(MIXERTYPE),SDL)
COMPILERFLAGS += -I$(APPLE_FRAMEWORKS)/$(SDLNAME)_mixer.framework/Headers
LIBS += -Wl,-framework,$(SDLNAME)_mixer
2014-07-22 07:25:54 +00:00
endif
2016-06-15 07:08:35 +00:00
COMPILERFLAGS += -I$(APPLE_FRAMEWORKS)/$(SDLNAME).framework/Headers
LIBS += -Wl,-framework,$(SDLNAME) -Wl,-rpath -Wl,"@loader_path/../Frameworks"
2014-07-22 07:25:54 +00:00
endif
else
2016-06-15 07:08:35 +00:00
ifeq ($(MIXERTYPE),SDL)
LIBS += -l$(SDLNAME)_mixer
endif
ifneq ($(SDLCONFIG),)
SDLCONFIG_CFLAGS := $(strip $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags)))
SDLCONFIG_LIBS := $(strip $(subst -mwindows,,$(shell $(SDLCONFIG) --libs)))
COMMONFLAGS += $(SDLCONFIG_CFLAGS)
LIBS += $(SDLCONFIG_LIBS)
else
ifeq ($(SDL_TARGET),1)
COMPILERFLAGS += -D_GNU_SOURCE=1
2014-07-22 07:25:54 +00:00
endif
2016-06-15 07:08:35 +00:00
COMPILERFLAGS += -D_REENTRANT -DSDL_USEFOLDER
LIBS+= -l$(SDLNAME)
2014-07-22 07:25:54 +00:00
endif
endif
ifeq (1,$(WITHOUT_GTK))
HAVE_GTK2=0
else
2014-07-22 11:19:25 +00:00
ifneq (No,$(shell $(PKG_CONFIG) --exists gtk+-2.0 || echo No))
2014-07-22 07:25:54 +00:00
HAVE_GTK2=1
# On my 64bit Gentoo box I have Cairo enabled which means the libs list includes
# -lpangocairo-1.0 and -lcairo, however the 32bit compatibility libraries don't
# include cairo, so we need to filter out those -l switches in order to link
ifneq ($(LINKED_GTK),0)
ifeq ($(GTKCOMPAT32),1)
2014-07-22 11:19:25 +00:00
LIBS+= $(shell $(PKG_CONFIG) --libs gtk+-2.0 | sed 's/\s-l\(pango\)\{0,1\}cairo\S*\s/ /g')
2014-07-22 07:25:54 +00:00
else
2014-07-22 11:19:25 +00:00
LIBS+= $(shell $(PKG_CONFIG) --libs gtk+-2.0)
2014-07-22 07:25:54 +00:00
endif
endif
2014-07-22 11:19:25 +00:00
COMPILERFLAGS += -DHAVE_GTK2 $(shell $(PKG_CONFIG) --cflags gtk+-2.0)
2014-07-22 07:25:54 +00:00
else
HAVE_GTK2=0
endif
endif
2016-06-15 07:08:35 +00:00
ifeq ($(PLATFORM),WINDOWS)
LIBS += -ldxguid_sdl -lmingw32 -lgdi32 -limm32 -lole32 -loleaut32 -lwinmm -lversion
2014-07-22 07:25:54 +00:00
endif
endif
ifeq ($(RENDERTYPE),WIN)
LIBS+= -ldxguid
endif
ifeq ($(PLATFORM),WII)
LIBS+= -laesnd_tueidj -lpng -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard
endif
2016-01-12 10:31:07 +00:00
COMPILERFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1 -DMIXERTYPE$(MIXERTYPE)=1
2014-07-22 07:25:54 +00:00
ifneq (0,$(USE_OPENGL))
COMPILERFLAGS+= -DUSE_OPENGL
endif
ifneq (0,$(NOASM))
COMPILERFLAGS+= -DNOASM
endif
ifneq (0,$(USE_ASM64))
COMPILERFLAGS+= -DUSE_ASM64
endif
ifneq (0,$(LINKED_GTK))
COMPILERFLAGS+= -DLINKED_GTK
endif
ifneq (0,$(POLYMER))
ifneq (0,$(USE_OPENGL))
COMPILERFLAGS+= -DPOLYMER
endif
endif
ifneq ($(PLATFORM),WINDOWS)
ifneq ($(PLATFORM),WII)
2015-03-02 07:54:24 +00:00
ifneq ($(PLATFORM),BSD)
LIBS+= -ldl
endif
2014-10-25 10:17:15 +00:00
ifneq ($(PLATFORM),DARWIN)
LIBS+= -pthread
endif
2014-10-16 21:03:24 +00:00
endif
2014-07-22 07:25:54 +00:00
endif
ifeq ($(PLATFORM),WINDOWS)
ifneq ($(USE_LIBPNG),0)
LIBS+= -lpng_mini -lz_mini
endif
else
ifeq ($(PLATFORM),DARWIN)
ifneq ($(USE_LIBPNG),0)
LIBS+= -lpng # -lz
endif
else
ifneq ($(USE_LIBPNG),0)
LIBS+= -lpng -lz
endif
endif
endif
ifeq ($(PLATFORM),WINDOWS)
ifneq ($(findstring x86_64,$(COMPILERTARGET)),x86_64)
LINKERFLAGS+= -Wl,--large-address-aware
endif
endif
ifneq (0,$(MEMMAP))
ifeq ($(PLATFORM),DARWIN)
LINKERFLAGS+=-Wl,-map -Wl,$@.memmap
else
LINKERFLAGS+=-Wl,-Map=$@.memmap
endif
endif
ifneq (0,$(PROFILER))
LINKERFLAGS+=-pg
endif
ifeq ($(PLATFORM),WII)
LINKERFLAGS+= -mrvl -meabi -mhard-float -Wl,--gc-sections
# -msdata=eabi
endif
2014-07-28 08:59:58 +00:00
# Detect version control revision, if applicable
ifeq (,$(VC_REV))
ifneq (,$(wildcard EDUKE32_REVISION))
VC_REV := $(shell cat EDUKE32_REVISION)
endif
endif
ifeq (,$(VC_REV))
VC_REV := $(shell svn info 2>&1 | grep Revision | cut -d' ' -f2)
endif
ifeq (,$(VC_REV))
VC_REV := $(shell git svn info 2>&1 | grep Revision | cut -d' ' -f2)
endif
ifneq (,$(VC_REV)$(VC_REV_CUSTOM))
REVFLAG += -DREV="\"r$(VC_REV)$(VC_REV_CUSTOM)\""
endif
2014-07-22 07:25:54 +00:00
COMPILER=$(CC) $(CONLYFLAGS)
2015-04-26 00:58:08 +00:00
COMPILER_OBJC=$(COBJC) $(CONLYFLAGS)
2016-05-23 04:47:12 +00:00
LINKER=$(L_CC) $(CONLYFLAGS)
2014-07-22 07:25:54 +00:00
ifneq ($(CPLUSPLUS),0)
2016-05-23 04:47:06 +00:00
COMPILER=$(CXX) $(CXXONLYFLAGS)
2016-06-03 04:50:55 +00:00
COMPILER_OBJC=$(COBJCXX) $(CXXONLYFLAGS)
2016-05-23 04:47:12 +00:00
LINKER=$(L_CXX) $(CXXONLYFLAGS) $(L_CXXONLYFLAGS)
2014-07-22 07:25:54 +00:00
endif
2014-06-16 23:16:23 +00:00
ifneq (,$(CUSTOMOPT))
2014-07-22 07:25:54 +00:00
COMMONFLAGS+= $(CUSTOMOPT)
endif
ifneq (,$(CFLAGS))
COMMONFLAGS+= $(CFLAGS)
endif
2014-07-22 11:19:25 +00:00
ifneq (,$(CXXFLAGS))
2016-05-23 04:47:06 +00:00
CXXONLYFLAGS+= $(CXXFLAGS)
2014-07-22 11:19:25 +00:00
endif
ifneq (,$(LDFLAGS))
LINKERFLAGS+= $(LDFLAGS)
endif
2014-07-22 07:25:54 +00:00
ifeq ($(PRETTY_OUTPUT),1)
RECIPE_IF = if
BUILD_SETTINGS_COMPILER = \033[1;36mcompiler: \033[0;36m\"$(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS)\"
BUILD_SETTINGS_ASSEMBLER = \033[1;36massembler: \033[0;36m\"$(AS) $(ASFLAGS)\"
2016-05-23 04:47:09 +00:00
BUILD_SETTINGS_LINKER = \033[1;36mlinker: \033[0;36m\"$(LINKER) $(COMMONFLAGS) $(LINKERFLAGS) $(LIBDIRS) $(LIBS) $(STDCPPLIB)\"
2014-07-22 07:25:54 +00:00
ifeq (0,$(NOASM))
BUILD_SETTINGS = printf "$(BUILD_SETTINGS_COMPILER)\n$(BUILD_SETTINGS_ASSEMBLER)\n$(BUILD_SETTINGS_LINKER)\033[0m\n"
else
BUILD_SETTINGS = printf "$(BUILD_SETTINGS_COMPILER)\n$(BUILD_SETTINGS_LINKER)\033[0m\n"
endif
BUILD_STARTED = printf "\033[K\033[1;36mBuild started using:\033[0m\n"; $(BUILD_SETTINGS)
BUILD_ECHOFLAGS = printf "\033[K\033[1;36mEnded compilation in this directory using:\n$(BUILD_SETTINGS_COMPILER)\033[0m\n"
COMPILE_STATUS = printf "\033[K\033[0mBuilding object \033[1m$@\033[0m...\033[0m\r"
COMPILE_OK = printf "\033[K\033[0;32mBuilt object \033[1;32m$@\033[0;32m \033[0m\n"
COMPILE_FAILED = printf "\033[K\033[0;31mFailed building \033[1;31m$@\033[0;31m from\033[0m \033[1;31m$<\033[0;31m!\033[0m\n"; exit 1
RECIPE_RESULT_COMPILE = ; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
2015-07-08 03:34:34 +00:00
ONESTEP_STATUS = printf "\033[K\033[0mBuilding \033[1m$@\033[0m...\033[0m\r"
ONESTEP_OK = printf "\033[K\033[0;32mBuilt \033[1;32m$@\033[0;32m \033[0m\n"
ONESTEP_FAILED = printf "\033[K\033[0;31mFailed building \033[1;31m$@\033[0;31m!\033[0m\n"; exit 1
2014-07-22 07:25:54 +00:00
RECIPE_RESULT_ONESTEP = ; then $(ONESTEP_OK); else $(ONESTEP_FAILED); fi
ARCHIVE_STATUS = printf "\033[K\033[0mCreating library archive \033[1m$@\033[0m...\033[0m\r"
ARCHIVE_OK = printf "\033[K\033[0;32mCreated library archive \033[1;32m$@\033[0;32m \033[0m\n"
ARCHIVE_FAILED = printf "\033[K\033[0;31mFailed creating library archive \033[1;31m$@\033[0;31m from\033[0m \033[1;31m$<\033[0;31m!\033[0m\n"; exit 1
RECIPE_RESULT_ARCHIVE = ; then $(ARCHIVE_OK); else $(ARCHIVE_FAILED); fi
2015-07-08 03:34:34 +00:00
LINK_STATUS = printf "\033[K\033[0;0mLinking \033[1m$@\033[0;0m...\033[0m\r"
LINK_OK = printf "\033[K\033[0;32mLinked \033[1;32m$@\033[0;32m \033[0m\n"
2016-02-02 00:20:59 +00:00
LINK_FAILED = printf "\033[K\033[0;31mFailed linking \033[1;31m$@\033[0;31m!\nIf the build options, environment, or system packages have changed, run \'\033[1;31mmake clean\033[0;31m\' and try again.\033[0m\n"; exit 1
2014-07-22 07:25:54 +00:00
RECIPE_RESULT_LINK = ; then $(LINK_OK); else $(LINK_FAILED); fi
else
RECIPE_IF =
BUILD_STARTED =
BUILD_ECHOFLAGS =
COMPILE_STATUS =
COMPILE_OK = true
COMPILE_FAILED = false; exit 1
RECIPE_RESULT_COMPILE =
ONESTEP_STATUS =
ONESTEP_OK = true
ONESTEP_FAILED = false; exit 1
RECIPE_RESULT_ONESTEP =
ARCHIVE_STATUS =
ARCHIVE_OK = true
ARCHIVE_FAILED = false; exit 1
RECIPE_RESULT_ARCHIVE =
LINK_STATUS =
LINK_OK = true
LINK_FAILED = false; exit 1
RECIPE_RESULT_LINK =
2014-06-16 23:16:23 +00:00
endif