comparison 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
comparison
equal deleted inserted replaced
51:f27122a7bb02 52:707e9e3deeac
46 INSTALL.data := $(INSTALL) -D -m 0644 46 INSTALL.data := $(INSTALL) -D -m 0644
47 INSTALL.link := $(CP) -f -P 47 INSTALL.link := $(CP) -f -P
48 PAX := pax 48 PAX := pax
49 GZIP := gzip 49 GZIP := gzip
50 SED := sed 50 SED := sed
51 GLIB_COMPILE_SCHEMAS := $(shell pkg-config --variable=glib_compile_schemas gio-2.0) 51 PKG_CONFIG := pkg-config
52 GLIB_COMPILE_RESOURCES := $(shell pkg-config --variable=glib_compile_resources gio-2.0) 52 GLIB_COMPILE_SCHEMAS := $(shell $(PKG_CONFIG) --variable=glib_compile_schemas gio-2.0)
53 GLIB_MKENUMS := $(shell pkg-config --variable=glib_mkenums glib-2.0) 53 GLIB_COMPILE_RESOURCES := $(shell $(PKG_CONFIG) --variable=glib_compile_resources gio-2.0)
54 GLIB_MKENUMS := $(shell $(PKG_CONFIG) --variable=glib_mkenums glib-2.0)
54 XSLTPROC := xsltproc 55 XSLTPROC := xsltproc
55 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl 56 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
56 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \ 57 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
57 --stringparam man.copyright.section.enabled 0 58 --stringparam man.copyright.section.enabled 0
58 MSGFMT = msgfmt 59 MSGFMT = msgfmt
69 --keyword=C_:1c,2 \ 70 --keyword=C_:1c,2 \
70 --keyword=NC_:1c,2 \ 71 --keyword=NC_:1c,2 \
71 --keyword=g_dngettext:2,3 \ 72 --keyword=g_dngettext:2,3 \
72 --add-comments 73 --add-comments
73 INDICATOR_LIB := $(or \ 74 INDICATOR_LIB := $(or \
74 $(shell pkg-config --exists appindicator3-0.1 && \ 75 $(shell $(PKG_CONFIG) --exists appindicator3-0.1 && \
75 printf '%s\\\n' appindicator3-0.1), \ 76 printf '%s\\\n' appindicator3-0.1), \
76 $(shell pkg-config --exists ayatana-appindicator3-0.1 && \ 77 $(shell $(PKG_CONFIG) --exists ayatana-appindicator3-0.1 && \
77 printf '%s\\\n' ayatana-appindicator3-0.1), \ 78 printf '%s\\\n' ayatana-appindicator3-0.1), \
78 appindicator3-0.1) 79 appindicator3-0.1)
79 INDICATOR_FLAG := $(if $(findstring ayatana,$(INDICATOR_LIB)), \ 80 INDICATOR_FLAG := $(if $(findstring ayatana,$(INDICATOR_LIB)), \
80 -DHAVE_AYATANA_APPINDICATOR,) 81 -DHAVE_AYATANA_APPINDICATOR,)
81 82
158 -DPACKAGE_LOCALE_DIR="\"$(localedir)\"" \ 159 -DPACKAGE_LOCALE_DIR="\"$(localedir)\"" \
159 -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \ 160 -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
160 -DSETTINGS_SCHEMA_ID=\"$(APPLICATION_ID)\" \ 161 -DSETTINGS_SCHEMA_ID=\"$(APPLICATION_ID)\" \
161 -DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \ 162 -DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \
162 $(INDICATOR_FLAG) 163 $(INDICATOR_FLAG)
163 $(PACKAGE): XCFLAGS = $(shell pkg-config --cflags gtk+-3.0 \ 164 $(PACKAGE): XCFLAGS = $(shell $(PKG_CONFIG) --cflags gtk+-3.0 \
164 $(INDICATOR_LIB) packagekit-glib2 \ 165 $(INDICATOR_LIB) packagekit-glib2 \
165 polkit-gobject-1 upower-glib) 166 polkit-gobject-1 upower-glib)
166 $(PACKAGE): LDLIBS = $(shell pkg-config --libs gtk+-3.0 \ 167 $(PACKAGE): LDLIBS = $(shell $(PKG_CONFIG) --libs gtk+-3.0 \
167 $(INDICATOR_LIB) packagekit-glib2 \ 168 $(INDICATOR_LIB) packagekit-glib2 \
168 polkit-gobject-1 upower-glib) 169 polkit-gobject-1 upower-glib)
169 170
170 $(PACKAGE)-prefs: XCPPFLAGS = -DPACKAGE=\"$(PACKAGE)\" \ 171 $(PACKAGE)-prefs: XCPPFLAGS = -DPACKAGE=\"$(PACKAGE)\" \
171 -DAPPLICATION_ID=\"$(PREFS_APPLICATION_ID)\" \ 172 -DAPPLICATION_ID=\"$(PREFS_APPLICATION_ID)\" \
172 -DVERSION=\"$(VERSION)\" \ 173 -DVERSION=\"$(VERSION)\" \
173 -DG_LOG_DOMAIN=\"$(PACKAGE)\" \ 174 -DG_LOG_DOMAIN=\"$(PACKAGE)\" \
174 -DPACKAGE_LOCALE_DIR="\"$(localedir)\"" \ 175 -DPACKAGE_LOCALE_DIR="\"$(localedir)\"" \
175 -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \ 176 -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
176 -DSETTINGS_SCHEMA_ID=\"$(APPLICATION_ID)\" 177 -DSETTINGS_SCHEMA_ID=\"$(APPLICATION_ID)\"
177 $(PACKAGE)-prefs: XCFLAGS = $(shell pkg-config --cflags gtk+-3.0) 178 $(PACKAGE)-prefs: XCFLAGS = $(shell $(PKG_CONFIG) --cflags gtk+-3.0)
178 $(PACKAGE)-prefs: LDLIBS = $(shell pkg-config --libs gtk+-3.0) 179 $(PACKAGE)-prefs: LDLIBS = $(shell $(PKG_CONFIG) --libs gtk+-3.0)
179 180
180 ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly OpenBSD),) 181 ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly OpenBSD),)
181 $(PACKAGE): XCPPFLAGS += -I/usr/local/include 182 $(PACKAGE): XCPPFLAGS += -I/usr/local/include
182 $(PACKAGE): XLDFLAGS += -L/usr/local/lib 183 $(PACKAGE): XLDFLAGS += -L/usr/local/lib
183 else ifeq ($(OS_NAME),NetBSD) 184 else ifeq ($(OS_NAME),NetBSD)