From 608347c84d94052311992ed6eca8163f19043c7a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 19 May 2013 20:52:23 +0100 Subject: [PATCH] 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. --- Makefile | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index b4d9be64..9d8d0f26 100644 --- a/Makefile +++ b/Makefile @@ -271,7 +271,6 @@ ifneq ($(BUILD_CLIENT),0) OPENAL_LIBS=$(shell pkg-config --silence-errors --libs openal) SDL_CFLAGS=$(shell pkg-config --silence-errors --cflags sdl|sed 's/-Dmain=SDL_main//') SDL_LIBS=$(shell pkg-config --silence-errors --libs sdl) - FREETYPE_CFLAGS=$(shell pkg-config --silence-errors --cflags freetype2) endif # Use sdl-config if all else fails ifeq ($(SDL_CFLAGS),) @@ -385,10 +384,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 @@ -466,10 +461,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) @@ -584,7 +575,7 @@ ifeq ($(PLATFORM),mingw32) RENDERER_LIBS = -lgdi32 -lole32 -lopengl32 ifeq ($(USE_FREETYPE),1) - BASE_CFLAGS += -Ifreetype2 + FREETYPE_CFLAGS = -Ifreetype2 endif ifeq ($(USE_CURL),1) @@ -913,10 +904,6 @@ endif TARGETS = -ifeq ($(USE_FREETYPE),1) - BASE_CFLAGS += -DBUILD_FREETYPE -endif - ifndef FULLBINEXT FULLBINEXT=.$(ARCH)$(BINEXT) endif @@ -1048,7 +1035,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++"))