diff Makefile @ 52:707e9e3deeac

Do not hardcode pkg-config Using a macro allows passing a different executable in case of cross-compilation.
author Helmut Grohne <helmut@subdivi.de>
date Sat, 12 Dec 2020 01:08:21 -0500
parents 0d4bb2f8908a
children e3fc9db49d36
line wrap: on
line diff
--- a/Makefile	Thu Dec 03 08:51:48 2020 +0100
+++ b/Makefile	Sat Dec 12 01:08:21 2020 -0500
@@ -48,9 +48,10 @@
 PAX :=		pax
 GZIP :=		gzip
 SED :=		sed
-GLIB_COMPILE_SCHEMAS := $(shell pkg-config --variable=glib_compile_schemas gio-2.0)
-GLIB_COMPILE_RESOURCES := $(shell pkg-config --variable=glib_compile_resources gio-2.0)
-GLIB_MKENUMS :=	$(shell pkg-config --variable=glib_mkenums glib-2.0)
+PKG_CONFIG :=	pkg-config
+GLIB_COMPILE_SCHEMAS := $(shell $(PKG_CONFIG) --variable=glib_compile_schemas gio-2.0)
+GLIB_COMPILE_RESOURCES := $(shell $(PKG_CONFIG) --variable=glib_compile_resources gio-2.0)
+GLIB_MKENUMS :=	$(shell $(PKG_CONFIG) --variable=glib_mkenums glib-2.0)
 XSLTPROC :=	xsltproc
 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
@@ -71,9 +72,9 @@
 		--keyword=g_dngettext:2,3 \
 		--add-comments
 INDICATOR_LIB := $(or \
-		    $(shell pkg-config --exists appindicator3-0.1 && \
+		    $(shell $(PKG_CONFIG) --exists appindicator3-0.1 && \
 		        printf '%s\\\n' appindicator3-0.1), \
-		    $(shell pkg-config --exists ayatana-appindicator3-0.1 && \
+		    $(shell $(PKG_CONFIG) --exists ayatana-appindicator3-0.1 && \
 		        printf '%s\\\n' ayatana-appindicator3-0.1), \
 		    appindicator3-0.1)
 INDICATOR_FLAG := $(if $(findstring ayatana,$(INDICATOR_LIB)), \
@@ -160,10 +161,10 @@
 			-DSETTINGS_SCHEMA_ID=\"$(APPLICATION_ID)\" \
 			-DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \
 			$(INDICATOR_FLAG)
-$(PACKAGE): XCFLAGS =	$(shell pkg-config --cflags gtk+-3.0 \
+$(PACKAGE): XCFLAGS =	$(shell $(PKG_CONFIG) --cflags gtk+-3.0 \
 			    $(INDICATOR_LIB) packagekit-glib2 \
 			    polkit-gobject-1 upower-glib)
-$(PACKAGE): LDLIBS =	$(shell pkg-config --libs gtk+-3.0 \
+$(PACKAGE): LDLIBS =	$(shell $(PKG_CONFIG) --libs gtk+-3.0 \
 			    $(INDICATOR_LIB) packagekit-glib2 \
 			    polkit-gobject-1 upower-glib)
 
@@ -174,8 +175,8 @@
 			-DPACKAGE_LOCALE_DIR="\"$(localedir)\"" \
 			-DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
 			-DSETTINGS_SCHEMA_ID=\"$(APPLICATION_ID)\"
-$(PACKAGE)-prefs: XCFLAGS = $(shell pkg-config --cflags gtk+-3.0)
-$(PACKAGE)-prefs: LDLIBS = $(shell pkg-config --libs gtk+-3.0)
+$(PACKAGE)-prefs: XCFLAGS = $(shell $(PKG_CONFIG) --cflags gtk+-3.0)
+$(PACKAGE)-prefs: LDLIBS = $(shell $(PKG_CONFIG) --libs gtk+-3.0)
 
 ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly OpenBSD),)
   $(PACKAGE): XCPPFLAGS +=	-I/usr/local/include