2006-04-13 20:47:06 +00:00
|
|
|
# Shared make information between Build engine and games
|
|
|
|
|
|
|
|
ENGINELIB=libengine.a
|
|
|
|
EDITORLIB=libbuild.a
|
|
|
|
|
2011-04-07 01:16:29 +00:00
|
|
|
SDLCONFIG = /usr/local/bin/sdl-config
|
2008-10-24 01:33:53 +00:00
|
|
|
|
|
|
|
ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG))
|
|
|
|
SDLROOT = /usr/local
|
|
|
|
else
|
2011-02-25 21:50:19 +00:00
|
|
|
SDLCONFIG = /usr/bin/sdl-config
|
2008-10-24 01:33:53 +00:00
|
|
|
endif
|
|
|
|
|
2008-08-20 22:58:09 +00:00
|
|
|
SDL_FRAMEWORK = 0
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-08-20 22:58:09 +00:00
|
|
|
# Overridden for OSes that don't have the cutdown stdc++ that is supc++
|
2008-11-11 14:48:59 +00:00
|
|
|
STDCPPLIB=-lsupc++
|
2006-04-13 20:47:06 +00:00
|
|
|
BUILDCFLAGS=
|
|
|
|
|
2010-08-12 21:06:51 +00:00
|
|
|
# GCC version, for conditional selection of flags.
|
|
|
|
# This is easier than trying to squeeze it out of gcc --version:
|
|
|
|
GCC_MAJOR ?= 4
|
|
|
|
ifeq (4,$(GCC_MAJOR))
|
|
|
|
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
|
2011-12-09 19:08:47 +00:00
|
|
|
ifneq ($(CC),clang)
|
|
|
|
F_JUMP_TABLES := -fjump-tables
|
|
|
|
endif
|
2010-08-12 21:06:51 +00:00
|
|
|
M_TUNE_GENERIC := -mtune=generic
|
|
|
|
M_STACKREALIGN := -mstackrealign
|
|
|
|
L_SSP := -lssp
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2010-07-03 08:53:57 +00:00
|
|
|
ifndef ARCH
|
|
|
|
ifeq ($(findstring i686, $(shell uname -m)), i686)
|
2010-08-12 21:06:51 +00:00
|
|
|
ARCH=-march=pentium3 $(M_TUNE_GENERIC) -mmmx # -msse2 -mfpmath=sse,387 -malign-double $(M_STACKREALIGN)
|
2010-07-03 08:53:57 +00:00
|
|
|
else
|
|
|
|
ARCH=
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2006-04-13 20:47:06 +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.
|
2008-08-20 22:58:09 +00:00
|
|
|
#
|
2006-04-13 20:47:06 +00:00
|
|
|
ifndef PLATFORM
|
2010-08-12 21:06:51 +00:00
|
|
|
uname=$(strip $(shell uname -s))
|
|
|
|
PLATFORM=UNKNOWN
|
|
|
|
ifeq ($(findstring Linux,$(uname)),Linux)
|
|
|
|
PLATFORM=LINUX
|
|
|
|
endif
|
|
|
|
ifeq ($(findstring BSD,$(uname)),BSD)
|
|
|
|
PLATFORM=BSD
|
|
|
|
endif
|
|
|
|
ifeq ($(findstring MINGW,$(uname)),MINGW)
|
|
|
|
PLATFORM=WINDOWS
|
|
|
|
endif
|
|
|
|
ifeq ($(findstring Darwin,$(uname)),Darwin)
|
|
|
|
PLATFORM=DARWIN
|
|
|
|
endif
|
|
|
|
ifeq ($(findstring BeOS,$(uname)),BeOS)
|
|
|
|
PLATFORM=BEOS
|
|
|
|
endif
|
|
|
|
ifeq ($(findstring skyos,$(uname)),skyos)
|
|
|
|
PLATFORM=SKYOS
|
|
|
|
endif
|
|
|
|
ifeq ($(findstring QNX,$(uname)),QNX)
|
|
|
|
PLATFORM=QNX
|
|
|
|
endif
|
|
|
|
ifeq ($(findstring SunOS,$(uname)),SunOS)
|
|
|
|
PLATFORM=SUNOS
|
|
|
|
endif
|
|
|
|
ifeq ($(findstring syllable,$(uname)),syllable)
|
|
|
|
PLATFORM=SYLLABLE
|
|
|
|
endif
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(PLATFORM),LINUX)
|
2010-08-12 21:06:51 +00:00
|
|
|
RENDERTYPE=SDL
|
|
|
|
BUILDCFLAGS+= -DHAVE_INTTYPES
|
|
|
|
GTKCOMPAT32=0
|
|
|
|
|
|
|
|
ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
|
|
|
|
ifeq (1,$(BUILD32_ON_64))
|
|
|
|
# On my 64bit Gentoo these are the 32bit emulation libs
|
|
|
|
LIBS+= -m32 -L/emul/linux/x86/usr/lib
|
|
|
|
BUILDCFLAGS+= -m32
|
|
|
|
# Override WITHOUT_GTK=0
|
|
|
|
GTKCOMPAT32=1
|
|
|
|
else
|
|
|
|
override NOASM=1
|
|
|
|
endif
|
|
|
|
endif
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
2008-08-20 22:58:09 +00:00
|
|
|
ifeq ($(PLATFORM),DARWIN)
|
2010-08-12 21:06:51 +00:00
|
|
|
RENDERTYPE = SDL
|
2011-10-11 16:53:52 +00:00
|
|
|
BUILDCFLAGS += -DHAVE_INTTYPES #-fno-leading-underscore
|
2010-08-12 21:06:51 +00:00
|
|
|
GTKCOMPAT32 = 0
|
|
|
|
SDL_FRAMEWORK = 1
|
2011-06-17 11:53:41 +00:00
|
|
|
ifeq (1,$(BUILD32_ON_64))
|
|
|
|
BUILDCFLAGS += $(F_NO_STACK_PROTECTOR) -arch i386
|
|
|
|
else
|
2011-07-20 23:04:20 +00:00
|
|
|
ifeq ($(findstring ppc,$(ARCH)),ppc)
|
|
|
|
BUILDCFLAGS += $(F_NO_STACK_PROTECTOR)
|
|
|
|
endif
|
2011-10-11 16:53:52 +00:00
|
|
|
# ASM won't work on PowerPC or x86_64
|
2011-06-17 11:53:41 +00:00
|
|
|
override NOASM = 1
|
|
|
|
endif
|
2008-08-20 22:58:09 +00:00
|
|
|
endif
|
2006-04-13 20:47:06 +00:00
|
|
|
ifeq ($(PLATFORM),WINDOWS)
|
2010-08-12 21:06:51 +00:00
|
|
|
RENDERTYPE ?= WIN
|
|
|
|
BUILDCFLAGS+= -DHAVE_INTTYPES
|
|
|
|
EXESUFFIX=.exe
|
|
|
|
LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32 #-lshfolder
|
|
|
|
# STDCPPLIB=-lstdc++
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(PLATFORM),BSD)
|
2010-08-12 21:06:51 +00:00
|
|
|
RENDERTYPE=SDL
|
|
|
|
BUILDCFLAGS+= -DHAVE_INTTYPES
|
2011-05-11 21:58:19 +00:00
|
|
|
ifneq ($(findstring i386, $(shell uname -m)), i386)
|
|
|
|
override NOASM=1
|
|
|
|
endif
|
|
|
|
override NEDMALLOC=0
|
|
|
|
STDCPPLIB=-lstdc++
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(PLATFORM),BEOS)
|
2010-08-12 21:06:51 +00:00
|
|
|
RENDERTYPE=SDL
|
|
|
|
STDCPPLIB=-lstdc++
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(PLATFORM),SKYOS)
|
2010-08-12 21:06:51 +00:00
|
|
|
RENDERTYPE=SDL
|
|
|
|
EXESUFFIX=.app
|
|
|
|
override NOASM=1
|
|
|
|
BUILDCFLAGS+= -DUNDERSCORES
|
|
|
|
SDLCONFIG=
|
|
|
|
SDLCONFIG_CFLAGS=-I/boot/programs/sdk/include/sdl
|
|
|
|
LIBS+= -lSDL -lnet
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(PLATFORM),QNX)
|
2010-08-12 21:06:51 +00:00
|
|
|
RENDERTYPE=SDL
|
|
|
|
override USE_OPENGL=0
|
|
|
|
override NOASM=1
|
|
|
|
STDCPPLIB=-lstdc++
|
|
|
|
LIBS+= -lsocket
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(PLATFORM),SUNOS)
|
2010-08-12 21:06:51 +00:00
|
|
|
RENDERTYPE=SDL
|
|
|
|
override USE_OPENGL=0
|
|
|
|
override NOASM=1
|
|
|
|
STDCPPLIB=-lstdc++
|
|
|
|
LIBS+= -lsocket -lnsl
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(PLATFORM),SYLLABLE)
|
2010-08-12 21:06:51 +00:00
|
|
|
RENDERTYPE=SDL
|
|
|
|
override USE_OPENGL=0
|
|
|
|
override NOASM=1
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(RENDERTYPE),SDL)
|
2010-08-12 21:06:51 +00:00
|
|
|
ifeq ($(SDL_FRAMEWORK),1)
|
|
|
|
LIBS += -Wl,-framework,SDL
|
2012-03-04 09:31:37 +00:00
|
|
|
SDLCONFIG_CFLAGS+= -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers
|
2010-08-12 21:06:51 +00:00
|
|
|
else
|
|
|
|
ifneq ($(SDLCONFIG),)
|
|
|
|
LIBS+= $(shell $(SDLCONFIG) --libs)
|
|
|
|
SDLCONFIG_CFLAGS+=$(shell $(SDLCONFIG) --cflags)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (1,$(WITHOUT_GTK))
|
|
|
|
HAVE_GTK2=0
|
|
|
|
else
|
|
|
|
ifneq (No,$(shell pkg-config --exists gtk+-2.0 || echo No))
|
|
|
|
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)
|
|
|
|
LIBS+= $(shell pkg-config --libs gtk+-2.0 | sed 's/\s-l\(pango\)\{0,1\}cairo\S*\s/ /g')
|
|
|
|
else
|
|
|
|
LIBS+= $(shell pkg-config --libs gtk+-2.0)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
HAVE_GTK2=0
|
|
|
|
endif
|
|
|
|
endif
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
2010-08-12 21:06:51 +00:00
|
|
|
ifeq ($(RENDERTYPE),WIN)
|
|
|
|
LIBS+= -mwindows -ldxguid
|
|
|
|
endif
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
|
2008-11-11 13:24:05 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
BUILDCFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1
|
|
|
|
|
|
|
|
ifneq (0,$(USE_OPENGL))
|
2010-08-12 21:06:51 +00:00
|
|
|
BUILDCFLAGS+= -DUSE_OPENGL
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
ifneq (0,$(NOASM))
|
2010-08-12 21:06:51 +00:00
|
|
|
BUILDCFLAGS+= -DNOASM
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
2007-08-17 19:32:56 +00:00
|
|
|
ifneq (0,$(LINKED_GTK))
|
2010-08-12 21:06:51 +00:00
|
|
|
BUILDCFLAGS+= -DLINKED_GTK
|
2007-08-17 19:32:56 +00:00
|
|
|
endif
|
2007-08-16 23:25:24 +00:00
|
|
|
|
2008-05-10 01:29:37 +00:00
|
|
|
ifneq (0,$(POLYMER))
|
2011-03-04 08:50:58 +00:00
|
|
|
ifneq (0,$(USE_OPENGL))
|
|
|
|
BUILDCFLAGS+= -DPOLYMER
|
2008-05-10 01:29:37 +00:00
|
|
|
endif
|
|
|
|
endif
|
2008-10-18 12:37:26 +00:00
|
|
|
|
2010-05-18 00:30:30 +00:00
|
|
|
ifneq (0,$(NEDMALLOC))
|
2010-08-12 21:06:51 +00:00
|
|
|
BUILDCFLAGS+= -DNEDMALLOC
|
2010-05-18 00:30:30 +00:00
|
|
|
endif
|
|
|
|
|
2008-10-19 12:14:04 +00:00
|
|
|
ifeq ($(PRETTY_OUTPUT),1)
|
2008-10-20 03:09:19 +00:00
|
|
|
BUILD_STARTED = printf "\033[K\033[1;36mBuild started using \"$(CC) $(OURCFLAGS)\"\033[0m\n"
|
2010-12-19 22:29:01 +00:00
|
|
|
BUILD_ECHOFLAGS = printf "\033[K\033[1;36mEnded compilation in this directory using \"$(CC) $(OURCFLAGS)\"\033[0m\n"
|
2008-10-18 13:25:23 +00:00
|
|
|
BUILD_FINISHED = printf "\033[K\033[1;36mBuild successful:\033[0m\n"
|
2008-10-31 10:08:51 +00:00
|
|
|
COMPILE_STATUS = printf "\033[K\033[0mBuilding object \033[1m$@\033[0m...\033[0m\r"
|
2008-11-20 14:06:36 +00:00
|
|
|
COMPILE_OK = printf "\033[K\033[0;32mBuilt object \033[1;32m$@\033[0;32m \033[0m\n"
|
2008-10-20 03:09:19 +00:00
|
|
|
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
|
2010-12-19 22:29:01 +00:00
|
|
|
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
|
2008-10-31 10:08:51 +00:00
|
|
|
LINK_STATUS = printf "\033[K\033[0;0mLinking executable \033[1m$@\033[0;0m...\033[0m\r"
|
2008-11-20 14:06:36 +00:00
|
|
|
LINK_OK = printf "\033[K\033[0;32mLinked executable \033[1;32m$@\033[0;32m \033[0m\n"
|
2008-10-20 03:09:19 +00:00
|
|
|
LINK_FAILED = printf "\033[K\033[0;31mFailed linking executable \033[1;31m$@\033[0;31m!\033[0m\n"; exit 1
|
2008-10-19 12:14:04 +00:00
|
|
|
else
|
|
|
|
BUILD_STARTED =
|
2010-12-19 22:29:01 +00:00
|
|
|
BUILD_ECHOFLAGS=
|
2008-10-19 12:14:04 +00:00
|
|
|
BUILD_FINISHED =
|
|
|
|
COMPILE_STATUS =
|
2008-10-20 03:09:19 +00:00
|
|
|
COMPILE_OK = true
|
|
|
|
COMPILE_FAILED = false; exit 1
|
2010-12-19 22:29:01 +00:00
|
|
|
ARCHIVE_STATUS =
|
|
|
|
ARCHIVE_OK = true
|
|
|
|
ARCHIVE_FAILED = false; exit 1
|
2008-10-19 12:14:04 +00:00
|
|
|
LINK_STATUS =
|
2008-10-20 03:09:19 +00:00
|
|
|
LINK_OK = true
|
|
|
|
LINK_FAILED = false; exit 1
|
2008-10-20 12:33:29 +00:00
|
|
|
endif
|