## Makefile.am fragment sourced by src/Makefile.am.

if WITH_DBUS

#############################
# Sources for DBus interface
#############################

ink_common_sources +=	\
	extension/dbus/dbus-init.cpp  \
	extension/dbus/dbus-init.h  \
	extension/dbus/application-interface.cpp  \
	extension/dbus/application-interface.h  \
	extension/dbus/document-interface.cpp  \
	extension/dbus/document-interface.h  \
	extension/dbus/org.inkscape.service.in

###########################
# Build DBus wrapper files
###########################

extension/dbus/application-server-glue.h: extension/dbus/application-interface.xml
	dbus-binding-tool --mode=glib-server --output=$@ --prefix=application_interface $^

extension/dbus/document-server-glue.h: extension/dbus/document-interface.xml
	dbus-binding-tool --mode=glib-server --output=$@ --prefix=document_interface $^

extension/dbus/document-client-glue.h: extension/dbus/document-interface.xml
	dbus-binding-tool --mode=glib-client --output=$@ --prefix=document_interface $^

BUILT_SOURCES += \
	extension/dbus/application-server-glue.h   \
	extension/dbus/document-server-glue.h   \
	extension/dbus/document-client-glue.h

###########################
# Distribut DBus interface
###########################

EXTRA_DIST += \
	extension/dbus/application-interface.xml \
	extension/dbus/document-interface.xml

###########################
# DBus Activation Service
###########################

# Dbus service file
servicedir = $(DBUSSERVICEDIR)
service_in_files = extension/dbus/org.inkscape.service.in
service_DATA = $(service_in_files:.service.in=.service)

# Rule to make the service file with bindir expanded
$(service_DATA): $(service_in_files) Makefile
	@sed -e "s|bindir|$(prefix)|" $<> $@

############################
# DBus Interface Helper Lib
############################

lib_LTLIBRARIES = \
	libinkdbus.la

libinkdbusincludedir = $(includedir)/libinkdbus-0.48/libinkdbus
libinkdbusinclude_HEADERS = \
	extension/dbus/wrapper/inkscape-dbus-wrapper.h

libinkdbus_la_SOURCES = \
	extension/dbus/wrapper/inkscape-dbus-wrapper.h \
	extension/dbus/wrapper/inkscape-dbus-wrapper.c

libinkdbus_la_LDFLAGS = \
	-version-info 0:0:0 \
	-no-undefined \
	-export-symbols-regex "^[^_d].*"

libinkdbus_la_CFLAGS = \
	$(DBUS_CFLAGS) \
	$(INKSCAPE_CFLAGS) \
	-I$(builddir)/extension/dbus \
	-Wall

libinkdbus_la_LIBADD = \
	$(DBUS_LIBS) \
	$(INKSCAPE_LIBS)

############################
# DBus Pkgconfig file
############################

pkgconfig_DATA = extension/dbus/wrapper/inkdbus.pc
pkgconfigdir = $(libdir)/pkgconfig

else # WITH_DBUS

EXTRA_DIST += \
	extension/dbus/dbus-init.cpp  \
	extension/dbus/dbus-init.h  \
	extension/dbus/application-interface.cpp  \
	extension/dbus/application-interface.h  \
	extension/dbus/document-interface.cpp  \
	extension/dbus/document-interface.h \
	extension/dbus/wrapper/inkscape-dbus-wrapper.h \
	extension/dbus/wrapper/inkscape-dbus-wrapper.c \
	extension/dbus/wrapper/inkdbus.pc \
	extension/dbus/org.inkscape.service.in \
	extension/dbus/application-interface.xml \
	extension/dbus/document-interface.xml

endif

