Makefile.am 10.7 KB
Newer Older
Brice Videau's avatar
WIP.  
Brice Videau committed
1
2
.DELETE_ON_ERROR:

3
LTTNG_FLAGS=-fPIC -Wall -Wextra -Wno-unused-parameter -Wno-type-limits -Wno-sign-compare -Werror -I$(top_srcdir)/utils -I$(top_srcdir)/utils/include -I$(srcdir)/include -I../utils -I./
Brice Videau's avatar
WIP.  
Brice Videau committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

OPENCL_PROBES_TP = \
                     opencl_tracepoints.tp\
                     opencl_profiling.tp\
                     opencl_source.tp\
                     opencl_dump.tp\
                     opencl_arguments.tp\
                     opencl_build.tp\
                     opencl_devices.tp

OPENCL_PROBES_INCL = \
                     opencl_tracepoints.h\
                     opencl_profiling.h\
                     opencl_source.h\
                     opencl_dump.h\
                     opencl_arguments.h\
                     opencl_build.h\
                     opencl_devices.h

OPENCL_PROBES_SRC = \
                     opencl_tracepoints.c\
                     opencl_profiling.c\
                     opencl_source.c\
                     opencl_dump.c\
                     opencl_arguments.c\
                     opencl_build.c\
                     opencl_devices.c

ML_FILES = $(srcdir)/opencl_meta_parameters.yaml\
           $(srcdir)/supported_extensions.yaml\
           $(srcdir)/supported_enums.yaml

TRACEPOINT_GEN = $(srcdir)/opencl_model.rb\
                 $(srcdir)/opencl_tracepoints.rb\
                 $(srcdir)/opencl_events.yaml

cl.xml.patched: $(srcdir)/cl.xml $(srcdir)/cl.xml.patch
	$(PATCH) $(srcdir)/cl.xml $(srcdir)/cl.xml.patch -o cl.xml.patched

tracer_opencl.h: $(srcdir)/gen_opencl_header.rb
	$(RUBY) $(srcdir)/gen_opencl_header.rb > $@

opencl_model.yaml: $(srcdir)/gen_opencl_model.rb $(srcdir)/opencl_model.rb $(ML_FILES) cl.xml.patched $(srcdir)/opencl_wrapper_events.yaml $(srcdir)/opencl_tracepoints.rb
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_opencl_model.rb > $@

Brice Videau's avatar
Brice Videau committed
49
50
opencl_babeltrace_model.yaml: $(srcdir)/gen_babeltrace_cl_model.rb opencl_model.yaml
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_babeltrace_cl_model.rb > $@
51

Thomas Applencourt's avatar
Thomas Applencourt committed
52
tests/opencl_dummy_trace.yaml: opencl_babeltrace_model.yaml
Thomas Applencourt's avatar
Thomas Applencourt committed
53
	mkdir -p tests
Brice Videau's avatar
Brice Videau committed
54
55
	$(RUBY) $(top_srcdir)/utils/gen_dummy_trace.rb opencl_babeltrace_model.yaml > $@

Brice Videau's avatar
WIP.  
Brice Videau committed
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
opencl_tracepoints.tp: $(srcdir)/gen_opencl_probes.rb $(srcdir)/opencl_model.rb tracer_opencl.h $(ML_FILES) cl.xml.patched $(srcdir)/opencl_tracepoints.rb $(srcdir)/opencl_wrapper_events.yaml
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_opencl_probes.rb > $@

opencl_build.tp: $(srcdir)/gen_opencl_custom_probes.rb $(TRACEPOINT_GEN)
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_opencl_custom_probes.rb lttng_ust_opencl_build > $@

opencl_arguments.tp: $(srcdir)/gen_opencl_custom_probes.rb $(TRACEPOINT_GEN)
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_opencl_custom_probes.rb lttng_ust_opencl_arguments > $@

opencl_dump.tp: $(srcdir)/gen_opencl_custom_probes.rb $(TRACEPOINT_GEN)
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_opencl_custom_probes.rb lttng_ust_opencl_dump > $@

opencl_profiling.tp: $(srcdir)/gen_opencl_custom_probes.rb $(TRACEPOINT_GEN)
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_opencl_custom_probes.rb lttng_ust_opencl_profiling > $@

opencl_source.tp: $(srcdir)/gen_opencl_custom_probes.rb $(TRACEPOINT_GEN)
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_opencl_custom_probes.rb lttng_ust_opencl_source > $@

opencl_devices.tp: $(srcdir)/gen_opencl_custom_probes.rb $(TRACEPOINT_GEN)
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_opencl_custom_probes.rb lttng_ust_opencl_devices > $@

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

80
clprof.sh: $(top_builddir)/utils/xprof.sh.erb
Thomas Applencourt's avatar
Thomas Applencourt committed
81
82
83
	$(ERB) -T 1 languages=["opencl"] $(top_builddir)/utils/xprof.sh.erb  > $@
	chmod a+x $@

84
BUILT_SOURCES = $(OPENCL_PROBES_INCL) babeltrace_cl_callbacks.h clprof_callbacks.h clprof.c
Brice Videau's avatar
WIP.  
Brice Videau committed
85
86
87
88

tracer_opencl.c: $(srcdir)/gen_opencl.rb $(srcdir)/opencl_model.rb $(ML_FILES) cl.xml.patched $(srcdir)/tracer_opencl_helpers.include.c $(OPENCL_PROBES_INCL) tracer_opencl.h
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_opencl.rb > $@

89
bin_SCRIPTS = tracer_opencl.sh clprof.sh babeltrace_opencl extract_enqueues
Brice Videau's avatar
WIP.  
Brice Videau committed
90
91
92
93
94
95
96
97
98
99

noinst_LTLIBRARIES = libtracepoints.la

nodist_libtracepoints_la_SOURCES = \
	$(OPENCL_PROBES_INCL) \
	$(OPENCL_PROBES_SRC)

libtracepoints_la_CFLAGS = $(LTTNG_FLAGS) $(LTTNG_UST_CFLAGS)
libtracepoints_la_LDFLAGS = $(LTTNG_UST_LIBS)

100
lib_LTLIBRARIES = libTracerOpenCL.la libCLProf.la
Brice Videau's avatar
WIP.  
Brice Videau committed
101
102
103
104
105
106

nodist_libTracerOpenCL_la_SOURCES = \
        $(OPENCL_PROBES_INCL) \
        tracer_opencl.h \
	tracer_opencl.c

107
libTracerOpenCL_la_CPPFLAGS = -I$(top_srcdir)/utils -I$(top_srcdir)/utils/include -I$(srcdir)/include -I../utils -I./
108
libTracerOpenCL_la_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Werror $(LIBFFI_CFLAGS) $(LTTNG_UST_CFLAGS)
109
110
libTracerOpenCL_la_LDFLAGS = $(LTTNG_UST_LIBS) -ldl -lpthread $(LIBFFI_LIBS)
libTracerOpenCL_la_LDFLAGS += -Wl,--version-script,$(srcdir)/tracer_opencl.map -version-info 1:0:0
Brice Videau's avatar
WIP.  
Brice Videau committed
111
112
113
libTracerOpenCL_la_DEPENDS = $(srcdir)/tracer_opencl.map
libTracerOpenCL_la_LIBADD = libtracepoints.la

Brice Videau's avatar
Brice Videau committed
114
115
116
117
118
119
120
121
install-exec-hook:
	$(MKDIR_P) $(DESTDIR)$(pkglibdir)/opencl
	$(LN_S) -f $(DESTDIR)$(libdir)/libTracerOpenCL.so.1.0.0 $(DESTDIR)$(pkglibdir)/opencl/libOpenCL.so.1
	$(LN_S) -f $(DESTDIR)$(pkglibdir)/opencl/libOpenCL.so.1 $(DESTDIR)$(pkglibdir)/opencl/libOpenCL.so

uninstall-hook:
	$(RM) -f $(DESTDIR)$(pkglibdir)/opencl/libOpenCL.so.1 $(DESTDIR)$(pkglibdir)/opencl/libOpenCL.so
	-rmdir $(DESTDIR)$(pkglibdir)/opencl
Brice Videau's avatar
Brice Videau committed
122

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
clprof.c: $(srcdir)/clprof_callbacks.cpp.erb $(srcdir)/clprof_callbacks.h.erb $(srcdir)/clprof.c.erb $(srcdir)/gen_clprof.rb opencl_model.yaml babeltrace_cl_callbacks.h tracer_opencl.h
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_clprof.rb production

clprof_callbacks.cpp clprof_callbacks.h: clprof.c
	@if test -f $@; then \
	  touch $@; \
	else \
	  rm -f clprof.c; \
	  $(MAKE) $(AM_MAKEFLAGS) clprof.c; \
	fi

nodist_libCLProf_la_SOURCES = \
	clprof.c \
	clprof_callbacks.cpp \
	clprof_callbacks.h \
	tracer_opencl.h \
	babeltrace_cl_dispatchers.c
libCLProf_la_SOURCES = \
Brice Videau's avatar
Brice Videau committed
141
	babeltrace_cl.h
142

143
libCLProf_la_CPPFLAGS = -I$(top_srcdir)/utils -I$(top_srcdir)/utils/include -I$(srcdir)/include -I./
144
145
libCLProf_la_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Werror $(BABELTRACE2_CFLAGS)
libCLProf_la_CXXFLAGS = -std=c++17 -Wall -Wextra -Wno-unused-parameter -Werror $(BABELTRACE2_CFLAGS)
146
libCLProf_la_LDFLAGS = $(BABELTRACE2_LIBS) -avoid-version -module
147
148
149
150
151
152

# Cannot use check_LTLIBRARIES because we need the shared version of those
# Thanks Vincent Danjean
#   noinst_LTLIBRARIES would be the correct thing but then libtool
#   only built non shared version :-( So, declaring the libs as
#   pkglib_LTLIBRARIES and using an install hook to remove them.
Brice Videau's avatar
Brice Videau committed
153
tmplibdir = $(libdir)/tmp
Brice Videau's avatar
Brice Videau committed
154
tmplib_LTLIBRARIES = libBabeltraceCL.la libTestingCLProf.la
Brice Videau's avatar
Brice Videau committed
155
156
install-data-hook::
	$(RM) -r $(DESTDIR)$(tmplibdir)
157

158
babeltrace_cl_callbacks.h: $(srcdir)/gen_babeltrace_cl_callbacks.rb opencl_babeltrace_model.yaml
Brice Videau's avatar
WIP.  
Brice Videau committed
159
160
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_babeltrace_cl_callbacks.rb > babeltrace_cl_callbacks.h

161
babeltrace_cl_dispatchers.c: $(srcdir)/gen_babeltrace_cl_dispatchers.rb opencl_babeltrace_model.yaml
Brice Videau's avatar
WIP.  
Brice Videau committed
162
163
164
165
166
167
168
169
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_babeltrace_cl_dispatchers.rb > babeltrace_cl_dispatchers.c

nodist_libBabeltraceCL_la_SOURCES = \
	babeltrace_cl_dispatchers.c \
	babeltrace_cl_callbacks.h
libBabeltraceCL_la_SOURCES = \
	babeltrace_cl.c \
	babeltrace_cl.h
170
libBabeltraceCL_la_CPPFLAGS = -I$(top_srcdir)/utils -I$(top_srcdir)/utils/include -I$(srcdir)/include -I./
Brice Videau's avatar
WIP.  
Brice Videau committed
171
libBabeltraceCL_la_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Werror $(BABELTRACE2_CFLAGS)
172
libBabeltraceCL_la_LDFLAGS = $(BABELTRACE2_LIBS) -avoid-version -module
Brice Videau's avatar
WIP.  
Brice Videau committed
173

174
175
176
177
testing_clprof.c: $(srcdir)/clprof_callbacks.cpp.erb $(srcdir)/clprof_callbacks.h.erb $(srcdir)/clprof.c.erb $(srcdir)/gen_clprof.rb opencl_model.yaml babeltrace_cl_callbacks.h tracer_opencl.h
	SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_clprof.rb testing

testing_clprof_callbacks.cpp testing_clprof_callbacks.h: testing_clprof.c
Brice Videau's avatar
WIP.  
Brice Videau committed
178
179
180
	@if test -f $@; then \
	  touch $@; \
	else \
Brice Videau's avatar
Brice Videau committed
181
	  rm -f testing_clprof.c; \
182
	  $(MAKE) $(AM_MAKEFLAGS) testing_clprof.c; \
Brice Videau's avatar
WIP.  
Brice Videau committed
183
184
	fi

185
186
187
188
nodist_libTestingCLProf_la_SOURCES = \
	testing_clprof.c \
	testing_clprof_callbacks.cpp \
	testing_clprof_callbacks.h \
Brice Videau's avatar
WIP.  
Brice Videau committed
189
190
	tracer_opencl.h \
	babeltrace_cl_dispatchers.c
191
libTestingCLProf_la_SOURCES = \
Brice Videau's avatar
Bugfix.    
Brice Videau committed
192
	babeltrace_cl.h
Brice Videau's avatar
WIP.  
Brice Videau committed
193

194
libTestingCLProf_la_CPPFLAGS = -I$(top_srcdir)/utils -I$(top_srcdir)/utils/include -I$(srcdir)/include -I./
195
196
libTestingCLProf_la_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Werror $(BABELTRACE2_CFLAGS)
libTestingCLProf_la_CXXFLAGS = -std=c++17 -Wall -Wextra -Wno-unused-parameter -Werror $(BABELTRACE2_CFLAGS)
197
libTestingCLProf_la_LDFLAGS = $(BABELTRACE2_LIBS) -avoid-version -module
198
199

TEST_FILES = \
Brice Videau's avatar
Brice Videau committed
200
	tests/opencl_dummy_trace.dust \
Brice Videau's avatar
Brice Videau committed
201
	tests/profiling_normal.dust \
202
203
204
205
206
207
208
209
	tests/profiling_inversed.dust \
	tests/profiling_block.dust \
	tests/profiling_fast.dust \
	tests/profiling_interleave_thread.dust \
	tests/profiling_interleave_process.dust \
	tests/profiling_normal_command_queue.dust \
	tests/profiling_with_error.dust \
	tests/profiling_normal_command_queue_created_in_other_thread.dust \
Brice Videau's avatar
Brice Videau committed
210
211
212
213
	tests/device_name.dust \
	tests/kernel_name.dust \
	tests/profiling_normal_nd_range_kernel_name.dust \
	tests/API_call.dust \
Brice Videau's avatar
Brice Videau committed
214
	tests/trace.dust
215

Brice Videau's avatar
Brice Videau committed
216
TRACE_FILES = \
Brice Videau's avatar
Brice Videau committed
217
218
219
220
221
222
223
224
225
226
227
228
229
230
	tests/profiling_normal.yaml \
	tests/profiling_inversed.yaml \
	tests/profiling_block.yaml \
	tests/profiling_fast.yaml \
	tests/profiling_interleave_thread.yaml \
	tests/profiling_interleave_process.yaml \
	tests/profiling_normal_command_queue.yaml \
	tests/profiling_with_error.yaml \
	tests/profiling_normal_command_queue_created_in_other_thread.yaml \
	tests/device_name.yaml \
	tests/kernel_name.yaml \
	tests/profiling_normal_nd_range_kernel_name.yaml \
	tests/API_call.yaml \
	tests/trace.yaml
231

Brice Videau's avatar
Brice Videau committed
232
233
234
235
236
237
TESTS = $(TEST_FILES)

TEST_EXTENSIONS = .dust
DUST_LOG_COMPILER = ./test_wrapper.sh
check_DATA = \
	test_wrapper.sh \
Thomas Applencourt's avatar
Thomas Applencourt committed
238
	tests/opencl_dummy_trace.yaml
Brice Videau's avatar
Brice Videau committed
239
240
241
242
243
244

data_DATA = \
	opencl_model.yaml \
	opencl_infos.yaml \
        $(TRACE_FILES)

245
246
247
248
249
250
251
252
253
254
255
256
257
258
EXTRA_DIST = \
	cl.xml \
	cl.xml.patch \
	$(ML_FILES) \
	opencl_infos.yaml \
	opencl_wrapper_events.yaml \
	$(TRACEPOINT_GEN) \
	include \
	tracer_opencl.map \
	tracer_opencl_helpers.include.c \
	gen_opencl.rb \
	gen_opencl_probes.rb \
	gen_opencl_header.rb \
	gen_opencl_model.rb \
Brice Videau's avatar
Brice Videau committed
259
	gen_babeltrace_cl_model.rb \
260
261
262
263
264
265
266
267
268
	gen_opencl_custom_probes.rb \
	gen_babeltrace_cl_dispatchers.rb \
	gen_babeltrace_cl_callbacks.rb \
	gen_clprof.rb \
	clprof_callbacks.cpp.erb \
	babeltrace_opencl.in \
	extract_enqueues \
	clprof.c.erb \
	clprof_callbacks.h.erb \
Brice Videau's avatar
Brice Videau committed
269
270
271
	test_wrapper.sh \
	$(TRACE_FILES) \
	$(TEST_FILES)
272
273
274
275
276
277
278
279
280

CLEANFILES = \
	$(OPENCL_PROBES_INCL) \
	$(OPENCL_PROBES_TP) \
	$(OPENCL_PROBES_SRC) \
	tracer_opencl.c \
	tracer_opencl.h \
	cl.xml.patched \
	opencl_model.yaml \
281
	opencl_babeltrace_model.yaml \
Thomas Applencourt's avatar
Thomas Applencourt committed
282
	tests/opencl_dummy_trace.yaml \
283
284
285
286
287
288
289
	babeltrace_cl_dispatchers.c \
	babeltrace_cl_callbacks.h \
	clprof.c \
	clprof_callbacks.cpp \
	clprof_callbacks.h \
	testing_clprof.c \
	testing_clprof_callbacks.cpp \
Brice Videau's avatar
Brice Videau committed
290
291
	testing_clprof_callbacks.h \
	clprof.sh