From 6ac65840c0f3ec86aaddf914bd59f79d62ce4200 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Thu, 11 Nov 2010 17:13:34 +0100 Subject: [PATCH] BuildSystem: pkg-config optional --- BSDmakefile | 13 +++++++++---- Makefile | 18 +++++++++++++----- config.mk | 11 +++++++++++ 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/BSDmakefile b/BSDmakefile index 6b17ea0..99cfb82 100644 --- a/BSDmakefile +++ b/BSDmakefile @@ -10,11 +10,16 @@ CFLAGS+= -DHAVE_${lib:U} .endif .endfor -CFLAGS_LIB!= pkg-config --cflags-only-I ${LIBS} -LDFLAGS_LIB!= pkg-config --libs ${LIBS} +.if !defined(CFLAGS_LIBS) +CFLAGS_LIBS!= pkg-config --cflags-only-I ${LIBS} +.endif -CFLAGS+= ${CFLAGS_LIB} -LDADD+= ${LDFLAGS_LIB} -lpthread +.if !defined(LDFLAGS_LIBS) +LDFLAGS_LIBS!= pkg-config --libs ${LIBS} +.endif + +CFLAGS+= ${CFLAGS_LIBS} +LDADD+= ${LDFLAGS_LIBS} -lpthread install: all @echo installing executable file to ${DESTDIR}${PREFIX}/bin diff --git a/Makefile b/Makefile index 057b563..c3086c4 100644 --- a/Makefile +++ b/Makefile @@ -4,19 +4,27 @@ include common.mk OBJ = ${patsubst %.c,${O}/%.o,${SRCS}} ifneq ($(findstring xrandr, ${LIBS}),) - CFLAGS+= -DHAVE_XRANDR +CFLAGS+= -DHAVE_XRANDR endif ifneq ($(findstring xinerama, ${LIBS}),) - CFLAGS+= -DHAVE_XINERAMA +CFLAGS+= -DHAVE_XINERAMA endif ifneq ($(findstring imlib2, ${LIBS}),) - CFLAGS+= -DHAVE_IMLIB2 +CFLAGS+= -DHAVE_IMLIB2 endif -CFLAGS+= $(shell pkg-config --cflags-only-I ${LIBS}) -LDFLAGS+= $(shell pkg-config --libs ${LIBS}) -lpthread +ifndef CFLAGS_LIBS +CFLAGS_LIBS= $(shell pkg-config --cflags-only-I ${LIBS}) +endif + +ifndef LDFLAGS_LIBS +LDFLAGS_LIBS= $(shell pkg-config --libs ${LIBS}) +endif + +CFLAGS+= ${CFLAGS_LIBS} +LDFLAGS+= ${LDFLAGS_LIBS} -lpthread all: options ${O}/wmfs ${O}/wmfs.1.gz diff --git a/config.mk b/config.mk index 4ccc8d1..c72f8e7 100644 --- a/config.mk +++ b/config.mk @@ -5,6 +5,17 @@ VERSION= 201011 # x11 xft and freetype2 are REQUIRED, others are optionals LIBS= x11 xft freetype2 xrandr xinerama imlib2 + +# If theses variables are defined, make will not call pkg-config +# +# Linux example +# CFLAGS_LIBS= -I/usr/include/freetype2 +# LDFLAGS_LIBS= -lX11 -lXft -lfreetype -lXrandr -lXinerama -lImlib2 +# +# FreeBSD example +# CFLAGS_LIBS= -I/usr/local/include -I/usr/local/include/freetype2 +# LDFLAGS_LIBS= -L/usr/local/lib -lXft -lXrender -lfontconfig -lX11 -lfreetype -lXrandr -lXinerama -lImlib2 + # paths PREFIX= /usr/local MANPREFIX= ${PREFIX}/share/man