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 =
2017-03-22 15:46:01 +00:00
CROSS_SUFFIX =
i f n e q ( $( CROSS ) $( CROSS_SUFFIX ) , )
2014-07-22 11:19:25 +00:00
undefine CC
undefine CXX
undefine AR
undefine RC
undefine RANLIB
undefine STRIP
e n d i f
2017-03-22 15:46:01 +00:00
CC = $( CROSS) gcc$( CROSS_SUFFIX)
CXX = $( CROSS) g++$( CROSS_SUFFIX)
AR = $( CROSS) ar$( CROSS_SUFFIX)
RC = $( CROSS) windres$( CROSS_SUFFIX)
RANLIB = $( CROSS) ranlib$( CROSS_SUFFIX)
STRIP = $( CROSS) strip$( CROSS_SUFFIX)
2014-10-19 00:44:23 +00:00
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.
i f e q ( $( CC ) , c c )
override CC = gcc
e n d i f
i f e q ( $( AS ) , a s )
override AS = nasm
e n d i f
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
i f e q ( $( PLATFORM ) , W I I )
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
e n d i f
2014-10-16 21:03:24 +00:00
CLANG ?= 0
CLANG_POTENTIAL_VERSION := $( shell $( CCFULLPATH) --version)
i f e q ( $( findstring clang ,$ ( CC ) ) , c l a n g )
override CLANG = 1
2016-09-16 21:55:42 +00:00
CLANGNAME:= $( CC)
e l s e
CLANGNAME:= clang
2014-10-16 21:03:24 +00:00
e n d i f
# detect clang symlinked as gcc, as in OS X
i f e q ( $( findstring clang ,$ ( CLANG_POTENTIAL_VERSION ) ) , c l a n g )
override CLANG = 1
e n d i f
i f n e q ( 0 , $( CLANG ) )
2017-03-22 15:46:04 +00:00
CLANGXXNAME:= $( subst clang,clang++,$( CLANGNAME) )
2016-09-16 21:55:42 +00:00
override CC = $( CLANGNAME) -x c
2017-03-22 15:46:04 +00:00
override CXX = $( CLANGXXNAME) -x c++
2016-09-16 21:55:42 +00:00
override COBJC = $( CLANGNAME) -x objective-c
2017-03-22 15:46:04 +00:00
override COBJCXX = $( CLANGXXNAME) -x objective-c++
2016-09-16 21:55:42 +00:00
override L_CC = $( CLANGNAME)
2017-03-22 15:46:04 +00:00
override L_CXX = $( CLANGXXNAME)
2014-10-16 21:03:24 +00:00
e n d i f
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
i f n d e f G C C _ M A J O R
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
e n d i f
i f e q ( $( GCC_MAJOR ) , )
GCC_MAJOR := 4
e n d i f
i f n d e f G C C _ M I N O R
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
e n d i f
i f e q ( $( 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
e n d i f
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
i f n d e f H O S T P L A T F O R M
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
e n d i f
2014-12-09 23:56:31 +00:00
i f n d e f P L A T F O R M
2015-03-02 07:54:24 +00:00
PLATFORM = $( HOSTPLATFORM)
2014-12-09 23:56:31 +00:00
e n d i f
2012-10-29 04:26:25 +00:00
2012-12-13 02:32:59 +00:00
i f n d e f S U B P L A T F O R M
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
e n d i f
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
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
#
2017-01-23 11:21:42 +00:00
APPNAME =
APPBASENAME =
2017-01-18 22:21:08 +00:00
STANDALONE ?= 0
2010-12-19 22:29:01 +00:00
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
i f e q ( $( PLATFORM ) , W I N D O W S )
HAVE_XMP ?= 1
e l s e
HAVE_XMP ?= 0
e n d i f
2012-12-09 13:24:44 +00:00
NETCODE ?= 1
2016-11-09 22:51:33 +00:00
STARTUP_WINDOW ?= 1
2017-01-18 22:21:40 +00:00
SIMPLE_MENU ?= 0
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
i f e q ( 0 , $( USE_OPENGL ) )
2017-01-23 11:20:08 +00:00
override POLYMER = 0
override USE_LIBVPX = 0
2010-12-19 22:29:01 +00:00
e n d i f
# 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
i f e q ( $( RELEASE ) , 0 )
2013-05-04 16:36:10 +00:00
OPTLEVEL?= 0
e l s e
OPTLEVEL?= 2
e n d i f
2013-01-20 21:17:36 +00:00
i f e q ( $( RELEASE ) , 0 )
2013-01-21 21:18:10 +00:00
override STRIP =
2013-01-20 21:17:36 +00:00
e n d i f
i f n e q ( $( DEBUGANYWAY ) , 0 )
2013-01-21 21:18:10 +00:00
override STRIP =
2013-01-20 21:17:36 +00:00
e n d i f
2013-07-13 21:05:05 +00:00
i f n e q ( $( LUNATIC ) , 0 )
# FIXME: Lunatic builds with LTO don't start up properly as the required
# symbol names are apparently not exported.
override LTO = 0
e n d i f
2012-11-06 07:49:44 +00:00
i f n d e f L T O
LTO = 1
ifneq ( 0,$( CLANG) )
ifeq ( $( PLATFORM) , WINDOWS)
LTO = 0
endif
endif
e n d i f
2017-03-23 03:03:39 +00:00
COMMONFLAGS =
COMPILERFLAGS = -funsigned-char
2014-07-22 07:25:54 +00:00
2014-07-22 11:19:25 +00:00
i f e q ( $( PACKAGE_REPOSITORY ) , 0 )
COMMONFLAGS += $( OPTIMIZATIONS)
2014-07-22 07:25:54 +00:00
e n d i f
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
i f e q ( 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
e n d i f
2014-07-22 07:25:54 +00:00
i f n e q ( $( RELEASE ) $( DEBUGANYWAY ) , 1 0 )
# 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
e n d i f
2017-03-23 03:03:21 +00:00
CSTD := -std= gnu99
2017-03-22 15:45:56 +00:00
CONLYFLAGS = $( CSTD)
2017-03-23 03:03:21 +00:00
CXXSTD := -std= gnu++03
2017-02-19 22:16:00 +00:00
CXXONLYFLAGS = $( CXXSTD) -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
i f e q ( 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
e n d i f
2016-01-12 10:31:07 +00:00
W_STRICT_OVERFLOW := -Wno-strict-overflow
2015-03-02 07:54:24 +00:00
i f e q ( $( HOSTPLATFORM ) , W I N D O W S )
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
e n d i f
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
i f e q ( $( PLATFORM ) , W I N D O W S )
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)
e l s e i f e q ( $( PLATFORM ) , W I I )
IMPLICIT_ARCH = ppc
2016-10-29 16:59:28 +00:00
e l s e
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
e n d i f
2012-10-29 04:26:25 +00:00
i f e q ( $( PLATFORM ) , D A R W I N )
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
2017-01-01 17:44:56 +00:00
COMMONFLAGS += $( ARCH)
2012-10-29 04:26:25 +00:00
e n d i f
2014-07-22 07:25:54 +00:00
2014-07-24 14:01:44 +00:00
i f n e q ( 0 , $( RELEASE ) )
# Debugging disabled
COMMONFLAGS += $( F_NO_STACK_PROTECTOR)
e l s e
# Debugging enabled
ifneq ( 0,$( KRANDDEBUG) )
COMMONFLAGS += -fno-inline -fno-inline-functions -fno-inline-functions-called-once
endif
e n d i f
2012-10-29 04:26:25 +00:00
i f n d e f O P T O P T
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
e n d i f
2010-12-19 22:29:01 +00:00
i f n e q ( 0 , $( KRANDDEBUG ) )
RELEASE = 0
e n d i f
i f n e q ( 0 , $( PROFILER ) )
2014-11-22 18:37:19 +00:00
# XXX: Why?
2010-12-19 22:29:01 +00:00
DEBUGANYWAY = 1
e n d i f
2012-05-20 07:25:25 +00:00
i f e q ( $( PLATFORM ) , W I I )
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
e n d i f
2013-07-20 03:36:54 +00:00
i f e q ( $( PLATFORM ) , G C W )
override USE_LIBVPX = 0
e n d i f
i f e q ( $( PLATFORM ) , D I N G O O )
override USE_LIBVPX = 0
e n d i f
2012-05-20 07:25:25 +00:00
2011-07-18 19:06:29 +00:00
i f n e q ( 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
e n d i f
2011-03-19 18:07:12 +00:00
2012-01-28 14:36:52 +00:00
2014-02-08 14:37:41 +00:00
i f n e q ( $( 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
e n d i f
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
i f n e q ( 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
e l s e
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
e n d i f
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
2017-03-22 15:45:56 +00:00
CONLYWARNS = -Wimplicit -Werror-implicit-function-declaration
2012-05-18 21:40:38 +00:00
i f n e q ( 0 , $( CLANG ) )
2016-01-12 10:31:07 +00:00
CWARNS += -Wno-unused-value -Wno-parentheses -Wno-unknown-warning-option
e l s e
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
e n d i f
2017-03-23 03:03:39 +00:00
COMMONFLAGS += -fno-strict-aliasing $( F_JUMP_TABLES)
2012-12-09 13:24:44 +00:00
2017-03-22 15:45:54 +00:00
COMPILERFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE= 0
2012-11-10 20:59:00 +00:00
2014-07-22 07:25:54 +00:00
i f e q ( 0 , $( NETCODE ) )
COMPILERFLAGS += -DNETCODE_DISABLE
2013-07-20 03:36:54 +00:00
e n d i f
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
i f e q ( $( PLATFORM ) , W I N D O W S )
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
e n d i f
2012-11-10 20:59:00 +00:00
i f n e q ( $( LUNATIC ) , 0 )
2017-02-01 10:20:54 +00:00
COMPILERFLAGS += -Isource/duke3d/src/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
2017-02-01 10:20:54 +00:00
# Determine size of _defs*.lua bytecode once.
2013-05-17 10:41:57 +00:00
ifndef DEFS_BC_SIZE
2017-02-01 10:20:54 +00:00
DEFS_BC_SIZE := $( shell $( LUAJIT) -bg -t h source/duke3d/src/lunatic/_defs_game.lua -)
2013-05-17 10:41:57 +00:00
DEFS_BC_SIZE := $( word 3, $( DEFS_BC_SIZE) )
endif
2014-01-02 00:08:36 +00:00
ifndef DEFS_M32_BC_SIZE
2017-02-01 10:20:54 +00:00
DEFS_M32_BC_SIZE := $( shell $( LUAJIT) -bg -t h source/duke3d/src/lunatic/_defs_editor.lua -)
2014-01-02 00:08:36 +00:00
DEFS_M32_BC_SIZE := $( word 3, $( 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
e n d i f
####
2012-11-05 02:49:08 +00:00
i f n e q ( 0 , $( DISABLEINLINING ) )
2014-07-22 07:25:54 +00:00
COMPILERFLAGS += -DDISABLE_INLINING
2012-11-05 02:49:08 +00:00
e n d i f
2012-06-01 20:09:27 +00:00
# This should come from the environment:
i f d e f E D U K E 3 2 _ M Y _ D E V E L O P E R _ I D
2014-07-22 07:25:54 +00:00
COMPILERFLAGS += -DMY_DEVELOPER_ID= $( EDUKE32_MY_DEVELOPER_ID)
2012-06-01 20:09:27 +00:00
e n d i f
2011-03-19 18:07:12 +00:00
i f n e q ( 0 , $( USE_LIBPNG ) )
2014-07-22 07:25:54 +00:00
COMPILERFLAGS += -DUSE_LIBPNG
2011-03-19 18:07:12 +00:00
e n d i f
2011-07-18 19:06:29 +00:00
i f n e q ( 0 , $( USE_LIBVPX ) )
2014-07-22 07:25:54 +00:00
COMPILERFLAGS += -DUSE_LIBVPX
2011-07-18 19:06:29 +00:00
e n d i f
2010-12-19 22:29:01 +00:00
2016-11-09 22:51:33 +00:00
i f n e q ( 0 , $( STARTUP_WINDOW ) )
COMPILERFLAGS += -DSTARTUP_WINDOW
e n d i f
2017-01-18 22:21:40 +00:00
i f n e q ( 0 , $( SIMPLE_MENU ) )
COMPILERFLAGS += -DEDUKE32_SIMPLE_MENU
e n d i f
2014-11-02 05:34:49 +00:00
i f n e q ( 0 , $( HAVE_VORBIS ) )
COMPILERFLAGS += -DHAVE_VORBIS
e n d i f
i f n e q ( 0 , $( HAVE_FLAC ) )
COMPILERFLAGS += -DHAVE_FLAC
e n d i f
2016-11-08 02:59:05 +00:00
i f n e q ( 0 , $( HAVE_XMP ) )
COMPILERFLAGS += -DHAVE_XMP
e n d i f
2011-10-02 07:16:57 +00:00
i f n e q ( 0 , $( EFENCE ) )
2014-07-22 07:25:54 +00:00
LIBS += -lefence
COMPILERFLAGS += -DEFENCE
2011-10-02 07:16:57 +00:00
e n d i f
2012-01-12 20:49:34 +00:00
i f n e q ( 0 , $( DMALLOC ) )
2014-07-22 07:25:54 +00:00
LIBS += -ldmalloc
COMPILERFLAGS += -DDMALLOC
2012-01-12 20:49:34 +00:00
e n d i f
2017-01-18 22:21:08 +00:00
i f n e q ( 0 , $( STANDALONE ) )
COMPILERFLAGS += -DEDUKE32_STANDALONE
e n d i f
2011-10-02 07:16:57 +00:00
2017-01-23 11:21:42 +00:00
i f n e q ( , $( APPNAME ) )
COMPILERFLAGS += -DAPPNAME= \" $( APPNAME) \"
e n d i f
i f n e q ( , $( APPBASENAME ) )
COMPILERFLAGS += -DAPPBASENAME= \" $( APPBASENAME) \"
e n d i f
2017-01-18 22:20:58 +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
i f e q ( 1 , $( strip $ ( shell expr $ ( GCC_MAJOR ) \>= 4) ) )
L_SSP := -lssp
e n d i f
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
i f e q ( $( SUBPLATFORM ) , L I N U X )
GTKCOMPAT32 = 0
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
e n d i f
i f e q ( $( PLATFORM ) , D A R W I N )
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
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
e n d i f
i f e q ( $( PLATFORM ) , W I N D O W S )
2017-02-25 08:15:20 +00:00
COMPILERFLAGS += -DUNDERSCORES -Iplatform/Windows/include
2014-07-22 07:25:54 +00:00
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
2016-06-15 07:08:35 +00:00
e l s e
RENDERTYPE?= SDL
MIXERTYPE?= SDL
2014-07-22 07:25:54 +00:00
e n d i f
i f e q ( $( PLATFORM ) , B S D )
2015-03-02 07:54:24 +00:00
COMPILERFLAGS += -I/usr/local/include
2014-07-22 07:25:54 +00:00
e n d i f
i f e q ( $( PLATFORM ) , B E O S )
override NOASM = 1
e n d i f
i f e q ( $( PLATFORM ) , S K Y O S )
EXESUFFIX = .app
override NOASM = 1
COMPILERFLAGS += -DUNDERSCORES -I/boot/programs/sdk/include/sdl
SDLCONFIG =
LIBS += -lSDL -lnet
e n d i f
i f e q ( $( PLATFORM ) , W I I )
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
2017-02-25 08:15:20 +00:00
COMPILERFLAGS += -DGEKKO -D__POWERPC__ -I$( LIBOGC_INC) -I$( PORTLIBS) /include -Iplatform/Wii/include
2014-07-22 07:25:54 +00:00
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
e n d i f
i f e q ( $( PLATFORM ) , Q N X )
override USE_OPENGL = 0
override NOASM = 1
LIBS += -lsocket
e n d i f
i f e q ( $( PLATFORM ) , S U N O S )
override USE_OPENGL = 0
override NOASM = 1
LIBS += -lsocket -lnsl
e n d i f
i f e q ( $( PLATFORM ) , S Y L L A B L E )
override USE_OPENGL = 0
override NOASM = 1
e n d i f
i f e q ( $( PLATFORM ) , G C W )
COMPILERFLAGS += -D__OPENDINGUX__
e n d i f
i f e q ( $( PLATFORM ) , D I N G O O )
COMPILERFLAGS += -D__OPENDINGUX__
e n d i f
2016-06-03 04:50:47 +00:00
i f n e q ( $( findstring i 386,$ ( IMPLICIT_ARCH ) ) , i 3 8 6 )
override NOASM = 1
e n d i f
2014-07-22 07:25:54 +00:00
i f n e q ( $( EXESUFFIX_OVERRIDE ) , )
EXESUFFIX = $( EXESUFFIX_OVERRIDE)
e n d i f
i f e q ( $( RENDERTYPE ) , S D L )
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
e n d i f
i f e q ( $( RENDERTYPE ) , W I N )
LIBS += -ldxguid
e n d i f
i f e q ( $( PLATFORM ) , W I I )
LIBS += -laesnd_tueidj -lpng -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard
e n d i f
2016-01-12 10:31:07 +00:00
COMPILERFLAGS += -DRENDERTYPE$( RENDERTYPE) = 1 -DMIXERTYPE$( MIXERTYPE) = 1
2014-07-22 07:25:54 +00:00
i f n e q ( 0 , $( USE_OPENGL ) )
COMPILERFLAGS += -DUSE_OPENGL
e n d i f
i f n e q ( 0 , $( NOASM ) )
COMPILERFLAGS += -DNOASM
e n d i f
i f n e q ( 0 , $( USE_ASM 64) )
COMPILERFLAGS += -DUSE_ASM64
e n d i f
i f n e q ( 0 , $( LINKED_GTK ) )
COMPILERFLAGS += -DLINKED_GTK
e n d i f
i f n e q ( 0 , $( POLYMER ) )
ifneq ( 0,$( USE_OPENGL) )
COMPILERFLAGS += -DPOLYMER
endif
e n d i f
i f n e q ( $( PLATFORM ) , W I N D O W S )
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
e n d i f
i f e q ( $( PLATFORM ) , W I N D O W S )
ifneq ( $( USE_LIBPNG) ,0)
LIBS += -lpng_mini -lz_mini
endif
e l s e
ifeq ( $( PLATFORM) ,DARWIN)
ifneq ( $( USE_LIBPNG) ,0)
LIBS += -lpng # -lz
endif
else
ifneq ( $( USE_LIBPNG) ,0)
LIBS += -lpng -lz
endif
endif
e n d i f
i f e q ( $( PLATFORM ) , W I N D O W S )
ifneq ( $( findstring x86_64,$( COMPILERTARGET) ) ,x86_64)
LINKERFLAGS += -Wl,--large-address-aware
endif
e n d i f
i f n e q ( 0 , $( MEMMAP ) )
i f e q ( $( PLATFORM ) , D A R W I N )
LINKERFLAGS += -Wl,-map -Wl,$@ .memmap
e l s e
LINKERFLAGS += -Wl,-Map= $@ .memmap
e n d i f
e n d i f
i f n e q ( 0 , $( PROFILER ) )
LINKERFLAGS += -pg
e n d i f
i f e q ( $( PLATFORM ) , W I I )
LINKERFLAGS += -mrvl -meabi -mhard-float -Wl,--gc-sections
# -msdata=eabi
e n d i f
2014-07-28 08:59:58 +00:00
# Detect version control revision, if applicable
i f e q ( , $( VC_REV ) )
ifneq ( ,$( wildcard EDUKE32_REVISION) )
VC_REV := $( shell cat EDUKE32_REVISION)
endif
e n d i f
i f e q ( , $( VC_REV ) )
VC_REV := $( shell svn info 2>& 1 | grep Revision | cut -d' ' -f2)
e n d i f
i f e q ( , $( VC_REV ) )
VC_REV := $( shell git svn info 2>& 1 | grep Revision | cut -d' ' -f2)
e n d i f
i f n e q ( , $( VC_REV ) $( VC_REV_CUSTOM ) )
REVFLAG += -DREV= " \"r $( VC_REV) $( VC_REV_CUSTOM) \" "
e n d i f
2017-03-22 15:45:59 +00:00
COMPILER_C = $( CC) $( CONLYFLAGS) $( COMMONFLAGS) $( CWARNS) $( CONLYWARNS) $( COMPILERFLAGS) $( CUSTOMOPT)
COMPILER_CXX = $( CXX) $( CXXONLYFLAGS) $( COMMONFLAGS) $( CWARNS) $( COMPILERFLAGS) $( CUSTOMOPT)
COMPILER_OBJC = $( COBJC) $( CONLYFLAGS) $( COMMONFLAGS) $( CWARNS) $( CONLYWARNS) $( COMPILERFLAGS) $( CUSTOMOPT)
COMPILER_OBJCXX = $( COBJCXX) $( CXXONLYFLAGS) $( COMMONFLAGS) $( CWARNS) $( COMPILERFLAGS) $( CUSTOMOPT)
LINKER = $( L_CXX) $( CXXONLYFLAGS) $( L_CXXONLYFLAGS) $( COMMONFLAGS) $( LINKERFLAGS) $( CUSTOMOPT)
2014-07-22 07:25:54 +00:00
i f n e q ( $( CPLUSPLUS ) , 0 )
2017-02-01 10:20:54 +00:00
COMPILER_C = $( COMPILER_CXX)
COMPILER_OBJC = $( COMPILER_OBJCXX)
2014-07-22 07:25:54 +00:00
e n d i f
2014-06-16 23:16:23 +00:00
2014-07-22 07:25:54 +00:00
i f n e q ( , $( CFLAGS ) )
COMMONFLAGS += $( CFLAGS)
e n d i f
2014-07-22 11:19:25 +00:00
i f n e q ( , $( CXXFLAGS ) )
2016-05-23 04:47:06 +00:00
CXXONLYFLAGS += $( CXXFLAGS)
2014-07-22 11:19:25 +00:00
e n d i f
i f n e q ( , $( LDFLAGS ) )
LINKERFLAGS += $( LDFLAGS)
e n d i f
2014-07-22 07:25:54 +00:00
i f e q ( $( PRETTY_OUTPUT ) , 1 )
RECIPE_IF = if
2017-03-22 15:45:49 +00:00
BUILD_SETTINGS_COMPILER = \0 33[ 1; 36mcompiler: \0 33[ 0; 36m\" $( COMPILER_C) \"
2014-07-22 07:25:54 +00:00
BUILD_SETTINGS_ASSEMBLER = \0 33[ 1; 36massembler: \0 33[ 0; 36m\" $( AS) $( ASFLAGS) \"
2017-03-22 15:45:49 +00:00
BUILD_SETTINGS_LINKER = \0 33[ 1; 36mlinker: \0 33[ 0; 36m\" $( LINKER) $( GUI_LIBS) $( LIBDIRS) $( LIBS) \"
2014-07-22 07:25:54 +00:00
i f e q ( 0 , $( NOASM ) )
BUILD_SETTINGS = printf " $( BUILD_SETTINGS_COMPILER) \n $( BUILD_SETTINGS_ASSEMBLER) \n $( BUILD_SETTINGS_LINKER) \033[0m\n "
e l s e
BUILD_SETTINGS = printf " $( BUILD_SETTINGS_COMPILER) \n $( BUILD_SETTINGS_LINKER) \033[0m\n "
e n d i f
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
e l s e
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
e n d i f