Fix: CMake examples integration
[deliverable/lttng-ust.git] / doc / examples / Makefile.am
CommitLineData
a106a9f8 1doc_examplesdir = ${docdir}/examples
7ccf75d3
MD
2doc_examples_easy_ustdir = ${docdir}/examples/easy-ust
3doc_examples_gen_tpdir = ${docdir}/examples/gen-tp
60302adc 4doc_examples_demodir = ${docdir}/examples/demo
a106a9f8 5doc_examples_hello_static_libdir = ${docdir}/examples/hello-static-lib
af9f5e3c 6doc_examples_demo_tracefdir = ${docdir}/examples/demo-tracef
eb8246a0 7doc_examples_demo_tracelogdir = ${docdir}/examples/demo-tracelog
f9364363 8doc_examples_clock_overridedir = ${docdir}/examples/clock-override
5e1b7b8b 9doc_examples_getcpu_overridedir = ${docdir}/examples/getcpu-override
5f836e39 10doc_examples_cmakedir = ${docdir}/examples/cmake-multiple-shared-libraries
a106a9f8 11
be347eb9 12if BUILD_JAVA_AGENT_WITH_JUL
849202d4
DG
13doc_examples_java_juldir = ${docdir}/examples/java-jul
14dist_doc_examples_java_jul_DATA = java-jul/Makefile \
501f6777 15 java-jul/Hello.java \
7b250cea 16 java-jul/run \
cf6634ba 17 java-jul/ApplicationContextExample.java \
7b250cea
MD
18 java-jul/FilterChangeListenerExample.java \
19 java-jul/README
849202d4 20SUBDIRS_JUL = java-jul
849202d4
DG
21endif
22
be347eb9
MJ
23if BUILD_JAVA_AGENT_WITH_LOG4J
24doc_examples_java_log4jdir = ${docdir}/examples/java-log4j
25dist_doc_examples_java_log4j_DATA = java-log4j/Makefile \
26 java-log4j/Hello.java \
27 java-log4j/run
28SUBDIRS_LOG4J = java-log4j
29endif
30
37258731
PP
31if BUILD_PYTHON_AGENT
32doc_examples_pythondir = ${docdir}/examples/python
33dist_doc_examples_python_DATA = python/hello.py
34endif
35
5f836e39 36if HAVE_CMAKE
ebb9f8ff 37if CXX_WORKS
5f836e39
SB
38SUBDIRS_CMAKE = cmake-multiple-shared-libraries
39endif
40endif
41
a106a9f8 42dist_doc_examples_DATA = README
7ccf75d3
MD
43
44dist_doc_examples_easy_ust_DATA = easy-ust/Makefile \
45 easy-ust/sample.c \
46 easy-ust/sample_component_provider.h easy-ust/tp.c
47
5f836e39
SB
48dist_doc_examples_cmake_DATA = \
49 cmake-multiple-shared-libraries/CMakeLists.txt \
50 cmake-multiple-shared-libraries/cmake/FindLTTngUST.cmake \
51 cmake-multiple-shared-libraries/aligner.cpp \
52 cmake-multiple-shared-libraries/aligner-lib.cpp \
53 cmake-multiple-shared-libraries/aligner-lib.h \
54 cmake-multiple-shared-libraries/README.md \
55 cmake-multiple-shared-libraries/tester.cpp \
56 cmake-multiple-shared-libraries/tester-lib.cpp \
57 cmake-multiple-shared-libraries/tester-lib.h \
58 cmake-multiple-shared-libraries/tracepoint-provider.cpp \
59 cmake-multiple-shared-libraries/tracepoint-provider.h \
60 cmake-multiple-shared-libraries/trace.sh
61
7ccf75d3
MD
62dist_doc_examples_gen_tp_DATA = gen-tp/Makefile \
63 gen-tp/sample.c gen-tp/sample_tracepoint.tp
60302adc
JG
64
65dist_doc_examples_demo_DATA = demo/demo.c \
66 demo/demo-trace \
67 demo/Makefile \
68 demo/README \
69 demo/tp2.c \
70 demo/tp3.c \
71 demo/tp.c \
72 demo/ust_tests_demo2.h \
73 demo/ust_tests_demo3.h \
74 demo/ust_tests_demo.h
a106a9f8
JG
75
76dist_doc_examples_hello_static_lib_DATA = hello-static-lib/Makefile \
77 hello-static-lib/hello.c \
78 hello-static-lib/README \
79 hello-static-lib/ust_tests_hello.h \
80 hello-static-lib/tp.c
81
af9f5e3c
MD
82dist_doc_examples_demo_tracef_DATA = demo-tracef/Makefile \
83 demo-tracef/demo-tracef.c \
84 demo-tracef/README
85
eb8246a0
MD
86dist_doc_examples_demo_tracelog_DATA = demo-tracelog/Makefile \
87 demo-tracelog/demo-tracelog.c \
88 demo-tracelog/README
89
f9364363
MD
90dist_doc_examples_clock_override_DATA = clock-override/Makefile \
91 clock-override/lttng-ust-clock-override-example.c \
92 clock-override/run-clock-override \
93 clock-override/README
94
5e1b7b8b
MD
95dist_doc_examples_getcpu_override_DATA = getcpu-override/Makefile \
96 getcpu-override/lttng-ust-getcpu-override-example.c \
97 getcpu-override/run-getcpu-override \
98 getcpu-override/README
99
92414a62
MD
100if NO_SHARED
101# Don't build examples if shared libraries support was explicitly
102# disabled.
103else
104# Copies are for VPATH build support
5e1b7b8b 105SUBDIRS_PROXY = easy-ust demo hello-static-lib demo-tracef clock-override \
eb8246a0 106 getcpu-override demo-tracelog
2b90f1d3
JG
107
108if BUILD_GEN_TP_EXAMPLES
109SUBDIRS_PROXY += gen-tp
110endif
92414a62
MD
111
112all-local:
113 @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
5f836e39 114 for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL) $(SUBDIRS_LOG4J) $(SUBDIRS_CMAKE); do \
a41cceb9 115 cp -pfR $(srcdir)/$$subdir $(builddir); \
c8ab8d34 116 chmod -R u+w $(builddir)/$$subdir; \
92414a62 117 done; \
0faf99b8
MD
118 fi; \
119 if [ x"$(shell echo "$(top_srcdir)" | grep "^/" | wc -l)" = x"1" ]; then \
120 echo "Examples: absolute top_srcdir path $(top_srcdir)"; \
121 rel_src_subdir=""; \
122 else \
123 echo "Examples: relative top_srcdir path $(top_srcdir)"; \
124 rel_src_subdir="../"; \
125 fi; \
126 if [ x"$(shell echo "$(top_builddir)" | grep "^/" | wc -l)" = x"1" ]; then \
127 echo "Examples: absolute top_builddir path $(top_builddir)"; \
128 rel_build_subdir=""; \
129 else \
130 echo "Examples: relative top_builddir path $(top_builddir)"; \
131 rel_build_subdir="../"; \
132 fi; \
92414a62 133 for subdir in $(SUBDIRS_PROXY); do \
4de5e077 134 (cd $$subdir && $(MAKE) AM_CC="$(CC)" AM_CPPFLAGS="$(CPPFLAGS) -I$$rel_src_subdir$(top_srcdir)/include/ -I$$rel_build_subdir$(top_builddir)/include/" AM_CFLAGS='$(CFLAGS)' AM_LDFLAGS='$(LDFLAGS) -L../../../liblttng-ust/.libs -Wl,-rpath="$(PWD)/../../liblttng-ust/.libs/" -Wl,-rpath-link="$(PWD)/../../liblttng-ust/.libs/"' LTTNG_GEN_TP_PATH="../../../tools/" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
0faf99b8
MD
135 done; \
136 if [ x"$(SUBDIRS_JUL)" != x"" ]; then \
849202d4 137 for subdir in $(SUBDIRS_JUL); do \
e5b701c8 138 (cd $$subdir && $(MAKE) JAVA_CLASSPATH_OVERRIDE_JUL="../../../liblttng-ust-java-agent/java/lttng-ust-agent-jul" JAVA_CLASSPATH_OVERRIDE_COMMON="../../../liblttng-ust-java-agent/java/lttng-ust-agent-common" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
849202d4 139 done; \
be347eb9
MJ
140 fi; \
141 if [ x"$(SUBDIRS_LOG4J)" != x"" ]; then \
142 for subdir in $(SUBDIRS_LOG4J); do \
e5b701c8 143 (cd $$subdir && $(MAKE) JAVA_CLASSPATH_OVERRIDE_LOG4J="../../../liblttng-ust-java-agent/java/lttng-ust-agent-log4j" JAVA_CLASSPATH_OVERRIDE_COMMON="../../../liblttng-ust-java-agent/java/lttng-ust-agent-common" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
be347eb9 144 done; \
e5b701c8 145 fi; \
5f836e39
SB
146 if [ x"$(SUBDIRS_CMAKE)" != x"" ]; then \
147 for subdir in $(SUBDIRS_CMAKE); do \
068160b1 148 ( \
e5b701c8 149 cd $$subdir && \
4c70c05c 150 $(MKDIR_P) build && \
068160b1 151 cd build && \
e5b701c8
MJ
152 CC=$(CC) \
153 CXX=$(CXX) \
ffb2a175
JR
154 cmake \
155 -DCMAKE_INCLUDE_PATH="$(abs_top_srcdir)/include;$(abs_top_builddir)/include" \
156 -DCMAKE_LIBRARY_PATH="$(abs_top_builddir)/liblttng-ust/.libs" \
157 -DCMAKE_C_FLAGS="$(CFLAGS) $(CPPFLAGS)" \
158 -DCMAKE_CXX_FLAGS="$(CXXFLAGS) $(CPPFLAGS)" \
159 -DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS)" \
160 .. && \
068160b1
PP
161 $(MAKE) && \
162 cd .. \
163 ) || exit 1; \
5f836e39
SB
164 done; \
165 fi;
166
92414a62
MD
167
168clean-local:
0faf99b8
MD
169 @for subdir in $(SUBDIRS_PROXY); do \
170 if [ -d $$subdir ]; then \
849202d4 171 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) clean && cd ..) || exit 1; \
0faf99b8
MD
172 fi; \
173 done; \
174 if [ x"$(SUBDIRS_JUL)" != x"" ]; then \
175 for subdir in $(SUBDIRS_JUL); do \
176 if [ -d $$subdir ]; then \
177 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) clean && cd ..) || exit 1; \
178 fi; \
849202d4 179 done; \
0faf99b8 180 fi; \
be347eb9
MJ
181 if [ x"$(SUBDIRS_LOG4J)" != x"" ]; then \
182 for subdir in $(SUBDIRS_LOG4J); do \
183 if [ -d $$subdir ]; then \
184 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) clean && cd ..) || exit 1; \
185 fi; \
186 done; \
187 fi; \
5f836e39
SB
188 if [ x"$(SUBDIRS_CMAKE)" != x"" ]; then \
189 for subdir in $(SUBDIRS_CMAKE); do \
190 if [ -d $$subdir ]; then \
191 (cd $$subdir && rm -rf build && cd ..) || exit 1; \
192 fi; \
193 done; \
194 fi; \
0faf99b8 195 if [ x"$(srcdir)" != x"$(builddir)" ]; then \
5f836e39 196 for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL) $(SUBDIRS_LOG4J) $(SUBDIRS_CMAKE); do \
92414a62
MD
197 rm -rf $(builddir)/$$subdir; \
198 done; \
0faf99b8 199 fi;
92414a62 200endif
This page took 0.042539 seconds and 5 git commands to generate.