Makefile.am 8.59 KB
Newer Older
Brice Videau's avatar
Brice Videau committed
1
2
3
4
5
6
7
.DELETE_ON_ERROR:

LTTNG_FLAGS=-fPIC -Wall -Wextra -Wno-unused-parameter -Wno-type-limits -Wno-sign-compare -Werror -I$(top_srcdir)/utils -I$(srcdir)/include -I../utils -I./

ZE_PROBES_TP = \
	ze_tracepoints.tp \
	zet_tracepoints.tp \
8
9
	zes_tracepoints.tp \
	zel_tracepoints.tp
Brice Videau's avatar
Brice Videau committed
10
11
12
13

ZE_PROBES_INCL = \
	ze_tracepoints.h \
	zet_tracepoints.h \
14
15
	zes_tracepoints.h \
	zel_tracepoints.h
Brice Videau's avatar
Brice Videau committed
16
17
18
19

ZE_PROBES_SRC = \
	ze_tracepoints.c \
	zet_tracepoints.c \
20
	zes_tracepoints.c \
Brice Videau's avatar
Brice Videau committed
21
	zel_tracepoints.c
Brice Videau's avatar
Brice Videau committed
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

ZE_STATIC_PROBES_TP = \
	ze_profiling.tp \
	ze_properties.tp

ZE_STATIC_PROBES_INCL = \
	ze_profiling.h \
	ze_properties.h

ZE_STATIC_PROBES_SRC = \
	ze_profiling.c \
	ze_properties.c

CLEANFILES = \
	$(ZE_PROBES_TP) \
	$(ZE_PROBES_INCL) \
	$(ZE_PROBES_SRC) \
	$(ZE_STATIC_PROBES_TP) \
	$(ZE_STATIC_PROBES_INCL) \
	$(ZE_STATIC_PROBES_SRC)

ML_FILES = \
	$(srcdir)/ze_meta_parameters.yaml \
	$(srcdir)/zes_meta_parameters.yaml \
46
47
	$(srcdir)/zet_meta_parameters.yaml \
	$(srcdir)/zel_meta_parameters.yaml
Brice Videau's avatar
Brice Videau committed
48
49
50
51
52
53
54
55
56
57
58

EXTRA_DIST = $(ML_FILES)

ZE_EXTRACT = \
	$(srcdir)/extract_base.rb

EXTRA_DIST += extract_base.rb 

ZE_EXTRACTED = \
	ze_api.yaml \
	zet_api.yaml \
59
60
	zes_api.yaml \
	zel_api.yaml
Brice Videau's avatar
Brice Videau committed
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

CLEANFILES += $(ZE_EXTRACTED)

ZE_MODEL = \
	$(srcdir)/ze_model.rb \
	$(ML_FILES) \
	$(srcdir)/ze_events.yaml \
	$(ZE_EXTRACTED) \
	$(srcdir)/../utils/yaml_ast.rb \
	$(srcdir)/../utils/LTTng.rb

EXTRA_DIST += \
	ze_model.rb \
	ze_events.yaml

ZE_EXTRA_HDR = \
	$(srcdir)/include/ze_ddi.h \
	$(srcdir)/include/zes_api.h \
	$(srcdir)/include/zes_ddi.h \
	$(srcdir)/include/zet_api.h \
81
82
83
84
	$(srcdir)/include/zet_ddi.h \
	$(srcdir)/include/loader/ze_loader_api.h \
	$(srcdir)/include/layers/zel_tracing_api.h \
	$(srcdir)/include/layers/zel_tracing_ddi.h
Brice Videau's avatar
Brice Videau committed
85
86
87
88
ZE_HDR = \
	$(srcdir)/include/ze_api.h \
	$(ZE_EXTRA_HDR)

Brice Videau's avatar
Brice Videau committed
89
MODIFIED_ZE_EXTRA_HDR = \
Brice Videau's avatar
Brice Videau committed
90
91
92
93
	modified_include/ze_ddi.h \
	modified_include/zes_api.h \
	modified_include/zes_ddi.h \
	modified_include/zet_api.h \
94
95
96
97
	modified_include/zet_ddi.h \
	modified_include/loader/ze_loader_api.h \
	modified_include/layers/zel_tracing_api.h \
	modified_include/layers/zel_tracing_ddi.h
Brice Videau's avatar
Brice Videau committed
98
99
MODIFIED_ZE_HDR = \
	modified_include/ze_api.h \
Brice Videau's avatar
Brice Videau committed
100
	$(MODIFIED_ZE_EXTRA_HDR)
Brice Videau's avatar
Brice Videau committed
101
102
103
104
105
106

modified_include/ze_api.h: $(ZE_HDR) $(srcdir)/headers.patch
	$(RM) -r modified_include/
	cp -r $(srcdir)/include/ modified_include/
	cat $(srcdir)/headers.patch | patch -i - -d modified_include/ -s -p1

Brice Videau's avatar
Brice Videau committed
107
$(MODIFIED_ZE_EXTRA_HDR): modified_include/ze_api.h
Brice Videau's avatar
Brice Videau committed
108
109
110
111
112
113
114
115
116
117
118
119
	@if test -f $@; then \
	  touch $@; \
	else \
	  $(RM) modified_include/ze_api.h; \
	  $(MAKE) $(AM_MAKEFLAGS) modified_include/ze_api.h; \
	fi

clean-local:
	$(RM) -r modified_include

EXTRA_DIST += $(srcdir)/include headers.patch

120
121
ze_api.yaml: $(srcdir)/extract_ze.rb $(MODIFIED_ZE_HDR) $(ZE_EXTRACT)
	SRC_DIR=$(srcdir) $(RUBY) $<
Brice Videau's avatar
Brice Videau committed
122

123
124
zet_api.yaml: $(srcdir)/extract_zet.rb $(MODIFIED_ZE_HDR) $(ZE_EXTRACT)
	SRC_DIR=$(srcdir) $(RUBY) $<
Brice Videau's avatar
Brice Videau committed
125

126
127
128
129
130
zes_api.yaml: $(srcdir)/extract_zes.rb $(MODIFIED_ZE_HDR) $(ZE_EXTRACT)
	SRC_DIR=$(srcdir) $(RUBY) $<

zel_api.yaml: $(srcdir)/extract_zel.rb $(MODIFIED_ZE_HDR) $(ZE_EXTRACT)
	SRC_DIR=$(srcdir) $(RUBY) $<
Brice Videau's avatar
Brice Videau committed
131
132
133
134

EXTRA_DIST += \
	extract_ze.rb \
	extract_zet.rb \
135
136
	extract_zes.rb \
	extract_zel.rb
Brice Videau's avatar
Brice Videau committed
137
138

ze_tracepoints.tp: $(srcdir)/gen_ze_tracepoints.rb $(ZE_MODEL) $(srcdir)/gen_probe_base.rb
139
	SRC_DIR=$(srcdir) $(RUBY) $< > $@
Brice Videau's avatar
Brice Videau committed
140
141

zet_tracepoints.tp: $(srcdir)/gen_zet_tracepoints.rb $(ZE_MODEL) $(srcdir)/gen_probe_base.rb
142
	SRC_DIR=$(srcdir) $(RUBY) $< > $@
Brice Videau's avatar
Brice Videau committed
143
144

zes_tracepoints.tp: $(srcdir)/gen_zes_tracepoints.rb $(ZE_MODEL) $(srcdir)/gen_probe_base.rb
145
146
147
148
	SRC_DIR=$(srcdir) $(RUBY) $< > $@

zel_tracepoints.tp: $(srcdir)/gen_zel_tracepoints.rb $(ZE_MODEL) $(srcdir)/gen_probe_base.rb
	SRC_DIR=$(srcdir) $(RUBY) $< > $@
Brice Videau's avatar
Brice Videau committed
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163

ze_profiling.tp: $(srcdir)/gen_ze_custom_probes.rb $(ZE_MODEL)
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_ze_custom_probes.rb lttng_ust_ze_profiling > $@

ze_properties.tp: $(srcdir)/gen_ze_custom_probes.rb $(ZE_MODEL)
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_ze_custom_probes.rb lttng_ust_ze_properties > $@

%.h %.c: %.tp
	$(LTTNG_GEN_TP) $< -o $*.c -o $*.h

EXTRA_DIST += \
	gen_ze_custom_probes.rb \
	gen_ze_tracepoints.rb \
	gen_zet_tracepoints.rb \
	gen_zes_tracepoints.rb \
164
	gen_zel_tracepoints.rb \
Brice Videau's avatar
Brice Videau committed
165
166
	gen_probe_base.rb

167
zeprof.sh: $(top_builddir)/utils/xprof.sh.erb
Thomas Applencourt's avatar
Thomas Applencourt committed
168
169
170
	$(ERB) -T 1 languages=["ze"] $(top_builddir)/utils/xprof.sh.erb  > $@
	chmod a+x $@

Brice Videau's avatar
Brice Videau committed
171
172
173
BUILT_SOURCES = $(ZE_PROBES_INCL) $(ZE_STATIC_PROBES_INCL) babeltrace_ze_callbacks.h

tracer_ze.c: $(srcdir)/gen_ze.rb $(srcdir)/tracer_ze_helpers.include.c $(ZE_MODEL) $(ZE_PROBES_INCL) $(ZE_STATIC_PROBES_INCL)
Brice Videau's avatar
Brice Videau committed
174
	SRC_DIR=$(srcdir) $(RUBY) $< > $@
Brice Videau's avatar
Brice Videau committed
175

Brice Videau's avatar
Bugfix.    
Brice Videau committed
176
177
EXTRA_DIST += gen_ze.rb tracer_ze_helpers.include.c

Brice Videau's avatar
Brice Videau committed
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
CLEANFILES += tracer_ze.c

bin_SCRIPTS = tracer_ze.sh babeltrace_ze zeprof.sh

noinst_LTLIBRARIES = libzetracepoints.la

nodist_libzetracepoints_la_SOURCES = \
	$(ZE_PROBES_INCL) \
	$(ZE_STATIC_PROBES_INCL) \
	$(ZE_PROBES_SRC) \
	$(ZE_STATIC_PROBES_SRC)

libzetracepoints_la_CFLAGS = $(LTTNG_FLAGS) $(LTTNG_UST_CFLAGS)
libzetracepoints_la_LDFLAGS = $(LTTNG_UST_LIBS)

lib_LTLIBRARIES = libTracerZE.la libZEProf.la

nodist_libTracerZE_la_SOURCES = \
	$(ZE_PROBES_INCL) \
	$(ZE_STATIC_PROBES_INCL) \
	tracer_ze.c

libTracerZE_la_CPPFLAGS = -I$(top_srcdir)/utils -I$(srcdir)/include -I../utils -I./
201
libTracerZE_la_CFLAGS = -Wall -Wextra -Werror $(LIBFFI_CFLAGS) $(LTTNG_UST_CFLAGS)
Brice Videau's avatar
Brice Videau committed
202
203
204
205
libTracerZE_la_LDFLAGS = $(LTTNG_UST_LIBS) -ldl -lpthread $(LIBFFI_LIBS)
libTracerZE_la_LIBADD = libzetracepoints.la

install-exec-hook::
206
207
208
209
	mkdir -p $(pkglibdir)/ze
	$(RM) $(pkglibdir)/ze/libze_loader.so.1 $(pkglibdir)/ze/libze_loader.so
	ln -s $(libdir)/libTracerZE.so.0.0.0 $(pkglibdir)/ze/libze_loader.so.1
	ln -s $(pkglibdir)/ze/libze_loader.so.1 $(pkglibdir)/ze/libze_loader.so
Brice Videau's avatar
Brice Videau committed
210
211


Thomas Applencourt's avatar
Thomas Applencourt committed
212
zeinterval_dispatchers.c: $(srcdir)/gen_babeltrace_ze_dispatchers.rb $(ZE_LIB_GEN) $(ZE_MODEL)
Thomas Applencourt's avatar
Thomas Applencourt committed
213
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_babeltrace_ze_dispatchers.rb "zeinterval" > zeinterval_dispatchers.c
Thomas Applencourt's avatar
Thomas Applencourt committed
214
215

zeinterval_callbacks.cpp: $(srcdir)/gen_zeprof.rb $(ZEPROF) babeltrace_ze_callbacks.h $(srcdir)/zeinterval_callbacks.cpp.erb
Brice Videau's avatar
Brice Videau committed
216
217
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_zeprof.rb

Thomas Applencourt's avatar
Thomas Applencourt committed
218
219
220
zeinterval_callbacks.h:
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_babeltrace_ze_callbacks.rb "zeinterval" > zeinterval_callbacks.h

Thomas Applencourt's avatar
Thomas Applencourt committed
221
222
223
224
225
zeinterval.h: $(srcdir)/interval.h.erb
	$(ERB) namespace="zeinterval" $(srcdir)/interval.h.erb > $(srcdir)/zeinterval.h

zeinterval.c: $(srcdir)/interval.c.erb
	$(ERB) namespace="zeinterval" $(srcdir)/interval.c.erb > $(srcdir)/zeinterval.c
Brice Videau's avatar
Brice Videau committed
226
227
228

CLEANFILES += \
	zeprof.c \
Thomas Applencourt's avatar
Thomas Applencourt committed
229
	zeinterval_callbacks.cpp
Brice Videau's avatar
Brice Videau committed
230
231

nodist_libZEProf_la_SOURCES = \
Thomas Applencourt's avatar
Thomas Applencourt committed
232
	zeprof.h \
Thomas Applencourt's avatar
Thomas Applencourt committed
233
	zeinterval_callbacks.cpp \
Thomas Applencourt's avatar
Thomas Applencourt committed
234
235
236
	zeinterval_dispatchers.c \
	zeinterval.c 

Brice Videau's avatar
Brice Videau committed
237
libZEProf_la_SOURCES = \
Thomas Applencourt's avatar
Thomas Applencourt committed
238
239
240
	babeltrace_ze.h \
	zeprof.c \
	xprof_utils.cpp
Brice Videau's avatar
Brice Videau committed
241
242
243
244

libZEProf_la_CPPFLAGS = -I$(top_srcdir)/utils -I$(srcdir)/include -I./
libZEProf_la_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Werror $(BABELTRACE2_CFLAGS)
libZEProf_la_CXXFLAGS = -std=c++17 -Wall -Wextra -Wno-unused-parameter -Werror $(BABELTRACE2_CFLAGS)
245
libZEProf_la_LDFLAGS = $(BABELTRACE2_LIBS) -avoid-version -module
Brice Videau's avatar
Brice Videau committed
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269

EXTRA_DIST += $(ZEPROF)

tmplibdir = $(libdir)/tmp
tmplib_LTLIBRARIES = libBabeltraceZE.la
install-data-hook::
	$(RM) -r $(DESTDIR)$(tmplibdir)

ZE_LIB_GEN = \
	$(srcdir)/gen_ze_library_base.rb \
	$(srcdir)/gen_probe_base.rb

EXTRA_DIST += $(ZE_LIB_GEN)

babeltrace_ze_callbacks.h: $(srcdir)/gen_babeltrace_ze_callbacks.rb $(ZE_LIB_GEN) $(ZE_MODEL)
	SRC_DIR=$(srcdir) $(RUBY) $< > $@

babeltrace_ze_dispatchers.c: $(srcdir)/gen_babeltrace_ze_dispatchers.rb $(ZE_LIB_GEN) $(ZE_MODEL)
	SRC_DIR=$(srcdir) $(RUBY) $< > $@

EXTRA_DIST += \
	gen_babeltrace_ze_callbacks.rb \
	gen_babeltrace_ze_dispatchers.rb

Brice Videau's avatar
Bugfix.    
Brice Videau committed
270
271
272
273
CLEANFILES += \
	babeltrace_ze_callbacks.h \
	babeltrace_ze_dispatchers.c

Brice Videau's avatar
Brice Videau committed
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
nodist_libBabeltraceZE_la_SOURCES = \
	babeltrace_ze_callbacks.h \
	babeltrace_ze_dispatchers.c
libBabeltraceZE_la_SOURCES = \
	babeltrace_ze.c \
	babeltrace_ze.h
libBabeltraceZE_la_CPPFLAGS = -I$(top_srcdir)/utils -I$(srcdir)/include -I./
libBabeltraceZE_la_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Werror $(BABELTRACE2_CFLAGS)
libBabeltraceZE_la_LDFLAGS = $(BABELTRACE2_LIBS) -avoid-version -module

ze_library.rb: $(srcdir)/gen_ze_library.rb $(ZE_LIB_GEN) $(ZE_MODEL)
	SRC_DIR=$(srcdir) $(RUBY) $< > $@

babeltrace_ze_lib.rb: $(srcdir)/gen_babeltrace_ze_lib.rb $(ZE_LIB_GEN) $(ZE_MODEL)
	SRC_DIR=$(srcdir) $(RUBY) $< > $@

ze_refinements.rb: $(srcdir)/gen_ze_refinements.rb $(ZE_LIB_GEN) $(ZE_MODEL)
	SRC_DIR=$(srcdir) $(RUBY) $< > $@

ze_bindings.rb: $(srcdir)/gen_ze_bindings.rb $(ZE_LIB_GEN) $(ZE_MODEL)
	SRC_DIR=$(srcdir) $(RUBY) $< > $@

ZE_BINDINGS = \
	ze_library.rb \
	babeltrace_ze_lib.rb \
	ze_refinements.rb \
	ze_bindings.rb

data_DATA = $(ZE_BINDINGS)

EXTRA_DIST += \
	gen_ze_library.rb \
	gen_babeltrace_ze_lib.rb \
	gen_ze_refinements.rb \
	gen_ze_bindings.rb

CLEANFILES += $(ZE_BINDINGS)