aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Makefile
diff options
authorAaro Koskinen <aaro.koskinen@nsn.com>2014-11-07 14:44:47 +0200
committerChristopher Li <sparse@chrisli.org>2014-11-10 11:59:36 +0800
commit5556d1b618418c7c42d35458200c213756066b71 (patch)
treef5ee29bcb2a3c4e05d343e0b13798220d3392a0a /Makefile
parent78f9e8faafed4a5ec7e3141360a0dc01910656e4 (diff)
downloadsparse-dev-5556d1b618418c7c42d35458200c213756066b71.tar.gz
build: allow use of PKG_CONFIG to override pkg-config
Allow overriding pkg-config e.g. when cross-compiling. Signed-off-by: Aaro Koskinen <aaro.koskinen@nsn.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 7 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 3f3c71a9..c7031afd 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,7 @@ CFLAGS += -Wall -Wwrite-strings
LDFLAGS += -g
LD = gcc
AR = ar
+PKG_CONFIG = pkg-config
ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS)
#
@@ -25,11 +26,11 @@ ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS)
# CFLAGS += -O0 -DDEBUG -g3 -gdwarf-2
#
-HAVE_LIBXML:=$(shell pkg-config --exists libxml-2.0 2>/dev/null && echo 'yes')
+HAVE_LIBXML:=$(shell $(PKG_CONFIG) --exists libxml-2.0 2>/dev/null && echo 'yes')
HAVE_GCC_DEP:=$(shell touch .gcc-test.c && \
$(CC) -c -Wp,-MD,.gcc-test.d .gcc-test.c 2>/dev/null && \
echo 'yes'; rm -f .gcc-test.d .gcc-test.o .gcc-test.c)
-HAVE_GTK2:=$(shell pkg-config --exists gtk+-2.0 2>/dev/null && echo 'yes')
+HAVE_GTK2:=$(shell $(PKG_CONFIG) --exists gtk+-2.0 2>/dev/null && echo 'yes')
LLVM_CONFIG:=llvm-config
HAVE_LLVM:=$(shell $(LLVM_CONFIG) --version >/dev/null 2>&1 && echo 'yes')
@@ -60,14 +61,14 @@ INST_MAN1=sparse.1 cgcc.1
ifeq ($(HAVE_LIBXML),yes)
PROGRAMS+=c2xml
INST_PROGRAMS+=c2xml
-c2xml_EXTRA_OBJS = `pkg-config --libs libxml-2.0`
+c2xml_EXTRA_OBJS = `$(PKG_CONFIG) --libs libxml-2.0`
else
$(warning Your system does not have libxml, disabling c2xml)
endif
ifeq ($(HAVE_GTK2),yes)
-GTK2_CFLAGS := $(shell pkg-config --cflags gtk+-2.0)
-GTK2_LIBS := $(shell pkg-config --libs gtk+-2.0)
+GTK2_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk+-2.0)
+GTK2_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0)
PROGRAMS += test-inspect
INST_PROGRAMS += test-inspect
test-inspect_EXTRA_DEPS := ast-model.o ast-view.o ast-inspect.o
@@ -187,7 +188,7 @@ DEP_FILES := $(wildcard .*.o.d)
$(if $(DEP_FILES),$(eval include $(DEP_FILES)))
c2xml.o: c2xml.c $(LIB_H)
- $(QUIET_CC)$(CC) `pkg-config --cflags libxml-2.0` -o $@ -c $(ALL_CFLAGS) $<
+ $(QUIET_CC)$(CC) `$(PKG_CONFIG) --cflags libxml-2.0` -o $@ -c $(ALL_CFLAGS) $<
compat-linux.o: compat/strtold.c compat/mmap-blob.c $(LIB_H)
compat-solaris.o: compat/mmap-blob.c $(LIB_H)