diff options
author | Simon McVittie <smcv@debian.org> | 2013-05-19 20:52:23 +0100 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2014-08-28 11:02:36 +0100 |
commit | d71cebdc958799094a244f2893f8ef0ef3a54ca8 (patch) | |
tree | 12b12e220569dafe667861003c4ee224106d451d | |
parent | edadac4cf9ebb7735e8bd1173f8b3bb4d18a1889 (diff) |
Centralize checks for Freetype, with a user override
This lets us find a library in a non-standard library directory
(via -L in the pkg-config metadata), and allows overrides similar to
the Autoconf convention, e.g.
make FREETYPE_CFLAGS=-I/opt/freetype/include \
FREETYPE_LIBS="-L/opt/freetype/lib -lfreetype"
If pkg-config didn't work, assume that Freetype is in the default
location.
-rw-r--r-- | Makefile | 25 |
1 files changed, 8 insertions, 17 deletions
@@ -262,9 +262,8 @@ ifneq ($(BUILD_CLIENT),0) CURL_LIBS=$(shell pkg-config --silence-errors --libs libcurl) OPENAL_CFLAGS=$(shell pkg-config --silence-errors --cflags openal) OPENAL_LIBS=$(shell pkg-config --silence-errors --libs openal) - SDL_CFLAGS=$(shell pkg-config --silence-errors --cflags sdl2|sed 's/-Dmain=SDL_main//') - SDL_LIBS=$(shell pkg-config --silence-errors --libs sdl2) - FREETYPE_CFLAGS=$(shell pkg-config --silence-errors --cflags freetype2) + SDL_CFLAGS=$(shell pkg-config --silence-errors --cflags sdl|sed 's/-Dmain=SDL_main//') + SDL_LIBS=$(shell pkg-config --silence-errors --libs sdl) endif # Use sdl-config if all else fails ifeq ($(SDL_CFLAGS),) @@ -376,10 +375,6 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu")) CLIENT_LIBS += -lrt endif - ifeq ($(USE_FREETYPE),1) - BASE_CFLAGS += $(FREETYPE_CFLAGS) - endif - ifeq ($(ARCH),x86) # linux32 make ... BASE_CFLAGS += -m32 @@ -457,10 +452,6 @@ ifeq ($(PLATFORM),darwin) endif endif - ifeq ($(USE_FREETYPE),1) - BASE_CFLAGS += $(FREETYPE_CFLAGS) - endif - BASE_CFLAGS += -D_THREAD_SAFE=1 ifeq ($(USE_LOCAL_HEADERS),1) @@ -576,7 +567,7 @@ ifeq ($(PLATFORM),mingw32) RENDERER_LIBS = -lgdi32 -lole32 -lopengl32 ifeq ($(USE_FREETYPE),1) - BASE_CFLAGS += -Ifreetype2 + FREETYPE_CFLAGS = -Ifreetype2 endif ifeq ($(USE_CURL),1) @@ -902,10 +893,6 @@ endif TARGETS = -ifeq ($(USE_FREETYPE),1) - BASE_CFLAGS += -DBUILD_FREETYPE -endif - ifndef FULLBINEXT FULLBINEXT=.$(ARCH)$(BINEXT) endif @@ -1029,7 +1016,11 @@ else endif ifeq ($(USE_FREETYPE),1) - RENDERER_LIBS += -lfreetype + FREETYPE_CFLAGS ?= $(shell pkg-config --silence-errors --cflags freetype2 || true) + FREETYPE_LIBS ?= $(shell pkg-config --silence-errors --libs freetype2 || echo -lfreetype) + + BASE_CFLAGS += -DBUILD_FREETYPE $(FREETYPE_CFLAGS) + RENDERER_LIBS += $(FREETYPE_LIBS) endif ifeq ("$(CC)", $(findstring "$(CC)", "clang" "clang++")) |