2010-12-19 22:29:01 +00:00
|
|
|
|
|
|
|
## common definitions for Makefile, build/Makefile, source/enet/Makefile and
|
|
|
|
## source/jaudiolib/Makefile
|
|
|
|
|
|
|
|
# Use colored output
|
2011-02-12 13:25:24 +00:00
|
|
|
PRETTY_OUTPUT ?= 1
|
2010-12-19 22:29:01 +00:00
|
|
|
|
2012-03-14 06:27:45 +00:00
|
|
|
# Binary suffix override:
|
|
|
|
EXESUFFIX_OVERRIDE ?=
|
|
|
|
|
2010-12-19 22:29:01 +00:00
|
|
|
# DirectX SDK location - if nonempty, overrides the DXROOTs of the individual
|
|
|
|
# Makefiles. Should be set to an absolute path since this Makefile is included
|
|
|
|
# at different directory levels
|
|
|
|
DXROOT_OVERRIDE:=
|
|
|
|
|
2012-03-04 09:31:37 +00:00
|
|
|
# Mac OS X Frameworks location
|
|
|
|
# Like above, use absolute paths.
|
|
|
|
APPLE_FRAMEWORKS ?=/Library/Frameworks
|
2012-03-08 06:07:10 +00:00
|
|
|
# Since the OS X startup window is generating errors, disable it by default.
|
|
|
|
OSX_STARTUPWINDOW ?= 0
|
2012-03-04 09:31:37 +00:00
|
|
|
|
2010-12-19 22:29:01 +00:00
|
|
|
# Engine options
|
2011-03-04 08:50:58 +00:00
|
|
|
# USE_OPENGL - enables basic OpenGL Polymost renderer
|
|
|
|
# POLYMER - enables fancy Polymer renderer
|
2010-12-19 22:29:01 +00:00
|
|
|
# NOASM - disables the use of inline assembly pragmas
|
|
|
|
# LINKED_GTK - enables compile-time linkage to GTK
|
|
|
|
#
|
|
|
|
POLYMER = 1
|
|
|
|
USE_OPENGL = 1
|
|
|
|
NOASM = 0
|
|
|
|
LINKED_GTK = 0
|
2011-06-17 13:11:19 +00:00
|
|
|
BUILD32_ON_64 ?= 0
|
2011-03-19 17:59:09 +00:00
|
|
|
# DO NOT SET THIS TO 1 AND COMMIT IT.
|
|
|
|
NEDMALLOC = 0
|
2011-10-11 16:53:52 +00:00
|
|
|
USE_LIBPNG ?= 0
|
|
|
|
USE_LIBVPX ?= 1
|
2010-12-19 22:29:01 +00:00
|
|
|
|
|
|
|
ifeq (0,$(USE_OPENGL))
|
|
|
|
POLYMER = 0
|
2011-07-18 19:06:29 +00:00
|
|
|
USE_LIBVPX = 0
|
2010-12-19 22:29:01 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# Debugging/Build options
|
|
|
|
# RELEASE - 1 = no debugging
|
|
|
|
# DEBUGANYWAY - 1 = include debug symbols even when generating release code
|
|
|
|
# KRANDDEBUG - 1 = include logging of krand() calls for debugging the demo system
|
|
|
|
# EFENCE - 1 = compile with Electric Fence for malloc() debugging
|
|
|
|
# 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
|
2012-03-12 04:49:16 +00:00
|
|
|
# CLANG - 1 = enable the Clang/LLVM compiler
|
2010-12-19 22:29:01 +00:00
|
|
|
#
|
|
|
|
RELEASE?=1
|
|
|
|
DEBUGANYWAY?=0
|
|
|
|
KRANDDEBUG?=0
|
|
|
|
EFENCE?=0
|
2012-01-12 20:49:34 +00:00
|
|
|
DMALLOC?=0
|
2010-12-19 22:29:01 +00:00
|
|
|
OPTLEVEL?=2
|
|
|
|
PROFILER?=0
|
2011-03-19 17:59:09 +00:00
|
|
|
MUDFLAP?=0
|
2011-03-25 11:42:07 +00:00
|
|
|
LTO?=0
|
2012-03-12 04:49:16 +00:00
|
|
|
CLANG?=0
|
2010-12-19 22:29:01 +00:00
|
|
|
|
|
|
|
ifneq (0,$(KRANDDEBUG))
|
|
|
|
RELEASE=0
|
|
|
|
endif
|
|
|
|
ifneq (0,$(PROFILER))
|
|
|
|
DEBUGANYWAY=1
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# Tools
|
|
|
|
CC=gcc
|
|
|
|
CXX=g++
|
|
|
|
AS=nasm
|
|
|
|
AR=ar
|
|
|
|
RC=windres
|
|
|
|
RANLIB=ranlib
|
|
|
|
STRIP=strip
|
|
|
|
|
2012-03-12 04:49:16 +00:00
|
|
|
ifneq (0,$(CLANG))
|
|
|
|
CC=clang
|
|
|
|
CXX=clang++
|
2012-03-26 22:03:51 +00:00
|
|
|
# AR=llvm-ar
|
|
|
|
# RANLIB=llvm-ranlib
|
2012-03-12 04:49:16 +00:00
|
|
|
endif
|
|
|
|
|
2010-12-19 22:29:01 +00:00
|
|
|
# compiler flags etc.
|
2012-03-23 20:22:10 +00:00
|
|
|
BASECONLYFLAGS=-Wimplicit
|
|
|
|
BASECXXFLAGS= -fno-exceptions -fno-rtti
|
|
|
|
BASEASFLAGS=-s #-g
|
|
|
|
BASELDFLAGS=
|
|
|
|
|
2010-12-19 22:29:01 +00:00
|
|
|
LIBS=-lm
|
2011-03-19 18:07:12 +00:00
|
|
|
ifneq (0,$(USE_LIBPNG))
|
2012-03-24 08:30:28 +00:00
|
|
|
LIBS+= -lpng -lz
|
2011-03-19 18:07:12 +00:00
|
|
|
endif
|
2011-07-18 19:06:29 +00:00
|
|
|
ifneq (0,$(USE_LIBVPX))
|
2011-09-21 22:38:37 +00:00
|
|
|
# On Windows, we link statically to libvpx
|
2011-07-18 19:06:29 +00:00
|
|
|
LIBS+= -lvpx
|
|
|
|
endif
|
2011-03-19 18:07:12 +00:00
|
|
|
|
2012-01-28 14:36:52 +00:00
|
|
|
|
|
|
|
ifneq ($(RELEASE)$(DEBUGANYWAY),10)
|
|
|
|
# debug build or DEBUGANYWAY=1 --> -g flag
|
|
|
|
ifeq ($(CC),clang)
|
|
|
|
debug=-g
|
|
|
|
else
|
|
|
|
debug=-ggdb
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2010-12-19 22:29:01 +00:00
|
|
|
ifneq (0,$(RELEASE))
|
|
|
|
# Debugging disabled
|
2012-01-28 14:36:52 +00:00
|
|
|
debug+= -O$(OPTLEVEL)
|
2011-12-15 22:43:01 +00:00
|
|
|
ifneq ($(CC),clang)
|
2012-01-28 14:36:52 +00:00
|
|
|
debug+= -funswitch-loops
|
2011-12-15 22:43:01 +00:00
|
|
|
endif
|
2011-09-22 16:52:55 +00:00
|
|
|
ifeq (0,$(DEBUGANYWAY))
|
2012-01-07 20:37:48 +00:00
|
|
|
debug+= -fomit-frame-pointer -DNDEBUG
|
2011-09-22 16:52:55 +00:00
|
|
|
endif
|
2011-03-25 11:42:07 +00:00
|
|
|
ifneq (0,$(LTO))
|
2012-03-23 20:22:10 +00:00
|
|
|
BASELDFLAGS+= -flto
|
2011-11-10 21:47:03 +00:00
|
|
|
debug+= -DUSING_LTO -flto
|
2011-03-25 11:42:07 +00:00
|
|
|
endif
|
2010-12-19 22:29:01 +00:00
|
|
|
else
|
|
|
|
# Debugging enabled
|
2012-01-28 14:36:52 +00:00
|
|
|
debug+= -O0
|
|
|
|
|
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
|
|
|
ifeq (0,$(DEBUGANYWAY))
|
|
|
|
debug+= -DDEBUGGINGAIDS
|
|
|
|
else
|
|
|
|
debug+= -DDEBUGGINGAIDS=2
|
|
|
|
endif
|
|
|
|
|
2011-12-09 19:09:00 +00:00
|
|
|
ifeq ($(CC),clang)
|
2012-01-28 14:36:52 +00:00
|
|
|
# CLANG_MAJOR := $(shell clang -dM -E -x c /dev/null | grep __clang_major__ | awk '{ print $$3 }')
|
2011-12-09 19:09:00 +00:00
|
|
|
debug+= -fcatch-undefined-behavior
|
2012-01-28 14:36:52 +00:00
|
|
|
# ifeq ($(CLANG_MAJOR),3)
|
|
|
|
# debug+= -faddress-sanitizer
|
|
|
|
# endif
|
2011-12-09 19:09:00 +00:00
|
|
|
endif
|
2011-01-16 07:19:29 +00:00
|
|
|
ifeq ($(PLATFORM),LINUX)
|
|
|
|
LIBS+=-rdynamic
|
|
|
|
endif
|
2011-03-19 17:59:09 +00:00
|
|
|
ifneq (0,$(MUDFLAP))
|
|
|
|
LIBS+= -lmudflapth
|
|
|
|
debug+= -fmudflapth
|
|
|
|
endif
|
2010-12-19 22:29:01 +00:00
|
|
|
ifneq (0,$(PROFILER))
|
2011-07-20 23:04:20 +00:00
|
|
|
# might need to be disabled for Darwin:
|
2010-12-19 22:29:01 +00:00
|
|
|
LIBS+= -lprofiler
|
|
|
|
debug+= -pg
|
|
|
|
endif
|
|
|
|
ifneq (0,$(KRANDDEBUG))
|
|
|
|
debug+=-DKRANDDEBUG=1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2011-12-09 19:08:47 +00:00
|
|
|
ifneq ($(CC),clang)
|
|
|
|
W_NO_UNUSED_RESULT := $(shell echo '' | $(CC) -E -Wno-unused-result - 2>/dev/null && echo -Wno-unused-result)
|
|
|
|
W_NO_UNUSED_RESULT := $(findstring -Wno-unused-result,$(W_NO_UNUSED_RESULT))
|
|
|
|
else
|
|
|
|
W_NO_UNUSED_RESULT :=
|
|
|
|
endif
|
2011-02-12 13:25:24 +00:00
|
|
|
|
2012-03-12 04:48:42 +00:00
|
|
|
BASECFLAGS=$(debug) -W -Wall -Werror-implicit-function-declaration \
|
2010-12-19 22:29:01 +00:00
|
|
|
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -D_FORTIFY_SOURCE=2 \
|
2011-07-20 23:04:20 +00:00
|
|
|
$(F_JUMP_TABLES) $(W_NO_UNUSED_RESULT) $(ARCH) \
|
2012-03-11 07:11:59 +00:00
|
|
|
-Wextra #-Wwrite-strings -Waddress -Wlogical-op
|
2011-12-09 19:08:47 +00:00
|
|
|
ifeq ($(CC),clang)
|
|
|
|
BASECFLAGS+= -Wno-unused-value -Wno-parentheses
|
|
|
|
endif
|
|
|
|
|
2011-03-19 18:07:12 +00:00
|
|
|
ifneq (0,$(USE_LIBPNG))
|
|
|
|
BASECFLAGS+= -DUSE_LIBPNG
|
|
|
|
endif
|
2011-07-18 19:06:29 +00:00
|
|
|
ifneq (0,$(USE_LIBVPX))
|
|
|
|
BASECFLAGS+= -DUSE_LIBVPX
|
|
|
|
endif
|
2012-03-08 06:07:10 +00:00
|
|
|
ifneq (0,$(OSX_STARTUPWINDOW))
|
|
|
|
BASECFLAGS+= -DOSX_STARTUPWINDOW
|
|
|
|
endif
|
2010-12-19 22:29:01 +00:00
|
|
|
|
2011-10-02 07:16:57 +00:00
|
|
|
ifneq (0,$(EFENCE))
|
|
|
|
LIBS+= -lefence
|
|
|
|
BASECFLAGS+= -DEFENCE
|
|
|
|
endif
|
2012-01-12 20:49:34 +00:00
|
|
|
ifneq (0,$(DMALLOC))
|
|
|
|
LIBS+= -ldmalloc
|
|
|
|
BASECFLAGS+= -DDMALLOC
|
|
|
|
endif
|
2011-10-02 07:16:57 +00:00
|
|
|
|
2010-12-19 22:29:01 +00:00
|
|
|
# Misc. stuff that is constant between Makefiles
|
|
|
|
EROOT:=build
|
|
|
|
|
|
|
|
# will be potentially overridden in build/Makefile.shared
|
|
|
|
EXESUFFIX=
|