mirror of https://github.com/OpenTTD/OpenTTD
(svn r4660) - Backport from trunk (r4183, r4197, r4217):
Codechange: [Makefile]: removed MANUAL_CONFIG as it's not used anymore This should hopefully fix the issue where WITH_SDL can be defined while SDL_CONFIG is not. Added an error if WITH_SDL is defined but SDL_CONFIG is not. Replace the dash of SDL_CONFIG/LIBPNG_CONFIG with an underscorerelease/0.4
parent
39ebb55b9b
commit
ec47441ce4
74
Makefile
74
Makefile
|
@ -46,7 +46,6 @@
|
|||
# WITH_COCOA: Cocoa video driver support
|
||||
#
|
||||
# Summary of other defines:
|
||||
# MANUAL_CONFIG: do not use Makefile.config, config options set manually
|
||||
# DEBUG: build in debug mode
|
||||
# PROFILE: build in profile mode, disables -s and -fomit-frame-pointer
|
||||
# TRANSLATOR: build in translator mode (untranslated strings are prepended by
|
||||
|
@ -137,10 +136,6 @@
|
|||
# it checks if the version tag in Makefile.config is the same and force update outdated config files
|
||||
MAKEFILE_VERSION:=10
|
||||
|
||||
# CONFIG_WRITER has to be found even for manual configuration
|
||||
CONFIG_WRITER=makefiledir/Makefile.config_writer
|
||||
|
||||
ifndef MANUAL_CONFIG
|
||||
# Automatic configuration
|
||||
MAKE_CONFIG:=Makefile.config
|
||||
MAKEFILE:=Makefile
|
||||
|
@ -151,30 +146,10 @@ CONFIG_WRITER=makefiledir/Makefile.config_writer
|
|||
# See target section for how this is built, suppress errors
|
||||
# since first time it isn't found but make reads this twice
|
||||
-include $(MAKE_CONFIG)
|
||||
else
|
||||
CONFIG_INCLUDED:=1
|
||||
endif
|
||||
|
||||
ifndef LIBPNG-CONFIG
|
||||
LIBPNG-CONFIG :=libpng-config
|
||||
endif
|
||||
|
||||
# updates Makefile.config if it's outdated
|
||||
ifneq ($(MAKEFILE_VERSION),$(CONFIG_VERSION))
|
||||
ifndef MANUAL_CONFIG # manual config should not check this
|
||||
UPDATECONFIG:=upgradeconf
|
||||
CONFIG_INCLUDED:=
|
||||
else
|
||||
# this should define SDL-CONFIG for manual configuration
|
||||
ifeq ($(shell uname),FreeBSD)
|
||||
SDL-CONFIG:=sdl11-config
|
||||
else
|
||||
SDL-CONFIG:=sdl-config
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef SDL-CONFIG
|
||||
UPDATECONFIG:=upgradeconf
|
||||
CONFIG_INCLUDED:=
|
||||
endif
|
||||
|
@ -251,6 +226,17 @@ ifdef OSX
|
|||
LDFLAGS+=-framework Cocoa
|
||||
endif
|
||||
|
||||
ifdef WITH_SDL
|
||||
ifndef SDL_CONFIG
|
||||
$(error WITH_SDL can't be used when SDL_CONFIG is not set. Edit Makefile.config to correct this)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef WITH_PNG
|
||||
ifndef LIBPNG_CONFIG
|
||||
$(error WITH_PNG can't be used when LIBPNG_CONFIG is not set. Edit Makefile.config to correct this)
|
||||
endif
|
||||
endif
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
|
@ -416,42 +402,22 @@ endif
|
|||
# SDL config
|
||||
ifdef WITH_SDL
|
||||
CDEFS += -DWITH_SDL
|
||||
CFLAGS += $(shell $(SDL-CONFIG) --cflags)
|
||||
CFLAGS += $(shell $(SDL_CONFIG) --cflags)
|
||||
ifdef STATIC
|
||||
LIBS += $(shell $(SDL-CONFIG) --static-libs)
|
||||
LIBS += $(shell $(SDL_CONFIG) --static-libs)
|
||||
else
|
||||
LIBS += $(shell $(SDL-CONFIG) --libs)
|
||||
LIBS += $(shell $(SDL_CONFIG) --libs)
|
||||
endif
|
||||
endif
|
||||
|
||||
# zlib config
|
||||
ifdef WITH_ZLIB
|
||||
CDEFS += -DWITH_ZLIB
|
||||
CDEFS += -DWITH_ZLIB
|
||||
ifdef STATIC
|
||||
ifdef OSX
|
||||
# zlib is default on OSX, so everybody have it. No need for static linking
|
||||
# OSX links dynamically to zlib, even in static builds since it's always present in the system
|
||||
LIBS += -lz
|
||||
else
|
||||
ifndef STATIC_ZLIB_PATH
|
||||
ifndef MANUAL_CONFIG
|
||||
# updates Makefile.config with the zlib path
|
||||
UPDATECONFIG:=upgradeconf
|
||||
endif
|
||||
TEMP:=$(shell ls /lib 2>/dev/null | grep "zlib.a")$(shell ls /lib 2>/dev/null | grep "libz.a")
|
||||
ifdef TEMP
|
||||
STATIC_ZLIB_PATH:=/lib/$(TEMP)
|
||||
else
|
||||
TEMP:=$(shell ls /usr/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/lib 2>/dev/null | grep "libz.a")
|
||||
ifdef TEMP
|
||||
STATIC_ZLIB_PATH:=/usr/lib/$(TEMP)
|
||||
else
|
||||
TEMP:=$(shell ls /usr/local/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/local/lib 2>/dev/null | grep "libz.a")
|
||||
ifdef TEMP
|
||||
STATIC_ZLIB_PATH:=/usr/local/lib/$(TEMP)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
LIBS += $(STATIC_ZLIB_PATH)
|
||||
endif
|
||||
else
|
||||
|
@ -462,19 +428,19 @@ endif
|
|||
# libpng config
|
||||
ifdef WITH_PNG
|
||||
CDEFS += -DWITH_PNG
|
||||
CFLAGS += $(shell $(LIBPNG-CONFIG) --cppflags --I_opts)
|
||||
CFLAGS += $(shell $(LIBPNG_CONFIG) --cppflags --I_opts)
|
||||
|
||||
# seems like older libpng versions are broken and need this
|
||||
PNGCONFIG_FLAGS = --ldflags --libs
|
||||
ifdef STATIC
|
||||
ifdef OSX
|
||||
# Seems like we need a tiny hack for OSX static to work
|
||||
LIBS += $(shell $(LIBPNG-CONFIG) --prefix)/lib/libpng.a
|
||||
LIBS += $(shell $(LIBPNG_CONFIG) --prefix)/lib/libpng.a
|
||||
else
|
||||
LIBS += $(shell $(LIBPNG-CONFIG) --static $(PNGCONFIG_FLAGS))
|
||||
LIBS += $(shell $(LIBPNG_CONFIG) --static $(PNGCONFIG_FLAGS))
|
||||
endif
|
||||
else
|
||||
LIBS += $(shell $(LIBPNG-CONFIG) --L_opts $(PNGCONFIG_FLAGS))
|
||||
LIBS += $(shell $(LIBPNG_CONFIG) --L_opts $(PNGCONFIG_FLAGS))
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -94,8 +94,8 @@ $(MAKE_CONFIG):
|
|||
$(call CONFIG_LINE,)
|
||||
|
||||
$(call CONFIG_LINE,\# misc)
|
||||
$(call CONFIG_LINE,SDL-CONFIG:=$(SDL-CONFIG))
|
||||
$(call CONFIG_LINE,LIBPNG-CONFIG:=$(LIBPNG-CONFIG))
|
||||
$(call CONFIG_LINE,SDL_CONFIG:=$(SDL_CONFIG))
|
||||
$(call CONFIG_LINE,LIBPNG_CONFIG:=$(LIBPNG_CONFIG))
|
||||
$(call CONFIG_LINE,BEOS_NET_SERVER:=$(BEOS_NET_SERVER))
|
||||
$(call CONFIG_LINE,CONFIG_INCLUDED:=yes)
|
||||
$(call CONFIG_LINE,PATH_SET:=$(PATH_SET))
|
||||
|
|
|
@ -52,23 +52,26 @@ endif
|
|||
|
||||
# FreeBSD uses sdl11 instead of sdl
|
||||
ifdef FREEBSD
|
||||
SDL-CONFIG:=sdl11-config
|
||||
SDL_CONFIG:=sdl11-config
|
||||
else
|
||||
SDL-CONFIG:=sdl-config
|
||||
SDL_CONFIG:=sdl-config
|
||||
endif
|
||||
|
||||
# set libpng-config to the default value
|
||||
LIBPNG_CONFIG :=libpng-config
|
||||
|
||||
# Networking, enabled by default
|
||||
WITH_NETWORK:=1
|
||||
|
||||
# Library detections
|
||||
WITH_SDL:=$(shell $(SDL-CONFIG) --version 2>/dev/null)
|
||||
WITH_SDL:=$(shell $(SDL_CONFIG) --version 2>/dev/null)
|
||||
|
||||
# libpng detection
|
||||
WITH_PNG:=$(shell $(LIBPNG-CONFIG) --version 2>/dev/null)
|
||||
WITH_PNG:=$(shell $(LIBPNG_CONFIG) --version 2>/dev/null)
|
||||
|
||||
ifdef WITH_PNG
|
||||
# LibPNG depends on Zlib
|
||||
WITH_ZLIB:=1
|
||||
# LibPNG depends on Zlib
|
||||
WITH_ZLIB:=1
|
||||
else
|
||||
# We go looking for zlib with a little hack
|
||||
WITH_ZLIB:=$(shell ls /usr/include | grep "zlib.h" 2>/dev/null) \
|
||||
|
@ -78,6 +81,22 @@ WITH_ZLIB:=1
|
|||
endif
|
||||
endif
|
||||
|
||||
ifdef WITH_ZLIB
|
||||
TEMP:=$(shell ls /lib 2>/dev/null | grep "zlib.a")$(shell ls /lib 2>/dev/null | grep "libz.a")
|
||||
ifdef TEMP
|
||||
STATIC_ZLIB_PATH:=/lib/$(TEMP)
|
||||
else
|
||||
TEMP:=$(shell ls /usr/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/lib 2>/dev/null | grep "libz.a")
|
||||
ifdef TEMP
|
||||
STATIC_ZLIB_PATH:=/usr/lib/$(TEMP)
|
||||
else
|
||||
TEMP:=$(shell ls /usr/local/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/local/lib 2>/dev/null | grep "libz.a")
|
||||
ifdef TEMP
|
||||
STATIC_ZLIB_PATH:=/usr/local/lib/$(TEMP)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# sets the default paths
|
||||
ifdef UNIX
|
||||
|
|
Loading…
Reference in New Issue