build: fix out of tree build in example
The following problems existed:
* The sdbus++ output directory would not exist so invoke mkdir.
* The directory for the example schema is not in . but in $(srcdir),
so use -r directive to sdbus++ to set schema root accordingly.
* The mako template files generated into the build tree, so pass
sdbus++ the template path relative to $(top_builddir).
Change-Id: I76f70ed832c7cf0ce2a7b8a8ec21672ebcea9c02
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/example/Makefile.am b/example/Makefile.am
index ae5cdcb..2cf8941 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -11,11 +11,11 @@
calculator_server_SOURCES = \
calculator-server.cpp $(calculator_server_generated_files)
-calculator_server_CXXFLAGS = $(SYSTEMD_CFLAGS)
+calculator_server_CXXFLAGS = $(SYSTEMD_CFLAGS) -I$(top_srcdir)
calculator_server_LDADD = $(SYSTEMD_LIBS) ../libsdbusplus.la
list_users_SOURCES = list-users.cpp
-list_users_CXXFLAGS = $(SYSTEMD_CFLAGS)
+list_users_CXXFLAGS = $(SYSTEMD_CFLAGS) -I$(top_srcdir)
list_users_LDADD = $(SYSTEMD_LIBS) ../libsdbusplus.la
BUILT_SOURCES = \
@@ -26,23 +26,34 @@
$(calculator_markdown_generated_files)
net/poettering/Calculator/server.hpp:
+ @mkdir -p $(@D)
@top_srcdir@/tools/sdbus++ \
+ -r $(srcdir) -t $(top_builddir)/tools/sdbusplus/templates \
interface server-header net.poettering.Calculator > $@
net/poettering/Calculator/server.cpp:
+ @mkdir -p $(@D)
@top_srcdir@/tools/sdbus++ \
+ -r $(srcdir) -t $(top_builddir)/tools/sdbusplus/templates \
interface server-cpp net.poettering.Calculator > $@
net/poettering/Calculator/error.hpp:
+ @mkdir -p $(@D)
@top_srcdir@/tools/sdbus++ \
+ -r $(srcdir) -t $(top_builddir)/tools/sdbusplus/templates \
error exception-header net.poettering.Calculator > $@
net/poettering/Calculator/error.cpp:
+ @mkdir -p $(@D)
@top_srcdir@/tools/sdbus++ \
+ -r $(srcdir) -t $(top_builddir)/tools/sdbusplus/templates \
error exception-cpp net.poettering.Calculator > $@
calculator.md:
+ @mkdir -p $(@D)
@top_srcdir@/tools/sdbus++ \
+ -r $(srcdir) -t $(top_builddir)/tools/sdbusplus/templates \
interface markdown net.poettering.Calculator > $@
@top_srcdir@/tools/sdbus++ \
+ -r $(srcdir) -t $(top_builddir)/tools/sdbusplus/templates \
error markdown net.poettering.Calculator >> $@