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
2017-06-09 06:38:42 +00:00
# Are we running from synthesis?
2017-08-06 13:44:39 +00:00
SYNTHESIS := 0
2017-06-09 06:38:42 +00:00
2017-08-06 13:44:41 +00:00
##### Makefile Swiss army knife
override empty : =
override space : = $( empty ) $( empty )
override comma : = ,
2017-06-09 06:38:42 +00:00
##### Detect platform
i f n d e f H O S T P L A T F O R M
2017-08-06 13:44:39 +00:00
HOSTPLATFORM := UNKNOWN
2017-06-09 06:38:42 +00:00
ifeq ( $( findstring Windows,$( OS) ) ,Windows)
2017-08-06 13:44:39 +00:00
HOSTPLATFORM := WINDOWS
2017-06-09 06:38:42 +00:00
else
2017-08-06 13:44:39 +00:00
uname := $( strip $( shell uname -s) )
2017-06-09 06:38:42 +00:00
ifeq ( $( findstring Linux,$( uname) ) ,Linux)
2017-08-06 13:44:39 +00:00
HOSTPLATFORM := LINUX
2017-06-09 06:38:42 +00:00
else ifeq ( $( findstring BSD,$( uname) ) ,BSD)
2017-08-06 13:44:39 +00:00
HOSTPLATFORM := BSD
2017-06-09 06:38:42 +00:00
else ifeq ( $( findstring MINGW,$( uname) ) ,MINGW)
2017-08-06 13:44:39 +00:00
HOSTPLATFORM := WINDOWS
2017-06-09 06:38:42 +00:00
else ifeq ( $( findstring MSYS,$( uname) ) ,MSYS)
2017-08-06 13:44:39 +00:00
HOSTPLATFORM := WINDOWS
2017-06-09 06:38:42 +00:00
else ifeq ( $( findstring Darwin,$( uname) ) ,Darwin)
2017-08-06 13:44:39 +00:00
HOSTPLATFORM := DARWIN
2017-06-09 06:38:42 +00:00
else ifeq ( $( findstring BeOS,$( uname) ) ,BeOS)
2017-08-06 13:44:39 +00:00
HOSTPLATFORM := BEOS
2017-06-09 06:38:42 +00:00
else ifeq ( $( findstring skyos,$( uname) ) ,skyos)
2017-08-06 13:44:39 +00:00
HOSTPLATFORM := SKYOS
2017-06-09 06:38:42 +00:00
else ifeq ( $( findstring QNX,$( uname) ) ,QNX)
2017-08-06 13:44:39 +00:00
HOSTPLATFORM := QNX
2017-06-09 06:38:42 +00:00
else ifeq ( $( findstring SunOS,$( uname) ) ,SunOS)
2017-08-06 13:44:39 +00:00
HOSTPLATFORM := SUNOS
2017-06-09 06:38:42 +00:00
else ifeq ( $( findstring syllable,$( uname) ) ,syllable)
2017-08-06 13:44:39 +00:00
HOSTPLATFORM := SYLLABLE
2017-06-09 06:38:42 +00:00
endif
endif
e n d i f
i f n d e f P L A T F O R M
2017-08-06 13:44:39 +00:00
PLATFORM := $( HOSTPLATFORM)
2017-06-09 06:38:42 +00:00
e n d i f
i f n d e f S U B P L A T F O R M
2017-08-06 13:44:39 +00:00
SUBPLATFORM :=
2017-06-09 06:38:42 +00:00
ifeq ( $( PLATFORM) ,$( filter $( PLATFORM) ,LINUX DINGOO GCW CAANOO) )
2017-08-06 13:44:39 +00:00
SUBPLATFORM := LINUX
2017-06-09 06:38:42 +00:00
endif
e n d i f
i f e q ( $( HOSTPLATFORM ) , D A R W I N )
2017-08-06 13:44:41 +00:00
DARWINVERSION := $( word 1,$( subst ., ,$( strip $( shell uname -r) ) ) )
2017-06-09 06:38:42 +00:00
2017-08-06 13:44:39 +00:00
DARWIN9 := 0
DARWIN10 := 0
2017-08-06 13:44:41 +00:00
ifneq ( ,$( filter 0 1 2 3 4 5 6 7 8 9 10,$( DARWINVERSION) ) )
DARWIN10 := 1
ifneq ( ,$( filter 0 1 2 3 4 5 6 7 8 9,$( DARWINVERSION) ) )
DARWIN9 := 1
endif
2017-06-09 06:38:42 +00:00
endif
e n d i f
2017-08-06 13:44:39 +00:00
HOSTEXESUFFIX :=
i f e q ( $( HOSTPLATFORM ) , W I N D O W S )
HOSTEXESUFFIX := .exe
e n d i f
EXESUFFIX :=
DLLSUFFIX := .so
DOLSUFFIX := .dol
i f e q ( $( PLATFORM ) , D A R W I N )
DLLSUFFIX := .dylib
e n d i f
i f e q ( $( PLATFORM ) , W I I )
EXESUFFIX := .elf
e n d i f
i f e q ( $( PLATFORM ) , S K Y O S )
EXESUFFIX := .app
e n d i f
i f e q ( $( PLATFORM ) , W I N D O W S )
EXESUFFIX := .exe
DLLSUFFIX := .dll
e n d i f
2017-06-09 06:38:42 +00:00
##### Makefile meta-settings
2017-08-06 13:44:39 +00:00
PRETTY_OUTPUT := 1
2010-12-19 22:29:01 +00:00
2017-08-06 13:44:39 +00:00
NULLSTREAM := /dev/null
2017-06-09 06:38:42 +00:00
i f e q ( $( HOSTPLATFORM ) , W I N D O W S )
# MSYS2 lets you create files named NUL but has a /dev/null. Go figure.
ifeq ( ,$( wildcard /dev/null) )
2017-08-06 13:44:39 +00:00
NULLSTREAM := NUL
2017-06-09 06:38:42 +00:00
endif
e n d i f
2017-08-06 13:44:39 +00:00
DONT_PRINT := > $( NULLSTREAM) 2>& 1
DONT_PRINT_STDERR := 2> $( NULLSTREAM)
2017-08-06 13:44:54 +00:00
DONT_FAIL := ; exit 0
2017-06-09 06:38:42 +00:00
2017-08-06 13:44:39 +00:00
HAVE_SH := 1
# when no sh.exe is found in PATH on Windows, no path is prepended to it
i f e q ( s h . e x e , $( SHELL ) )
HAVE_SH := 0
e n d i f
2017-06-09 06:38:42 +00:00
2017-08-06 13:44:54 +00:00
d e f i n e L L
ls -l $1
e n d e f
d e f i n e M K D I R
mkdir -p $1
e n d e f
d e f i n e R M
rm -f $( filter-out / *,$1 )
e n d e f
d e f i n e R M D I R
rm -rf $( filter-out / *,$1 )
e n d e f
2017-08-06 13:44:39 +00:00
i f e q ( 0 , $( HAVE_SH ) )
2017-08-06 13:44:54 +00:00
DONT_FAIL := & rem
define LL
dir $( subst /,\, $1 )
endef
define MKDIR
if not exist $( subst /,\, $1 ) mkdir $( subst /,\, $1 )
endef
define RM
del /f /q $( subst /,\, $( filter-out / *,$1 ) ) $( DONT_PRINT_STDERR) $( DONT_FAIL)
endef
define RMDIR
rmdir /s /q $( subst /,\, $( filter-out / *,$1 ) ) $( DONT_PRINT_STDERR) $( DONT_FAIL)
endef
2017-08-06 13:44:41 +00:00
2017-08-06 13:44:39 +00:00
# if, printf, exit, and ; are unavailable without sh
2017-08-06 13:44:41 +00:00
PRETTY_OUTPUT := 0
2014-07-22 11:19:25 +00:00
e n d i f
2017-06-09 06:38:42 +00:00
2017-08-06 13:44:39 +00:00
##### Toolchain setup
CROSS :=
CROSS_SUFFIX :=
2017-08-06 13:44:44 +00:00
CCFULLPATH = $( CC)
i f e q ( $( PLATFORM ) , W I I )
ifeq ( $( strip $( DEVKITPPC) ) ,)
$( error "Please set DEVKITPPC in your environment. export DEVKITPPC := <path to>devkitPPC" )
endif
ifeq ( $( HOSTPLATFORM) ,WINDOWS)
override DEVKITPRO := $( subst /c/,C:/,$( DEVKITPRO) )
override DEVKITPPC := $( subst /c/,C:/,$( DEVKITPPC) )
endif
export PATH := $( DEVKITPPC) /bin:$( PATH)
CROSS := powerpc-eabi-
CCFULLPATH = $( DEVKITPPC) /bin/$( CC)
e n d i f
2017-08-06 13:44:39 +00:00
CC := $( CROSS) gcc$( CROSS_SUFFIX)
CXX := $( CROSS) g++$( CROSS_SUFFIX)
2017-08-12 02:33:27 +00:00
i f e q ( $( PLATFORM ) , D A R W I N )
CC := $( CROSS) clang$( CROSS_SUFFIX)
CXX := $( CROSS) clang++$( CROSS_SUFFIX)
e n d i f
2017-08-06 13:44:39 +00:00
COBJC := $( CC) -x objective-c
COBJCXX := $( CXX) -x objective-c++
L_CC := $( CC)
L_CXX := $( CXX)
AR := $( CROSS) ar$( CROSS_SUFFIX)
RC := $( CROSS) windres$( CROSS_SUFFIX)
RANLIB := $( CROSS) ranlib$( CROSS_SUFFIX)
STRIP := $( CROSS) strip$( CROSS_SUFFIX)
2017-06-09 06:38:42 +00:00
2017-08-06 13:44:39 +00:00
AS := nasm
2017-06-09 06:38:42 +00:00
# LuaJIT standalone interpreter executable:
2017-08-06 13:44:39 +00:00
LUAJIT := luajit$( HOSTEXESUFFIX)
2017-06-09 06:38:42 +00:00
2017-08-06 13:44:39 +00:00
PKG_CONFIG := pkg-config
2014-07-22 11:19:25 +00:00
2017-08-06 13:44:39 +00:00
ELF2DOL := elf2dol
2014-12-09 23:56:31 +00:00
2014-07-22 11:19:25 +00:00
# Override defaults that absolutely will not work.
i f e q ( $( CC ) , c c )
2017-08-06 13:44:39 +00:00
override CC := gcc
2014-07-22 11:19:25 +00:00
e n d i f
i f e q ( $( AS ) , a s )
2017-08-06 13:44:39 +00:00
override AS := nasm
2014-07-22 11:19:25 +00:00
e n d i f
2012-10-29 04:26:25 +00:00
2017-06-09 06:38:42 +00:00
i f e q ( $( PLATFORM ) , $( filter $ ( PLATFORM ) ,DINGOO GCW ) )
2017-08-06 13:44:39 +00:00
CROSS := mipsel-linux-
2017-06-09 06:38:42 +00:00
e n d i f
2014-10-16 21:03:24 +00:00
2017-08-06 13:44:39 +00:00
CLANG := 0
2017-03-23 20:47:11 +00:00
i f e q ( $( findstring clang ,$ ( CC ) $ ( MAKECMDGOALS ) ) , c l a n g )
2017-08-06 13:44:39 +00:00
override CLANG := 1
CLANGNAME := $( CC)
2016-09-16 21:55:42 +00:00
e l s e
2017-08-06 13:44:39 +00:00
CLANGNAME := clang
2014-10-16 21:03:24 +00:00
e n d i f
# detect clang symlinked as gcc, as in OS X
2017-06-09 06:38:42 +00:00
CLANG_POTENTIAL_VERSION := $( shell $( CCFULLPATH) --version)
2014-10-16 21:03:24 +00:00
i f e q ( $( findstring clang ,$ ( CLANG_POTENTIAL_VERSION ) ) , c l a n g )
2017-08-06 13:44:39 +00:00
override CLANG := 1
2018-01-30 16:02:24 +00:00
ifeq ( $( findstring Apple,$( CLANG_POTENTIAL_VERSION) ) ,Apple)
override APPLE_CLANG := 1
APPLE_CLANG_VER := $( word 4,$( CLANG_POTENTIAL_VERSION) )
override APPLE_CLANG_VER_SPLIT := $( subst ., ,$( APPLE_CLANG_VER) )
APPLE_CLANG_MAJOR := $( word 1,$( APPLE_CLANG_VER_SPLIT) )
APPLE_CLANG_MINOR := $( word 2,$( APPLE_CLANG_VER_SPLIT) )
else
CLANG_VER := $( word 3,$( CLANG_POTENTIAL_VERSION) )
override CLANG_VER_SPLIT := $( subst ., ,$( CLANG_VER) )
CLANG_MAJOR := $( word 1,$( CLANG_VER_SPLIT) )
CLANG_MINOR := $( word 2,$( CLANG_VER_SPLIT) )
endif
2014-10-16 21:03:24 +00:00
e n d i f
i f n e q ( 0 , $( CLANG ) )
2017-08-06 13:44:39 +00:00
CLANGXXNAME := $( subst clang,clang++,$( CLANGNAME) )
override CC := $( CLANGNAME) -x c
override CXX := $( CLANGXXNAME) -x c++
override COBJC := $( CLANGNAME) -x objective-c
override COBJCXX := $( CLANGXXNAME) -x objective-c++
override L_CC := $( CLANGNAME)
override L_CXX := $( CLANGXXNAME)
2014-10-16 21:03:24 +00:00
e n d i f
2017-08-06 13:44:41 +00:00
GCC_VER :=
i f e q ( 0 , $( CLANG ) )
GCC_VER := $( strip $( shell $( CCFULLPATH) -dumpversion 2>& 1) )
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
2017-08-06 13:44:41 +00:00
i f e q ( , $( GCC_VER ) )
GCC_VER := 4.9.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
e n d i f
2017-08-06 13:44:41 +00:00
override GCC_VER_SPLIT : = $( subst ., ,$ ( GCC_VER ) )
GCC_MAJOR := $( word 1,$( GCC_VER_SPLIT) )
GCC_MINOR := $( word 2,$( GCC_VER_SPLIT) )
2012-10-29 04:26:25 +00:00
2017-06-09 06:38:42 +00:00
GCC_PREREQ_4 := 1
2017-08-06 13:44:41 +00:00
i f n e q ( , $( filter 1 2 3,$ ( GCC_MAJOR ) ) )
2017-06-09 06:38:42 +00:00
ifeq ( 0,$( CLANG) )
GCC_PREREQ_4 := 0
$( error How do you still have an old GCC in $$ ( CURRENT_YEAR) ?)
2012-10-29 04:26:25 +00:00
endif
e n d i f
2017-06-09 06:38:42 +00:00
##### Detect machine architecture
2017-08-06 13:44:39 +00:00
BITS := 32
2017-06-09 06:38:42 +00:00
i f e q ( $( PLATFORM ) , W I N D O W S )
ifndef COMPILERTARGET
2017-08-06 13:44:39 +00:00
COMPILERTARGET := $( strip $( shell $( CC) -dumpmachine) )
2012-12-13 02:32:59 +00:00
endif
2017-06-09 06:38:42 +00:00
2017-08-06 13:44:39 +00:00
IMPLICIT_ARCH := i386
2017-06-09 06:38:42 +00:00
ifeq ( $( findstring x86_64,$( COMPILERTARGET) ) ,x86_64)
2017-08-06 13:44:39 +00:00
IMPLICIT_ARCH := x86_64
BITS := 64
2012-12-13 02:32:59 +00:00
endif
2017-06-09 06:38:42 +00:00
e l s e i f e q ( $( PLATFORM ) , W I I )
2017-08-06 13:44:39 +00:00
IMPLICIT_ARCH := ppc
2017-06-09 06:38:42 +00:00
e l s e
ifneq ( $( ARCH) ,)
2017-08-06 13:44:39 +00:00
override ARCH := $( subst i486,i386,$( subst i586,i386,$( subst i686,i386,$( strip $( ARCH) ) ) ) )
IMPLICIT_ARCH := $( ARCH)
2017-06-09 06:38:42 +00:00
else
2017-08-06 13:44:39 +00:00
IMPLICIT_ARCH := $( subst i486,i386,$( subst i586,i386,$( subst i686,i386,$( strip $( shell uname -m) ) ) ) )
2012-12-13 02:32:59 +00:00
endif
2017-06-09 06:38:42 +00:00
ifeq ( $( findstring x86_64,$( IMPLICIT_ARCH) ) ,x86_64)
2017-08-06 13:44:39 +00:00
BITS := 64
2012-12-13 02:32:59 +00:00
endif
e n d i f
2013-08-18 21:14:37 +00:00
2017-06-09 06:38:42 +00:00
##### Toggles
2012-03-04 09:31:37 +00:00
2017-08-06 13:44:39 +00:00
# CPLUSPLUS - 1 := enable C++ building
# RELEASE - 1 := no debugging
2017-12-10 03:24:29 +00:00
# FORCEDEBUG:
2017-08-06 13:44:39 +00:00
# 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.
# KRANDDEBUG - 1 := include logging of krand() calls for debugging the demo system
# MEMMAP - 1 := produce .memmap file when linking
# OPTLEVEL - 0..3 := GCC optimization strategy
# LTO - 1 := enable link-time optimization
2017-06-09 06:38:42 +00:00
# Optional overrides for text
2017-08-06 13:44:39 +00:00
APPNAME :=
APPBASENAME :=
2017-06-09 06:38:42 +00:00
# Build toggles
2017-08-06 13:44:39 +00:00
RELEASE := 1
NOASM := 0
2017-06-09 06:38:42 +00:00
# EXPERIMENTAL, unfinished x86_64 assembly routines. DO NOT ENABLE.
2017-08-06 13:44:39 +00:00
USE_ASM64 := 0
MEMMAP := 0
CPLUSPLUS := 1
2017-06-09 06:38:42 +00:00
# Feature toggles
2017-08-06 13:44:39 +00:00
STANDALONE := 0
NETCODE := 1
STARTUP_WINDOW := 1
SIMPLE_MENU := 0
POLYMER := 1
USE_OPENGL := 1
LUNATIC := 0
USE_LUAJIT_2_1 := 0
2017-06-09 06:38:42 +00:00
# Library toggles
2017-08-06 13:44:39 +00:00
HAVE_GTK2 := 1
USE_LIBVPX := 1
HAVE_VORBIS := 1
HAVE_FLAC := 1
HAVE_XMP := 1
RENDERTYPE := SDL
MIXERTYPE := SDL
SDL_TARGET := 2
2010-12-19 22:29:01 +00:00
# Debugging/Build options
2017-12-10 03:24:29 +00:00
FORCEDEBUG := 0
2017-08-06 13:44:39 +00:00
KRANDDEBUG := 0
PROFILER := 0
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
2017-08-06 13:44:39 +00:00
ALLOCACHE_AS_MALLOC := 0
2014-02-08 14:37:41 +00:00
2017-06-09 06:38:42 +00:00
##### Settings overrides and implicit cascades
i f n e q ( 0 , $( KRANDDEBUG ) )
2017-08-06 13:44:39 +00:00
RELEASE := 0
2017-06-09 06:38:42 +00:00
e n d i f
i f n e q ( 1 0 0 , $( RELEASE ) $( PROFILER ) $( ALLOCACHE_AS_MALLOC ) )
# so that we have debug symbols
2017-12-10 03:24:29 +00:00
FORCEDEBUG := 1
2017-06-09 06:38:42 +00:00
e n d i f
i f e q ( $( PLATFORM ) , W I N D O W S )
2017-08-06 13:44:39 +00:00
MIXERTYPE := WIN
2017-06-09 06:38:42 +00:00
ifneq ( $( RENDERTYPE) ,SDL)
ifeq ( $( MIXERTYPE) ,SDL)
2017-08-06 13:44:39 +00:00
override MIXERTYPE := WIN
2017-06-09 06:38:42 +00:00
endif
endif
2017-08-06 13:44:39 +00:00
override HAVE_GTK2 := 0
2017-06-09 06:38:42 +00:00
e l s e i f e q ( $( PLATFORM ) , D A R W I N )
2017-08-06 13:44:39 +00:00
HAVE_GTK2 := 0
2017-06-09 06:38:42 +00:00
e l s e i f e q ( $( PLATFORM ) , W I I )
2017-08-06 13:44:39 +00:00
override USE_OPENGL := 0
override NETCODE := 0
override HAVE_GTK2 := 0
override HAVE_FLAC := 0
SDL_TARGET := 1
2017-06-09 06:38:42 +00:00
e l s e i f e q ( $( PLATFORM ) , $( filter $ ( PLATFORM ) ,DINGOO GCW QNX SUNOS SYLLABLE ) )
2017-08-06 13:44:39 +00:00
override USE_OPENGL := 0
override NOASM := 1
2017-06-09 06:38:42 +00:00
e l s e i f e q ( $( PLATFORM ) , $( filter $ ( PLATFORM ) ,BEOS SKYOS ) )
2017-08-06 13:44:39 +00:00
override NOASM := 1
2017-06-09 06:38:42 +00:00
e n d i f
i f n e q ( i 3 8 6 , $( strip $ ( IMPLICIT_ARCH ) ) )
2017-08-06 13:44:39 +00:00
override NOASM := 1
2017-06-09 06:38:42 +00:00
e n d i f
i f e q ( 0 , $( USE_OPENGL ) )
2017-08-06 13:44:39 +00:00
override POLYMER := 0
override USE_LIBVPX := 0
2013-05-04 16:36:10 +00:00
e n d i f
2013-01-20 21:17:36 +00:00
i f e q ( $( RELEASE ) , 0 )
2017-08-06 13:44:39 +00:00
override STRIP :=
2013-01-20 21:17:36 +00:00
e n d i f
2017-12-10 03:24:29 +00:00
i f n e q ( $( FORCEDEBUG ) , 0 )
2017-08-06 13:44:39 +00:00
override STRIP :=
2013-01-20 21:17:36 +00:00
e n d i f
2017-06-09 06:38:42 +00:00
i f e q ( $( RELEASE ) , 0 )
2017-08-06 13:44:39 +00:00
OPTLEVEL := 0
2018-01-30 16:02:24 +00:00
# see if we can use -Og
ifeq ( 1,$( APPLE_CLANG) )
# Apple clang >= 9.0
ifeq ( ,$( filter 0 1 2 3 4 5 6 7 8,$( APPLE_CLANG_MAJOR) ) )
OPTLEVEL := g
endif
else ifeq ( 1,$( CLANG) )
# clang >= 4.0
ifeq ( ,$( filter 0 1 2 3,$( CLANG_MAJOR) ) )
OPTLEVEL := g
endif
else
# GCC >= 4.8
ifeq ( ,$( filter 0 1 2 3 4,$( GCC_MAJOR) ) )
OPTLEVEL := g
else ifeq ( 4,$( GCC_MAJOR) )
ifeq ( ,$( filter 0 1 2 3 4 5 6 7,$( GCC_MINOR) ) )
OPTLEVEL := g
endif
endif
endif
2017-08-06 13:44:39 +00:00
LTO := 0
2017-06-09 06:38:42 +00:00
e l s e
2017-08-06 13:44:39 +00:00
OPTLEVEL := 2
LTO := 1
2017-06-09 06:38:42 +00:00
e n d i f
i f n e q ( 0 , $( CLANG ) )
ifeq ( $( PLATFORM) ,WINDOWS)
2017-08-06 13:44:39 +00:00
LTO := 0
2017-06-09 06:38:42 +00:00
endif
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.
2017-08-06 13:44:39 +00:00
override LTO := 0
2013-07-13 21:05:05 +00:00
e n d i f
2017-06-09 06:38:42 +00:00
i f e q ( 0 , $( CLANG ) )
ifeq ( 0,$( GCC_PREREQ_4) )
2017-08-06 13:44:39 +00:00
override LTO := 0
2017-06-09 06:38:42 +00:00
endif
2017-08-06 13:44:41 +00:00
ifeq ( 4,$( GCC_MAJOR) )
2017-06-09 06:38:42 +00:00
ifeq ( $( PLATFORM) ,WII)
2017-08-06 13:44:41 +00:00
ifneq ( ,$( filter 0 1 2 3 4 5 6 7,$( GCC_MINOR) ) )
2017-08-06 13:44:39 +00:00
override LTO := 0
2017-06-09 06:38:42 +00:00
endif
else
2017-08-06 13:44:41 +00:00
ifneq ( ,$( filter 0 1 2 3 4 5,$( GCC_MINOR) ) )
2017-08-06 13:44:39 +00:00
override LTO := 0
2017-06-09 06:38:42 +00:00
endif
2012-11-06 07:49:44 +00:00
endif
endif
e n d i f
2014-07-22 07:25:54 +00:00
2017-06-09 06:38:42 +00:00
########## End Toggles, Begin Construction ##########
2014-07-22 07:25:54 +00:00
2017-06-09 06:38:42 +00:00
##### Instantiate variables
2017-08-06 13:44:39 +00:00
COMMONFLAGS :=
COMPILERFLAGS := -funsigned-char
2014-07-22 07:25:54 +00:00
2017-08-06 13:44:39 +00:00
CSTD := -std= gnu99
CXXSTD := -std= gnu++11
2017-03-27 17:13:13 +00:00
i f n e q ( 0 , $( CLANG ) )
2017-08-06 13:44:39 +00:00
CSTD := $( subst gnu,c,$( CSTD) )
CXXSTD := $( subst gnu,c,$( CXXSTD) )
2017-03-27 17:13:13 +00:00
e n d i f
2017-08-06 13:44:39 +00:00
CONLYFLAGS := $( CSTD)
CXXONLYFLAGS := $( CXXSTD) -fno-exceptions -fno-rtti
2017-03-27 17:13:13 +00:00
2017-08-06 13:44:39 +00:00
ASFLAGS := -s #-g
2017-06-09 06:38:42 +00:00
LUAJIT_BCOPTS :=
2017-08-06 13:44:39 +00:00
LINKERFLAGS :=
L_CXXONLYFLAGS :=
2017-06-09 06:38:42 +00:00
2017-08-06 13:44:39 +00:00
LIBS :=
GUI_LIBS :=
LIBDIRS :=
2014-07-22 07:25:54 +00:00
2012-10-29 04:26:25 +00:00
2017-06-09 06:38:42 +00:00
##### Mandatory platform parameters
2016-06-03 04:50:47 +00:00
2017-08-06 13:44:39 +00:00
ASFORMAT := elf$( BITS)
2017-06-09 06:38:42 +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.
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 )
2017-08-06 13:44:39 +00:00
LINKERFLAGS += -static-libgcc -static
2017-06-09 06:38:42 +00:00
ifeq ( 0,$( CLANG) )
L_CXXONLYFLAGS += -static-libstdc++
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
2017-06-09 06:38:42 +00:00
ifeq ( 0,$( CLANG) )
GUI_LIBS += -mwindows
2016-06-03 04:50:47 +00:00
endif
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DUNDERSCORES
ASFORMAT := win$( BITS)
ASFLAGS += -DUNDERSCORES
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
2017-06-09 06:38:42 +00:00
ifneq ( $( findstring x86_64,$( COMPILERTARGET) ) ,x86_64)
2017-08-06 13:44:39 +00:00
LINKERFLAGS += -Wl,--large-address-aware
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
2017-08-06 13:44:39 +00:00
LINKERFLAGS += -Wl,--enable-auto-import
2014-10-16 21:03:24 +00:00
2017-06-09 06:38:42 +00:00
LUAJIT_BCOPTS := -o windows
ifeq ( 32,$( BITS) )
LUAJIT_BCOPTS += -a x86
2012-10-29 04:26:25 +00:00
endif
2017-06-09 06:38:42 +00:00
ifeq ( 64,$( BITS) )
LUAJIT_BCOPTS += -a x64
2012-10-29 04:26:25 +00:00
endif
2017-06-09 06:38:42 +00:00
e l s e i f e q ( $( PLATFORM ) , D A R W I N )
2016-10-29 16:59:28 +00:00
ifneq ( $( ARCH) ,)
ifneq ( $( findstring -arch,$( ARCH) ) ,-arch)
override ARCH := -arch $( ARCH)
endif
endif
2017-06-09 06:38:42 +00:00
COMMONFLAGS += $( ARCH)
2016-10-29 16:59:28 +00:00
2017-06-09 06:38:42 +00:00
ifneq ( $( findstring x86_64,$( IMPLICIT_ARCH) ) ,x86_64)
LINKERFLAGS += -read_only_relocs suppress
2012-10-29 04:26:25 +00:00
endif
2017-01-01 17:44:56 +00:00
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DUNDERSCORES
ASFORMAT := macho
ASFLAGS += -DUNDERSCORES
2014-07-22 07:25:54 +00:00
2017-06-09 06:38:42 +00:00
ifeq ( $( findstring x86_64,$( IMPLICIT_ARCH) ) ,x86_64)
2017-08-06 13:44:39 +00:00
ASFORMAT += 64
2014-07-24 14:01:44 +00:00
endif
2017-06-09 06:38:42 +00:00
e l s e i f e q ( $( PLATFORM ) , W I I )
2017-08-06 13:44:44 +00:00
LIBOGC_INC := $( DEVKITPRO) /libogc/include
LIBOGC_LIB := $( DEVKITPRO) /libogc/lib/wii
COMMONFLAGS += -mrvl -mcpu= 750 -meabi -mhard-float
LINKERFLAGS += -Wl,--gc-sections
# -msdata=eabiexport
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DGEKKO -D__POWERPC__ -I$( LIBOGC_INC)
2017-06-09 06:38:42 +00:00
LIBDIRS += -L$( LIBOGC_LIB)
e l s e i f e q ( $( PLATFORM ) , $( filter $ ( PLATFORM ) ,DINGOO GCW ) )
COMPILERFLAGS += -D__OPENDINGUX__
e l s e i f e q ( $( PLATFORM ) , S K Y O S )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DUNDERSCORES
2014-07-24 14:01:44 +00:00
e n d i f
2017-06-09 06:38:42 +00:00
ASFLAGS += -f $( ASFORMAT)
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE= 0
2017-06-09 06:38:42 +00:00
##### Optimizations
2014-07-24 14:01:44 +00:00
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)
2017-08-06 13:44:39 +00:00
OPTOPT := -march= haswell -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mpopcnt -mpclmul -mavx -mrdrnd -mf16c -mfsgsbase -mavx2 -maes -mfma -mbmi -mbmi2
2016-06-15 07:08:26 +00:00
# -mcrc32 -mmovbe
else
ifeq ( $( PLATFORM) ,DARWIN)
2017-08-06 13:44:39 +00:00
OPTOPT := -march= core2 -mmmx -msse -msse2 -msse3 -mssse3
2016-06-15 07:08:26 +00:00
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)
2017-08-06 13:44:39 +00:00
OPTOPT := -march= nocona -mmmx -msse -msse2 -msse3
2016-06-03 04:50:52 +00:00
else
2017-08-06 13:44:39 +00:00
OPTOPT := -march= pentium3
2017-06-09 06:38:42 +00:00
ifneq ( 0,$( GCC_PREREQ_4) )
OPTOPT += -mtune= generic
# -mstackrealign
endif
OPTOPT += -mmmx
# -msse2 -mfpmath=sse,387 -malign-double
2016-06-03 04:50:52 +00:00
endif
endif
2017-06-09 06:38:42 +00:00
ifeq ( $( PLATFORM) ,WII)
2017-08-06 13:44:39 +00:00
OPTOPT := -mtune= 750
2017-06-09 06:38:42 +00:00
endif
2012-10-29 04:26:25 +00:00
e n d i f
2010-12-19 22:29:01 +00:00
2017-06-09 06:38:42 +00:00
i f e q ( $( PACKAGE_REPOSITORY ) , 0 )
COMMONFLAGS += -O$( OPTLEVEL) $( OPTOPT)
2010-12-19 22:29:01 +00:00
e n d i f
2017-06-09 06:38:42 +00:00
i f n e q ( 0 , $( LTO ) )
COMPILERFLAGS += -DUSING_LTO
COMMONFLAGS += -flto
2010-12-19 22:29:01 +00:00
e n d i f
2017-06-09 06:38:42 +00:00
##### Debugging
2012-05-20 07:25:25 +00:00
2017-12-10 03:24:29 +00:00
i f n e q ( $( RELEASE ) $( FORCEDEBUG ) , 1 0 )
2017-06-09 06:38:42 +00:00
ifeq ( $( PACKAGE_REPOSITORY) ,0)
COMMONFLAGS += -g
ifeq ( 0,$( CLANG) )
ifneq ( $( PLATFORM) ,WII)
COMMONFLAGS += -fno-omit-frame-pointer
endif
endif
endif
ifeq ( $( SUBPLATFORM) ,LINUX)
# This option is needed to allow obtaining backtraces from within a program.
2017-08-06 13:44:39 +00:00
LIBS += -rdynamic
2017-06-09 06:38:42 +00:00
endif
2011-07-18 19:06:29 +00:00
e n d i f
2011-03-19 18:07:12 +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
2017-12-10 03:24:39 +00:00
# See https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
# and https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
# for a list of possible ASan and UBsan options.
ASAN_FLAGS := -fsanitize= address -fsanitize= bounds,enum,float-cast-overflow
ASAN_FLAGS := $( ASAN_FLAGS) ,signed-integer-overflow,unsigned-integer-overflow
ASAN_FLAGS := $( ASAN_FLAGS) ,undefined,return,null,pointer-overflow,float-divide-by-zero
#ASAN_FLAGS := $(ASAN_FLAGS) -fsanitize-undefined-trap-on-error
2013-08-18 19:24:15 +00:00
2017-12-10 03:24:29 +00:00
i f e q ( 0 , $( FORCEDEBUG ) )
2017-06-09 06:38:42 +00:00
COMPILERFLAGS += -DNDEBUG
e l s e
2017-12-10 03:24:29 +00:00
COMPILERFLAGS += -DDEBUGGINGAIDS= $( FORCEDEBUG)
2017-12-10 03:24:39 +00:00
ifeq ( 2,$( FORCEDEBUG) )
ifneq ( 0,$( CLANG) )
COMMONFLAGS += $( ASAN_FLAGS)
else ifneq ( ,$( filter 1 2 3 4 5 6,$( GCC_MAJOR) ) )
ifneq ( ,$( filter 0 1,$( GCC_MINOR) ) )
COMMONFLAGS += $( ASAN_FLAGS)
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
2011-12-15 22:43:01 +00:00
endif
2017-06-09 06:38:42 +00:00
e n d i f
2014-11-22 18:37:19 +00:00
2017-06-09 06:38:42 +00:00
i f n e q ( 0 , $( KRANDDEBUG ) )
COMPILERFLAGS += -DKRANDDEBUG= 1
e n d i f
i f n e q ( 0 , $( PROFILER ) )
ifneq ( $( PLATFORM) ,DARWIN)
2017-08-06 13:44:39 +00:00
LIBS += -lprofiler
2011-09-22 16:52:55 +00:00
endif
2017-06-09 06:38:42 +00:00
COMMONFLAGS += -pg
e n d i f
2014-11-22 18:37:19 +00:00
2017-06-09 06:38:42 +00:00
##### -f stuff
i f n e q ( 0 , $( GCC_PREREQ_ 4) )
F_NO_STACK_PROTECTOR := -fno-stack-protector
ifeq ( 0,$( CLANG) )
F_JUMP_TABLES := -fjump-tables
2011-03-25 11:42:07 +00:00
endif
2017-06-09 06:38:42 +00:00
e n d i f
i f e q ( $( PLATFORM ) , D A R W I N )
ifeq ( 1,$( DARWIN9) )
F_JUMP_TABLES :=
endif
ifeq ( $( findstring ppc,$( IMPLICIT_ARCH) ) $( findstring i386,$( IMPLICIT_ARCH) ) ,)
F_NO_STACK_PROTECTOR :=
endif
e n d i f
i f e q ( 0 , $( RELEASE ) )
F_NO_STACK_PROTECTOR :=
2010-12-19 22:29:01 +00:00
e l s e
2017-06-09 06:38:42 +00:00
ifeq ( 0,$( CLANG) )
COMMONFLAGS += -funswitch-loops
endif
2014-11-22 18:37:19 +00:00
2017-12-10 03:24:29 +00:00
ifeq ( 0,$( FORCEDEBUG) )
2017-06-09 06:38:42 +00:00
COMMONFLAGS += -fomit-frame-pointer
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
2017-06-09 06:38:42 +00:00
e n d i f
i f n e q ( 0 , $( KRANDDEBUG ) )
COMMONFLAGS += -fno-inline -fno-inline-functions -fno-inline-functions-called-once
e n d i f
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
2017-08-06 13:44:39 +00:00
COMMONFLAGS += -fno-strict-aliasing -fno-threadsafe-statics $( F_JUMP_TABLES) $( F_NO_STACK_PROTECTOR)
2014-11-22 18:37:19 +00:00
2017-06-09 06:38:42 +00:00
##### Warnings
W_STRICT_OVERFLOW := -Wno-strict-overflow
i f e q ( $( PLATFORM ) , D A R W I N )
ifneq ( 0,$( DARWIN9) )
W_STRICT_OVERFLOW :=
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
2017-08-06 13:44:39 +00:00
W_CLANG := -Wno-unused-value -Wno-parentheses -Wno-unknown-warning-option
2011-02-12 13:25:24 +00:00
2017-08-06 13:44:39 +00:00
i f e q ( 0 , $( CLANG ) )
W_CLANG :=
2017-03-22 15:45:56 +00:00
2017-06-09 06:38:42 +00:00
ifeq ( 0,$( GCC_PREREQ_4) )
2016-01-12 10:31:07 +00:00
W_GCC_4_5 :=
W_GCC_4_4 :=
ifeq ( 0,$( OPTLEVEL) )
W_UNINITIALIZED :=
endif
W_GCC_4_2 :=
W_GCC_4_1 :=
endif
2017-08-06 13:44:41 +00:00
ifeq ( 4,$( GCC_MAJOR) )
ifneq ( ,$( filter 0 1 2 3 4,$( GCC_MINOR) ) )
2016-01-12 10:31:07 +00:00
W_GCC_4_5 :=
2017-08-06 13:44:41 +00:00
ifneq ( ,$( filter 0 1 2 3,$( GCC_MINOR) ) )
2016-01-12 10:31:07 +00:00
W_GCC_4_4 :=
ifeq ( 0,$( OPTLEVEL) )
W_UNINITIALIZED :=
endif
2017-08-06 13:44:41 +00:00
ifneq ( ,$( filter 0 1,$( GCC_MINOR) ) )
2016-01-12 10:31:07 +00:00
W_GCC_4_2 :=
2017-08-06 13:44:41 +00:00
ifeq ( 0,$( GCC_MINOR) )
2016-01-12 10:31:07 +00:00
W_GCC_4_1 :=
endif
endif
endif
endif
endif
2011-12-09 19:08:47 +00:00
e n d i f
2017-08-06 13:44:39 +00:00
CONLYWARNS := -Wimplicit -Werror-implicit-function-declaration
CWARNS := -W -Wall \
-Wextra \
-Wpointer-arith \
-Wno-char-subscripts \
-Wno-missing-braces \
-Wwrite-strings \
$( W_UNINITIALIZED) \
$( W_GCC_4_1) \
$( W_GCC_4_2) \
$( W_GCC_4_4) \
$( W_GCC_4_5) \
$( W_CLANG) \
#-Wstrict-prototypes \
#-Waggregate-return \
#-Wcast-align \
#-Waddress
2012-12-09 13:24:44 +00:00
2017-06-09 06:38:42 +00:00
##### Features
2012-11-10 20:59:00 +00:00
2017-06-09 06:38:42 +00:00
i f n e q ( , $( APPNAME ) )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DAPPNAME= \" $( APPNAME) \"
2013-07-20 03:36:54 +00:00
e n d i f
2017-06-09 06:38:42 +00:00
i f n e q ( , $( APPBASENAME ) )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DAPPBASENAME= \" $( APPBASENAME) \"
2013-08-18 21:14:37 +00:00
e n d i f
2012-11-10 20:59:00 +00:00
2017-06-09 06:38:42 +00:00
i f n e q ( 0 , $( NOASM ) )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DNOASM
2017-06-09 06:38:42 +00:00
e n d i f
i f n e q ( 0 , $( USE_ASM 64) )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DUSE_ASM64
2017-06-09 06:38:42 +00:00
e n d i f
i f n e q ( 0 , $( MEMMAP ) )
ifeq ( $( PLATFORM) ,DARWIN)
2017-08-06 13:44:39 +00:00
LINKERFLAGS += -Wl,-map -Wl,$@ .memmap
2012-11-10 20:59:00 +00:00
else
2017-08-06 13:44:39 +00:00
LINKERFLAGS += -Wl,-Map= $@ .memmap
2012-11-10 20:59:00 +00:00
endif
e n d i f
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DRENDERTYPE$( RENDERTYPE) = 1 -DMIXERTYPE$( MIXERTYPE) = 1
2012-06-01 20:09:27 +00:00
2017-06-09 06:38:42 +00:00
i f e q ( 0 , $( NETCODE ) )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DNETCODE_DISABLE
2011-07-18 19:06:29 +00:00
e n d i f
2016-11-09 22:51:33 +00:00
i f n e q ( 0 , $( STARTUP_WINDOW ) )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DSTARTUP_WINDOW
2016-11-09 22:51:33 +00:00
e n d i f
2017-01-18 22:21:40 +00:00
i f n e q ( 0 , $( SIMPLE_MENU ) )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DEDUKE32_SIMPLE_MENU
2017-01-18 22:21:40 +00:00
e n d i f
2017-01-18 22:21:08 +00:00
i f n e q ( 0 , $( STANDALONE ) )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DEDUKE32_STANDALONE
2017-01-18 22:21:08 +00:00
e n d i f
2017-06-09 06:38:42 +00:00
i f n e q ( 0 , $( USE_OPENGL ) )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DUSE_OPENGL
2014-07-22 07:25:54 +00:00
e n d i f
2017-06-09 06:38:42 +00:00
i f n e q ( 0 , $( POLYMER ) )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DPOLYMER
2014-07-22 07:25:54 +00:00
e n d i f
2016-05-29 21:11:24 +00:00
2014-07-22 07:25:54 +00:00
2017-06-09 06:38:42 +00:00
##### External library paths
2014-10-16 21:03:24 +00:00
2017-06-09 06:38:42 +00:00
i f e q ( $( PLATFORM ) , W I N D O W S )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -Iplatform/Windows/include
LIBDIRS += -Lplatform/Windows/lib/$( BITS)
2017-06-09 06:38:42 +00:00
e l s e i f e q ( $( PLATFORM ) , D A R W I N )
2014-10-16 21:03:24 +00:00
ifneq ( $( shell port --version & >/dev/null; echo $$ ?) ,127)
2017-08-06 13:44:39 +00:00
LIBDIRS += -L/opt/local/lib
COMPILERFLAGS += -I/opt/local/include
2014-10-16 21:03:24 +00:00
endif
ifneq ( $( shell brew --version & >/dev/null; echo $$ ?) ,127)
2017-08-06 13:44:39 +00:00
LIBDIRS += -L/usr/local/lib
COMPILERFLAGS += -I/usr/local/include
2014-10-16 21:03:24 +00:00
endif
ifneq ( $( shell fink --version & >/dev/null; echo $$ ?) ,127)
2017-08-06 13:44:39 +00:00
LIBDIRS += -L/sw/lib
COMPILERFLAGS += -I/sw/include
2014-10-16 21:03:24 +00:00
endif
2017-06-09 06:38:42 +00:00
e l s e i f e q ( $( PLATFORM ) , B S D )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -I/usr/local/include
2017-06-09 06:38:42 +00:00
e l s e i f e q ( $( PLATFORM ) , W I I )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -I$( PORTLIBS) /include -Iplatform/Wii/include
2017-06-09 06:38:42 +00:00
LIBDIRS += -L$( PORTLIBS) /lib -Lplatform/Wii/lib
e n d i f
2014-07-22 07:25:54 +00:00
2017-06-09 06:38:42 +00:00
##### External libraries
2014-06-16 23:16:23 +00:00
2017-06-09 06:38:42 +00:00
i f n e q ( $( LUNATIC ) , 0 )
ifneq ( $( USE_LUAJIT_2_1) ,0)
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DUSE_LUAJIT_2_1
2016-05-23 04:47:12 +00:00
endif
2014-07-22 07:25:54 +00:00
2017-06-09 06:38:42 +00:00
ifeq ( $( PLATFORM) ,WINDOWS)
2017-08-06 13:44:39 +00:00
LIBS += -lluajit
2017-06-09 06:38:42 +00:00
else
2017-08-06 13:44:39 +00:00
LIBS += -lluajit-5.1
2014-07-22 07:25:54 +00:00
endif
2017-06-09 06:38:42 +00:00
e n d i f
2014-07-22 07:25:54 +00:00
2017-06-09 06:38:42 +00:00
i f n e q ( 0 , $( USE_LIBVPX ) )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DUSE_LIBVPX
LIBS += -lvpx
2014-07-22 07:25:54 +00:00
e n d i f
2017-06-09 06:38:42 +00:00
i f n e q ( 0 , $( HAVE_VORBIS ) )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DHAVE_VORBIS
2016-06-03 04:50:47 +00:00
e n d i f
2017-06-09 06:38:42 +00:00
i f n e q ( 0 , $( HAVE_FLAC ) )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DHAVE_FLAC
2017-06-09 06:38:42 +00:00
e n d i f
i f n e q ( 0 , $( HAVE_XMP ) )
2017-08-06 13:44:39 +00:00
COMPILERFLAGS += -DHAVE_XMP
2014-07-22 07:25:54 +00:00
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)
2017-08-06 13:44:39 +00:00
SDLCONFIG := sdl2-config
SDLNAME := SDL2
2017-06-09 06:38:42 +00:00
else ifeq ( $( SDL_TARGET) ,1)
2017-08-06 13:44:39 +00:00
SDLCONFIG := sdl-config
SDLNAME := SDL
2016-06-15 07:08:35 +00:00
ifeq ( 0,$( RELEASE) )
COMPILERFLAGS += -DNOSDLPARACHUTE
endif
endif
2014-07-22 07:25:54 +00:00
2017-08-06 13:44:39 +00:00
ifeq ( $( PLATFORM) ,WII)
SDLCONFIG :=
else ifeq ( $( PLATFORM) ,SKYOS)
COMPILERFLAGS += -I/boot/programs/sdk/include/sdl
SDLCONFIG :=
endif
2016-06-15 07:08:35 +00:00
ifneq ( $( strip $( SDLCONFIG) ) ,)
ifeq ( $( strip $( shell $( SDLCONFIG) --version $( DONT_PRINT_STDERR) ) ) ,)
2017-08-06 13:44:39 +00:00
override SDLCONFIG :=
2016-06-15 07:08:35 +00:00
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
2017-08-06 13:44:39 +00:00
SDL_FRAMEWORK := 0
2016-06-15 07:08:35 +00:00
ifneq ( $( SDL_FRAMEWORK) ,0)
ifeq ( $( PLATFORM) ,DARWIN)
2017-08-06 13:44:39 +00:00
APPLE_FRAMEWORKS := /Library/Frameworks
2016-06-15 07:08:35 +00:00
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) ) )
2017-03-23 20:47:11 +00:00
COMPILERFLAGS += $( SDLCONFIG_CFLAGS)
2016-06-15 07:08:35 +00:00
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
2017-08-06 13:44:39 +00:00
LIBS += -l$( SDLNAME)
2014-07-22 07:25:54 +00:00
endif
endif
2017-06-09 06:38:42 +00:00
e n d i f
2014-07-22 07:25:54 +00:00
2017-06-09 06:38:42 +00:00
i f n e q ( 0 , $( HAVE_GTK 2) )
ifneq ( No,$( shell $( PKG_CONFIG) --exists gtk+-2.0 || echo No) )
COMPILERFLAGS += -DHAVE_GTK2 $( shell $( PKG_CONFIG) --cflags gtk+-2.0)
2014-07-22 07:25:54 +00:00
else
2017-08-06 13:44:39 +00:00
override HAVE_GTK2 := 0
2014-07-22 07:25:54 +00:00
endif
e n d i f
2017-06-09 06:38:42 +00:00
##### System libraries
2014-07-22 07:25:54 +00:00
i f e q ( $( PLATFORM ) , W I N D O W S )
2017-06-09 06:38:42 +00:00
ifneq ( 0,$( GCC_PREREQ_4) )
L_SSP := -lssp
2014-07-22 07:25:54 +00:00
endif
2017-08-06 13:44:39 +00:00
LIBS += -lmingwex -lgdi32 -lpthread
2017-06-09 06:38:42 +00:00
ifeq ( $( RENDERTYPE) ,WIN)
LIBS += -ldxguid
2014-07-22 07:25:54 +00:00
else
2017-06-09 06:38:42 +00:00
LIBS += -ldxguid_sdl -lmingw32 -limm32 -lole32 -loleaut32 -lversion
2014-07-22 07:25:54 +00:00
endif
2017-06-09 06:38:42 +00:00
LIBS += -lcomctl32 -lwinmm $( L_SSP) -lwsock32 -lws2_32 -lshlwapi
# -lshfolder
e l s e i f e q ( $( PLATFORM ) , S K Y O S )
2017-08-06 13:44:39 +00:00
LIBS += -lnet
2017-06-09 06:38:42 +00:00
e l s e i f e q ( $( PLATFORM ) , Q N X )
2017-08-06 13:44:39 +00:00
LIBS += -lsocket
2017-06-09 06:38:42 +00:00
e l s e i f e q ( $( PLATFORM ) , S U N O S )
2017-08-06 13:44:39 +00:00
LIBS += -lsocket -lnsl
2017-06-09 06:38:42 +00:00
e l s e i f e q ( $( PLATFORM ) , W I I )
2017-08-06 13:44:39 +00:00
LIBS += -laesnd_tueidj -lfat -lwiiuse -lbte -lwiikeyboard -logc
2017-06-09 06:38:42 +00:00
e l s e i f e q ( $( SUBPLATFORM ) , L I N U X )
2017-08-06 13:44:39 +00:00
LIBS += -lrt
2014-07-22 07:25:54 +00:00
e n d i f
2017-06-09 06:38:42 +00:00
i f e q ( , $( filter $ ( PLATFORM ) ,WINDOWS WII ) )
ifneq ( $( PLATFORM) ,BSD)
2017-08-06 13:44:39 +00:00
LIBS += -ldl
2017-06-09 06:38:42 +00:00
endif
ifneq ( $( PLATFORM) ,DARWIN)
2017-08-06 13:44:39 +00:00
LIBS += -pthread
2014-07-22 07:25:54 +00:00
endif
e n d i f
2017-06-09 06:38:42 +00:00
LIBS += -lm
2014-07-22 07:25:54 +00:00
2017-06-09 06:38:42 +00:00
##### Detect version control revision, if applicable
2017-08-06 13:44:41 +00:00
VC_REV :=
- i n c l u d e E D U K E 3 2 _ R E V I S I O N . m a k
2014-07-28 08:59:58 +00:00
i f e q ( , $( VC_REV ) )
2017-08-06 13:44:41 +00:00
VC_REV := $( word 2,$( subst :, ,$( filter Revision:%,$( subst : ,:,$( strip $( shell svn info 2>& 1) ) ) ) ) )
2014-07-28 08:59:58 +00:00
e n d i f
i f e q ( , $( VC_REV ) )
2017-08-06 13:44:41 +00:00
GIT_SVN_URL := $( strip $( shell git config --local svn-remote.svn.url) )
GIT_SVN_FETCH := $( strip $( shell git config --local svn-remote.svn.fetch) )
VC_REV := $( word 2,$( subst @, ,$( filter git-svn-id:$( GIT_SVN_URL) @%,$( subst : ,:,$( shell git log -1 $( GIT_SVN_FETCH::%= %) ) ) ) ) )
2014-07-28 08:59:58 +00:00
e n d i f
i f n e q ( , $( VC_REV ) $( VC_REV_CUSTOM ) )
2017-06-09 06:38:42 +00:00
REVFLAG := -DREV= " \"r $( VC_REV) $( VC_REV_CUSTOM) \" "
2014-07-28 08:59:58 +00:00
e n d i f
2017-06-09 06:38:42 +00:00
2017-08-06 13:44:39 +00:00
##### Allow standard environment variables to take precedence, to help package maintainers.
i f n e q ( , $( CFLAGS ) )
COMMONFLAGS += $( CFLAGS)
e n d i f
i f n e q ( , $( CXXFLAGS ) )
CXXONLYFLAGS += $( CXXFLAGS)
e n d i f
i f n e q ( , $( LDFLAGS ) )
LINKERFLAGS += $( LDFLAGS)
e n d i f
2017-06-09 06:38:42 +00:00
##### Final assembly of commands
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
2017-06-09 06:38:42 +00:00
##### Pretty-printing
2014-07-22 07:25:54 +00:00
i f e q ( $( PRETTY_OUTPUT ) , 1 )
RECIPE_IF = if
2017-06-09 06:38:46 +00:00
BUILD_STARTED = printf " \033[K\033[1;36mBuilding: \033[0;36m $( MAKE) $( MAKECMDGOALS) - $( MAKEFLAGS) \033[0m\n "
2014-07-22 07:25:54 +00:00
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 =
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