NetworkManager/callouts/Makefile.am
Thomas Haller e0ca2bdb63 build: extract version macros from "nm-version.h" to new header file "nm-version-macros.h"
For libnm library, "nm-dbus-interface.h" contains defines like the D-Bus
paths of NetworkManager. It is desirable to have this header usable without
having a dependency on "glib.h", for example for a QT application. For that,
commit c0852964a8 removed that dependancy.

For libnm-glib library, the analog to "nm-dbus-interface.h" is
"NetworkManager.h", and the same applies there. Commit
159e827a72 removed that include.
However, that broke build on PackageKit [1] which expected to get the
version macros by including "NetworkManager.h". So at least for libnm-glib,
we need to preserve old behavior so that a user including
"NetworkManager.h" gets the version macros, but not "glib.h".

Extract the version macros to a new header file "nm-version-macros.h".
This header doesn't include "glib.h" and can be included from
"NetworkManager.h". This gives as previous behavior and a glib-free
include.

For libnm we still don't include "nm-version-macros.h" to "nm-dbus-interface.h".
Very few users will actually need the version macros, but not using
libnm.
Users that use libnm, should just include (libnm's) "NetworkManager.h" to
get all headers.
As a special case, a user who doesn't want to use glib/libnm, but still
needs both "nm-dbus-interface.h" and "nm-version-macros.h", can include
them both separately.

[1] https://github.com/hughsie/PackageKit/issues/85

Fixes: 4545a7fe96
(cherry picked from commit 7bf10a75db)
2015-09-30 23:35:52 +02:00

116 lines
2.7 KiB
Makefile

SUBDIRS = . tests
AM_CPPFLAGS = \
-I${top_srcdir}/include \
-I${top_builddir}/include \
-I${top_srcdir}/libnm-core \
-I${top_builddir}/libnm-core \
$(GLIB_CFLAGS) \
$(DBUS_CFLAGS) \
-DNETWORKMANAGER_COMPILATION \
-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
-DNMCONFDIR=\"$(nmconfdir)\" \
-DSYSCONFDIR=\"$(sysconfdir)\" \
-DLIBEXECDIR=\"$(libexecdir)\"
###########################################
# Test libraries
###########################################
noinst_LTLIBRARIES = \
libtest-dispatcher-envp.la
dbusservicedir = $(DBUS_SYS_DIR)
dbusservice_DATA = \
nm-dispatcher.conf \
nm-avahi-autoipd.conf
libexec_PROGRAMS = \
nm-dispatcher \
nm-avahi-autoipd.action
nm_avahi_autoipd_action_SOURCES = \
nm-avahi-autoipd-action.c
nm_avahi_autoipd_action_LDADD = \
$(DBUS_LIBS) \
$(GLIB_LIBS)
nm_dispatcher_SOURCES = \
nm-dispatcher.c \
nm-dispatcher-api.h \
nm-dispatcher-utils.c \
nm-dispatcher-utils.h
nm_dispatcher_LDADD = \
$(top_builddir)/libnm/libnm.la \
libnmdbus-dispatcher.la \
$(GLIB_LIBS)
# See note about gdbus-codegen in introspection/Makefile.am
noinst_LTLIBRARIES += libnmdbus-dispatcher.la
nodist_libnmdbus_dispatcher_la_SOURCES = \
nmdbus-dispatcher.c \
nmdbus-dispatcher.h
libnmdbus_dispatcher_la_CPPFLAGS = $(filter-out -DGLIB_VERSION_MAX_ALLOWED%,$(AM_CPPFLAGS))
nmdbus-dispatcher.h: nm-dispatcher.xml
$(AM_V_GEN) gdbus-codegen \
--generate-c-code $(basename $@) \
--c-namespace NMDBus \
--interface-prefix org.freedesktop \
$<
nmdbus-dispatcher.c: nmdbus-dispatcher.h
@true
BUILT_SOURCES = nmdbus-dispatcher.h nmdbus-dispatcher.c
###########################################
# dispatcher envp
###########################################
libtest_dispatcher_envp_la_SOURCES = \
nm-dispatcher-utils.c \
nm-dispatcher-utils.h
libtest_dispatcher_envp_la_CPPFLAGS = \
$(AM_CPPFLAGS)
libtest_dispatcher_envp_la_LIBADD = \
$(top_builddir)/libnm/libnm.la \
$(GLIB_LIBS)
dbusactivationdir = $(datadir)/dbus-1/system-services
dbusactivation_in_files = org.freedesktop.nm_dispatcher.service.in
dbusactivation_DATA = $(dbusactivation_in_files:.service.in=.service)
%.service: %.service.in
$(edit) $< >$@
edit = @sed \
-e 's|@sbindir[@]|$(sbindir)|g' \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@localstatedir[@]|$(localstatedir)|g' \
-e 's|@libexecdir[@]|$(libexecdir)|g'
dispatcherdir=$(sysconfdir)/NetworkManager/dispatcher.d
install-data-hook:
$(mkinstalldirs) -m 0755 $(DESTDIR)$(dispatcherdir)
$(mkinstalldirs) -m 0755 $(DESTDIR)$(dispatcherdir)/pre-down.d
$(mkinstalldirs) -m 0755 $(DESTDIR)$(dispatcherdir)/pre-up.d
CLEANFILES = $(nodist_libnmdbus_dispatcher_la_SOURCES) $(dbusactivation_DATA)
EXTRA_DIST = \
$(dbusservice_DATA) \
$(dbusactivation_in_files) \
nm-dispatcher.xml