raze-gles/polymer/eduke32/Makefile.common
hendricks266 0122764017 - Makefiles:
- Fix typo, correctly adding SDL libs to the tools on OS X so that makesdlkeytrans builds.
  - Move all mention of $(LIBS) out of build/Makefile into build/Makefile.shared because no linking takes place in the engine itself so LIBS additions were lost. This should fix USE_LIBPNG=1 on Windows at least.
- Other assorted cleanup.

git-svn-id: https://svn.eduke32.com/eduke32@2523 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-24 08:30:28 +00:00

198 lines
4.4 KiB
Text

## common definitions for Makefile, build/Makefile, source/enet/Makefile and
## source/jaudiolib/Makefile
# Use colored output
PRETTY_OUTPUT ?= 1
# Binary suffix override:
EXESUFFIX_OVERRIDE ?=
# 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:=
# Mac OS X Frameworks location
# Like above, use absolute paths.
APPLE_FRAMEWORKS ?=/Library/Frameworks
# Since the OS X startup window is generating errors, disable it by default.
OSX_STARTUPWINDOW ?= 0
# Engine options
# USE_OPENGL - enables basic OpenGL Polymost renderer
# POLYMER - enables fancy Polymer renderer
# 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
BUILD32_ON_64 ?= 0
# DO NOT SET THIS TO 1 AND COMMIT IT.
NEDMALLOC = 0
USE_LIBPNG ?= 0
USE_LIBVPX ?= 1
ifeq (0,$(USE_OPENGL))
POLYMER = 0
USE_LIBVPX = 0
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
# LTO - 1 = enable link-time optimization, for GCC 4.5 and up
# CLANG - 1 = enable the Clang/LLVM compiler
#
RELEASE?=1
DEBUGANYWAY?=0
KRANDDEBUG?=0
EFENCE?=0
DMALLOC?=0
OPTLEVEL?=2
PROFILER?=0
MUDFLAP?=0
LTO?=0
CLANG?=0
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
ifneq (0,$(CLANG))
CC=clang
CXX=clang++
AR=llvm-ar
RANLIB=llvm-ranlib
endif
# compiler flags etc.
BASECONLYFLAGS=-Wimplicit
BASECXXFLAGS= -fno-exceptions -fno-rtti
BASEASFLAGS=-s #-g
BASELDFLAGS=
LIBS=-lm
ifneq (0,$(USE_LIBPNG))
LIBS+= -lpng -lz
endif
ifneq (0,$(USE_LIBVPX))
# On Windows, we link statically to libvpx
LIBS+= -lvpx
endif
ifneq ($(RELEASE)$(DEBUGANYWAY),10)
# debug build or DEBUGANYWAY=1 --> -g flag
ifeq ($(CC),clang)
debug=-g
else
debug=-ggdb
endif
endif
ifneq (0,$(RELEASE))
# Debugging disabled
debug+= -O$(OPTLEVEL)
ifneq ($(CC),clang)
debug+= -funswitch-loops
endif
ifeq (0,$(DEBUGANYWAY))
debug+= -fomit-frame-pointer -DNDEBUG
endif
ifneq (0,$(LTO))
BASELDFLAGS+= -flto
debug+= -DUSING_LTO -flto
endif
else
# Debugging enabled
debug+= -O0
ifeq (0,$(DEBUGANYWAY))
debug+= -DDEBUGGINGAIDS
else
debug+= -DDEBUGGINGAIDS=2
endif
ifeq ($(CC),clang)
# CLANG_MAJOR := $(shell clang -dM -E -x c /dev/null | grep __clang_major__ | awk '{ print $$3 }')
debug+= -fcatch-undefined-behavior
# ifeq ($(CLANG_MAJOR),3)
# debug+= -faddress-sanitizer
# endif
endif
ifeq ($(PLATFORM),LINUX)
LIBS+=-rdynamic
endif
ifneq (0,$(MUDFLAP))
LIBS+= -lmudflapth
debug+= -fmudflapth
endif
ifneq (0,$(PROFILER))
# might need to be disabled for Darwin:
LIBS+= -lprofiler
debug+= -pg
endif
ifneq (0,$(KRANDDEBUG))
debug+=-DKRANDDEBUG=1
endif
endif
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
BASECFLAGS=$(debug) -W -Wall -Werror-implicit-function-declaration \
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -D_FORTIFY_SOURCE=2 \
$(F_JUMP_TABLES) $(W_NO_UNUSED_RESULT) $(ARCH) \
-Wextra #-Wwrite-strings -Waddress -Wlogical-op
ifeq ($(CC),clang)
BASECFLAGS+= -Wno-unused-value -Wno-parentheses
endif
ifneq (0,$(USE_LIBPNG))
BASECFLAGS+= -DUSE_LIBPNG
endif
ifneq (0,$(USE_LIBVPX))
BASECFLAGS+= -DUSE_LIBVPX
endif
ifneq (0,$(OSX_STARTUPWINDOW))
BASECFLAGS+= -DOSX_STARTUPWINDOW
endif
ifneq (0,$(EFENCE))
LIBS+= -lefence
BASECFLAGS+= -DEFENCE
endif
ifneq (0,$(DMALLOC))
LIBS+= -ldmalloc
BASECFLAGS+= -DDMALLOC
endif
# Misc. stuff that is constant between Makefiles
EROOT:=build
# will be potentially overridden in build/Makefile.shared
EXESUFFIX=