mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
f51bdc2faa
* Centralize optimization strategies in Makefile.common. This required moving detection of $(PLATFORM), which makes sense if we work on the paradigm that Makefile.common is for generic compiler setup and Makefile.shared works with libraries and things closer to the engine and game code itself. * New Makefile variables OPTOPT (Optimization Options) and CUSTOMOPT (Custom Optimizations). OPTOPT by default contains -march, -mtune, etc. Setting this variable from Make invocation will blank these. CUSTOMOPT (Custom Optimizations) works the same but in an additive fashion, overwriting nothing. Technically CUSTOMOPT could stand for (Custom Options) and include any additional parameters sent to both linker and compiler. * Factor out literal names of the main executables. * The build process now prints assembler (if NOASM=0) and linker settings in addition to compiler settings. git-svn-id: https://svn.eduke32.com/eduke32@3096 1a8010ca-5511-0410-912e-c29ae57300e0
289 lines
8.2 KiB
Text
289 lines
8.2 KiB
Text
# Shared make information between Build engine and games
|
|
|
|
ENGINELIB=libengine.a
|
|
EDITORLIB=libbuild.a
|
|
|
|
SDLCONFIG = /usr/local/bin/sdl-config
|
|
SDLNAME = SDL
|
|
|
|
ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG))
|
|
# $(info Detected locally installed SDL 1.X)
|
|
SDLROOT = /usr/local
|
|
else
|
|
# Swap the commenting in the following two lines to
|
|
# enable SDL 2.X detection
|
|
SDLCONFIG = /usr/local/file_that_does_not_exist
|
|
# SDLCONFIG = /usr/local/bin/sdl2-config
|
|
|
|
ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG))
|
|
# $(info Detected locally installed SDL 2.X)
|
|
SDLROOT = /usr/local
|
|
SDLNAME = SDL2
|
|
else
|
|
# $(info Detected system-wide installed SDL 1.X)
|
|
SDLCONFIG = /usr/bin/sdl-config
|
|
endif
|
|
endif
|
|
|
|
SDL_FRAMEWORK = 0
|
|
|
|
ifeq (4,$(GCC_MAJOR))
|
|
L_SSP := -lssp
|
|
endif
|
|
|
|
BUILDCFLAGS=$(ARCH)
|
|
BUILDLDFLAGS=$(ARCH)
|
|
|
|
ifeq ($(PLATFORM),LINUX)
|
|
STDCPPLIB=
|
|
else
|
|
# Overridden for OSes that don't have the cutdown stdc++ that is supc++
|
|
STDCPPLIB= -lsupc++
|
|
endif
|
|
|
|
ifeq ($(PLATFORM),LINUX)
|
|
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
|
|
endif
|
|
ifeq ($(PLATFORM),DARWIN)
|
|
RENDERTYPE = SDL
|
|
STDCPPLIB = -lstdc++
|
|
BUILDCFLAGS += -DHAVE_INTTYPES
|
|
GTKCOMPAT32 = 0
|
|
SDL_FRAMEWORK = 1
|
|
|
|
ifeq (1,$(DARWIN9))
|
|
BUILDCFLAGS += -DDARWIN9
|
|
endif
|
|
|
|
ifeq (1,$(BUILD32_ON_64))
|
|
ARCH=-arch i386
|
|
else
|
|
# ASM won't work on PowerPC or x86_64
|
|
override NOASM = 1
|
|
endif
|
|
endif
|
|
ifeq ($(PLATFORM),WINDOWS)
|
|
RENDERTYPE ?= WIN
|
|
BUILDCFLAGS+= -DHAVE_INTTYPES
|
|
EXESUFFIX=.exe
|
|
LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32
|
|
#-lshfolder
|
|
# STDCPPLIB=-lstdc++
|
|
endif
|
|
ifeq ($(PLATFORM),BSD)
|
|
RENDERTYPE=SDL
|
|
BUILDCFLAGS+= -DHAVE_INTTYPES
|
|
ifneq ($(findstring i386, $(SYSARCH)), i386)
|
|
override NOASM=1
|
|
endif
|
|
STDCPPLIB=-lstdc++
|
|
endif
|
|
ifeq ($(PLATFORM),BEOS)
|
|
RENDERTYPE=SDL
|
|
STDCPPLIB=-lstdc++
|
|
endif
|
|
ifeq ($(PLATFORM),SKYOS)
|
|
RENDERTYPE=SDL
|
|
EXESUFFIX=.app
|
|
override NOASM=1
|
|
BUILDCFLAGS+= -DUNDERSCORES
|
|
SDLCONFIG=
|
|
SDLCONFIG_CFLAGS=-I/boot/programs/sdk/include/sdl
|
|
LIBS+= -lSDL -lnet
|
|
endif
|
|
ifeq ($(PLATFORM),WII)
|
|
ifeq ($(strip $(DEVKITPPC)),)
|
|
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
|
endif
|
|
|
|
include $(DEVKITPPC)/wii_rules
|
|
|
|
RANLIB=powerpc-eabi-ranlib
|
|
STRIP=powerpc-eabi-strip
|
|
|
|
RENDERTYPE=SDL
|
|
EXESUFFIX=.elf
|
|
override USE_OPENGL=0
|
|
override NOASM=1
|
|
override WITHOUT_GTK=1
|
|
# -msdata=eabi
|
|
BUILDCFLAGS+= -g -mtune=750 -meabi -mhard-float \
|
|
-DGEKKO -DHAVE_INTTYPES -D__POWERPC__ \
|
|
-I$(LIBOGC_INC) -I$(LIBOGC_INC)/SDL -I$(PORTLIBS)/include
|
|
SDLCONFIG=
|
|
LIBS+= -lSDL_mixer -lsmpeg -lSDL -laesnd
|
|
endif
|
|
ifeq ($(PLATFORM),QNX)
|
|
RENDERTYPE=SDL
|
|
override USE_OPENGL=0
|
|
override NOASM=1
|
|
STDCPPLIB=-lstdc++
|
|
LIBS+= -lsocket
|
|
endif
|
|
ifeq ($(PLATFORM),SUNOS)
|
|
RENDERTYPE=SDL
|
|
override USE_OPENGL=0
|
|
override NOASM=1
|
|
STDCPPLIB=-lstdc++
|
|
LIBS+= -lsocket -lnsl
|
|
endif
|
|
ifeq ($(PLATFORM),SYLLABLE)
|
|
RENDERTYPE=SDL
|
|
override USE_OPENGL=0
|
|
override NOASM=1
|
|
endif
|
|
|
|
ifeq ($(RENDERTYPE),SDL)
|
|
ifeq ($(SDL_FRAMEWORK),1)
|
|
LIBS += -Wl,-framework,SDL
|
|
SDLCONFIG_CFLAGS+= -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers
|
|
else
|
|
ifneq ($(SDLCONFIG),)
|
|
SDLCONFIG_LIBS+= $(shell $(SDLCONFIG) --libs)
|
|
LIBS+= $(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
|
|
else
|
|
ifeq ($(RENDERTYPE),WIN)
|
|
LIBS+= -mwindows -ldxguid
|
|
endif
|
|
endif
|
|
|
|
|
|
BUILDCFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1 $(W_STRICT_OVERFLOW)
|
|
|
|
ifneq (0,$(USE_OPENGL))
|
|
BUILDCFLAGS+= -DUSE_OPENGL
|
|
endif
|
|
ifneq (0,$(NOASM))
|
|
BUILDCFLAGS+= -DNOASM
|
|
endif
|
|
ifneq (0,$(LINKED_GTK))
|
|
BUILDCFLAGS+= -DLINKED_GTK
|
|
endif
|
|
|
|
ifneq (0,$(POLYMER))
|
|
ifneq (0,$(USE_OPENGL))
|
|
BUILDCFLAGS+= -DPOLYMER
|
|
endif
|
|
endif
|
|
|
|
ifneq ($(EXESUFFIX_OVERRIDE),)
|
|
EXESUFFIX=$(EXESUFFIX_OVERRIDE)
|
|
endif
|
|
|
|
STATICSTDCPP?=
|
|
ifeq (1,$(STATICSTDCPP))
|
|
STATICSTDCPP= -static
|
|
endif
|
|
ifeq (0,$(STATICSTDCPP))
|
|
STATICSTDCPP= -shared
|
|
endif
|
|
|
|
|
|
ifneq ($(PLATFORM),WINDOWS)
|
|
ifneq ($(PLATFORM),WII)
|
|
LIBS+= -ldl
|
|
endif
|
|
LIBS+= -pthread
|
|
endif
|
|
|
|
ifeq ($(PLATFORM),WINDOWS)
|
|
ifneq ($(USE_LIBPNG),0)
|
|
# XXX: these assume that the compiler runs from build/. Ugh.
|
|
LIBS+= -L../Windows/lib -lpng_mini -lz_mini
|
|
BUILDCFLAGS+= -I../Windows/include
|
|
endif
|
|
else
|
|
ifeq ($(PLATFORM),DARWIN)
|
|
ifneq ($(USE_LIBPNG),0)
|
|
BUILDCFLAGS+= -I/opt/local/include -I/sw/include -I/usr/local/include
|
|
LIBS+= -L/opt/local/lib -L/usr/local/lib -lpng # -lz
|
|
endif
|
|
else
|
|
ifneq ($(USE_LIBPNG),0)
|
|
LIBS+= -lpng -lz
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(PLATFORM),WINDOWS)
|
|
LIBS+= $(L_SSP) -Wl,--enable-auto-import
|
|
LIBS+= -lwsock32 -lws2_32 -lwinmm #-L$(ENETROOT)
|
|
endif
|
|
|
|
|
|
ifeq ($(PRETTY_OUTPUT),1)
|
|
BUILD_SETTINGS_COMPILER = \033[1;33mcompiler: \033[0;33m\"$(CC) $(OURCFLAGS) $(OURCONLYFLAGS) $(OURCXXFLAGS)\"
|
|
BUILD_SETTINGS_ASSEMBLER = \033[1;33massembler: \033[0;33m\"$(AS) $(OURASFLAGS)\"
|
|
BUILD_SETTINGS_LINKER = \033[1;33mlinker: \033[0;33m\"$(OURLDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB)\"
|
|
ifeq (0,$(NOASM))
|
|
BUILD_SETTINGS = printf "$(BUILD_SETTINGS_COMPILER)\n$(BUILD_SETTINGS_ASSEMBLER)\n$(BUILD_SETTINGS_LINKER)\033[0m\n"
|
|
else
|
|
BUILD_SETTINGS = printf "$(BUILD_SETTINGS_COMPILER)\n$(BUILD_SETTINGS_LINKER)\033[0m\n"
|
|
endif
|
|
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"
|
|
BUILD_FINISHED = printf "\033[K\033[1;36mBuild successful:\033[0m\n"
|
|
COMPILE_STATUS = printf "\033[K\033[0mBuilding object \033[1m$@\033[0m...\033[0m\r"
|
|
ONESTEP_STATUS = printf "\033[K\033[0mBuilding executable \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"
|
|
ONESTEP_OK = printf "\033[K\033[0;32mBuilt executable \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
|
|
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
|
|
LINK_STATUS = printf "\033[K\033[0;0mLinking executable \033[1m$@\033[0;0m...\033[0m\r"
|
|
LINK_OK = printf "\033[K\033[0;32mLinked executable \033[1;32m$@\033[0;32m \033[0m\n"
|
|
LINK_FAILED = printf "\033[K\033[0;31mFailed linking executable \033[1;31m$@\033[0;31m!\033[0m\n"; exit 1
|
|
else
|
|
BUILD_STARTED =
|
|
BUILD_ECHOFLAGS =
|
|
BUILD_FINISHED =
|
|
COMPILE_STATUS =
|
|
ONESTEP_STATUS =
|
|
COMPILE_OK = true
|
|
ONESTEP_OK = true
|
|
COMPILE_FAILED = false; exit 1
|
|
ARCHIVE_STATUS =
|
|
ARCHIVE_OK = true
|
|
ARCHIVE_FAILED = false; exit 1
|
|
LINK_STATUS =
|
|
LINK_OK = true
|
|
LINK_FAILED = false; exit 1
|
|
endif
|