forked from smihir/trace-cmd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
630 lines (475 loc) · 16.1 KB
/
Makefile
1
2
3
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
# trace-cmd version
TC_VERSION = 2
TC_PATCHLEVEL = 3
TC_EXTRAVERSION = 0
# Kernel Shark version
KS_VERSION = 0
KS_PATCHLEVEL = 2
KS_EXTRAVERSION =
# file format version
FILE_VERSION = 6
MAKEFLAGS += --no-print-directory
# Makefiles suck: This macro sets a default value of $(2) for the
# variable named by $(1), unless the variable has been set by
# environment or command line. This is necessary for CC and AR
# because make sets default values, so the simpler ?= approach
# won't work as expected.
define allow-override
$(if $(or $(findstring environment,$(origin $(1))),\
$(findstring command line,$(origin $(1)))),,\
$(eval $(1) = $(2)))
endef
# Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
$(call allow-override,CC,$(CROSS_COMPILE)gcc)
$(call allow-override,AR,$(CROSS_COMPILE)ar)
EXT = -std=gnu99
INSTALL = install
# Use DESTDIR for installing into a different root directory.
# This is useful for building a package. The program will be
# installed in this directory as if it was the root directory.
# Then the build tool can move it later.
DESTDIR ?=
DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))'
prefix ?= /usr/local
bindir_relative = bin
bindir = $(prefix)/$(bindir_relative)
man_dir = $(prefix)/share/man
man_dir_SQ = '$(subst ','\'',$(man_dir))'
html_install = $(prefix)/share/kernelshark/html
html_install_SQ = '$(subst ','\'',$(html_install))'
img_install = $(prefix)/share/kernelshark/html/images
img_install_SQ = '$(subst ','\'',$(img_install))'
libdir ?= lib
export man_dir man_dir_SQ html_install html_install_SQ INSTALL
export img_install img_install_SQ
export DESTDIR DESTDIR_SQ
ifeq ($(prefix),$(HOME))
plugin_dir = $(HOME)/.trace-cmd/plugins
python_dir = $(HOME)/.trace-cmd/python
else
plugin_dir = $(prefix)/$(libdir)/trace-cmd/plugins
python_dir = $(prefix)/$(libdir)/trace-cmd/python
PLUGIN_DIR = -DPLUGIN_DIR="$(plugin_dir)"
PYTHON_DIR = -DPYTHON_DIR="$(python_dir)"
PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
PYTHON_DIR_SQ = '$(subst ','\'',$(PYTHON_DIR))'
endif
HELP_DIR = -DHELP_DIR=$(html_install)
HELP_DIR_SQ = '$(subst ','\'',$(HELP_DIR))'
# copy a bit from Linux kbuild
ifeq ("$(origin V)", "command line")
VERBOSE = $(V)
endif
ifndef VERBOSE
VERBOSE = 0
endif
ifndef NO_PYTHON
PYTHON := ctracecmd.so
PYTHON_GUI := ctracecmd.so ctracecmdgui.so
PYTHON_VERS ?= python
# Can build python?
ifeq ($(shell sh -c "pkg-config --cflags $(PYTHON_VERS) > /dev/null 2>&1 && echo y"), y)
PYTHON_PLUGINS := plugin_python.so
BUILD_PYTHON := $(PYTHON) $(PYTHON_PLUGINS)
PYTHON_SO_INSTALL := ctracecmd.install
PYTHON_PY_PROGS := event-viewer.install
PYTHON_PY_LIBS := tracecmd.install tracecmdgui.install
endif
endif # NO_PYTHON
# $(call test-build, snippet, ret) -> ret if snippet compiles
# -> empty otherwise
test-build = $(if $(shell sh -c 'echo "$(1)" | \
$(CC) -o /dev/null -c -x c - > /dev/null 2>&1 && echo y'), $2)
# have udis86 disassembler library?
udis86-flags := $(call test-build,\#include <udis86.h>,-DHAVE_UDIS86 -ludis86)
define BLK_TC_FLUSH_SOURCE
#include <linux/blktrace_api.h>
int main(void) { return BLK_TC_FLUSH; }
endef
# have flush/fua block layer instead of barriers?
blk-flags := $(call test-build,$(BLK_TC_FLUSH_SOURCE),-DHAVE_BLK_TC_FLUSH)
ifeq ("$(origin O)", "command line")
BUILD_OUTPUT := $(O)
endif
ifeq ($(BUILD_SRC),)
ifneq ($(BUILD_OUTPUT),)
define build_output
$(if $(VERBOSE:1=),@)$(MAKE) -C $(BUILD_OUTPUT) \
BUILD_SRC=$(CURDIR) -f $(CURDIR)/Makefile $1
endef
saved-output := $(BUILD_OUTPUT)
BUILD_OUTPUT := $(shell cd $(BUILD_OUTPUT) && /bin/pwd)
$(if $(BUILD_OUTPUT),, \
$(error output directory "$(saved-output)" does not exist))
all: sub-make
gui: force
$(call build_output, all_cmd)
$(call build_output, BUILDGUI=1 all_gui)
$(filter-out gui,$(MAKECMDGOALS)): sub-make
sub-make: force
$(call build_output, $(MAKECMDGOALS))
# Leave processing to above invocation of make
skip-makefile := 1
endif # BUILD_OUTPUT
endif # BUILD_SRC
# We process the rest of the Makefile if this is the final invocation of make
ifeq ($(skip-makefile),)
srctree := $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR))
objtree := $(CURDIR)
src := $(srctree)
obj := $(objtree)
export prefix bindir src obj
# Shell quotes
bindir_SQ = $(subst ','\'',$(bindir))
bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
plugin_dir_SQ = $(subst ','\'',$(plugin_dir))
python_dir_SQ = $(subst ','\'',$(python_dir))
LIBS = -L. -ltracecmd -ldl
LIB_FILE = libtracecmd.a
PACKAGES= gtk+-2.0 libxml-2.0 gthread-2.0
ifndef BUILDGUI
BUILDGUI = 0
endif
ifeq ($(BUILDGUI), 1)
CONFIG_INCLUDES = $(shell pkg-config --cflags $(PACKAGES)) -I$(obj)
CONFIG_FLAGS = -DBUILDGUI \
-DGTK_VERSION=$(shell pkg-config --modversion gtk+-2.0 | \
awk 'BEGIN{FS="."}{ a = ($$1 * (2^16)) + $$2 * (2^8) + $$3; printf ("%d", a);}')
CONFIG_LIBS = $(shell pkg-config --libs $(PACKAGES))
VERSION = $(KS_VERSION)
PATCHLEVEL = $(KS_PATCHLEVEL)
EXTRAVERSION = $(KS_EXTRAVERSION)
GUI = 'GUI '
GOBJ = $@
GSPACE =
REBUILD_GUI = /bin/true
G =
N = @/bin/true ||
CONFIG_FLAGS += $(HELP_DIR_SQ)
else
CONFIG_INCLUDES =
CONFIG_LIBS =
CONFIG_FLAGS =
VERSION = $(TC_VERSION)
PATCHLEVEL = $(TC_PATCHLEVEL)
EXTRAVERSION = $(TC_EXTRAVERSION)
GUI =
GSPACE = " "
GOBJ = $(GSPACE)$@
REBUILD_GUI = $(MAKE) -f $(src)/Makefile BUILDGUI=1 $@
G = $(REBUILD_GUI); /bin/true ||
N =
endif
export Q VERBOSE
TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION)
KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION)
INCLUDES = -I. $(CONFIG_INCLUDES)
include $(src)/features.mk
# Set compile option CFLAGS if not set elsewhere
CFLAGS ?= -g -Wall
CPPFLAGS ?=
LDFLAGS ?=
# Required CFLAGS
override CFLAGS += -D_GNU_SOURCE
ifndef NO_PTRACE
ifneq ($(call try-cc,$(SOURCE_PTRACE),),y)
NO_PTRACE = 1
CFLAGS += -DWARN_NO_PTRACE
endif
endif
ifdef NO_PTRACE
CFLAGS += -DNO_PTRACE
endif
# Append required CFLAGS
override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ)
override CFLAGS += $(udis86-flags) $(blk-flags)
ifeq ($(VERBOSE),1)
Q =
print_compile =
print_app_build =
print_fpic_compile =
print_shared_lib_compile =
print_plugin_obj_compile =
print_plugin_build =
print_install =
else
Q = @
print_compile = echo ' $(GUI)COMPILE '$(GOBJ);
print_app_build = echo ' $(GUI)BUILD '$(GOBJ);
print_fpic_compile = echo ' $(GUI)COMPILE FPIC '$(GOBJ);
print_shared_lib_compile = echo ' $(GUI)COMPILE SHARED LIB '$(GOBJ);
print_plugin_obj_compile = echo ' $(GUI)COMPILE PLUGIN OBJ '$(GOBJ);
print_plugin_build = echo ' $(GUI)BUILD PLUGIN '$(GOBJ);
print_static_lib_build = echo ' $(GUI)BUILD STATIC LIB '$(GOBJ);
print_install = echo ' $(GUI)INSTALL '$(GSPACE)$1' to $(DESTDIR_SQ)$2';
endif
do_fpic_compile = \
($(print_fpic_compile) \
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) -fPIC $< -o $@)
do_app_build = \
($(print_app_build) \
$(CC) $^ -rdynamic -o $@ $(LDFLAGS) $(CONFIG_LIBS) $(LIBS))
do_compile_shared_library = \
($(print_shared_lib_compile) \
$(CC) --shared $^ -o $@)
do_compile_plugin_obj = \
($(print_plugin_obj_compile) \
$(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $<)
do_plugin_build = \
($(print_plugin_build) \
$(CC) $(CFLAGS) $(LDFLAGS) -shared -nostartfiles -o $@ $<)
do_build_static_lib = \
($(print_static_lib_build) \
$(RM) $@; $(AR) rcs $@ $^)
define check_gui
if [ $(BUILDGUI) -ne 1 -a ! -z "$(filter $(gui_objs),$(@))" ]; then \
$(REBUILD_GUI); \
else \
$(print_compile) \
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) $< -o $(obj)/$@; \
fi;
endef
$(obj)/%.o: $(src)/%.c
$(Q)$(call check_gui)
%.o: $(src)/%.c
$(Q)$(call check_gui)
TRACE_GUI_OBJS = trace-filter.o trace-compat.o trace-hash.o trace-dialog.o \
trace-xml.o
TRACE_CMD_OBJS = trace-cmd.o trace-record.o trace-read.o trace-split.o trace-listen.o \
trace-stack.o trace-hist.o trace-mem.o trace-snapshot.o
TRACE_VIEW_OBJS = trace-view.o trace-view-store.o
TRACE_GRAPH_OBJS = trace-graph.o trace-plot.o trace-plot-cpu.o trace-plot-task.o
TRACE_VIEW_MAIN_OBJS = trace-view-main.o $(TRACE_VIEW_OBJS) $(TRACE_GUI_OBJS)
TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS)
KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \
trace-capture.o kernel-shark.o
PEVENT_LIB_OBJS = event-parse.o trace-seq.o parse-filter.o parse-utils.o
TCMD_LIB_OBJS = $(PEVENT_LIB_OBJS) trace-util.o trace-input.o trace-ftrace.o \
trace-output.o trace-recorder.o trace-restore.o trace-usage.o \
trace-blk-hack.o kbuffer-parse.o
PLUGIN_OBJS =
PLUGIN_OBJS += plugin_hrtimer.o
PLUGIN_OBJS += plugin_kmem.o
PLUGIN_OBJS += plugin_sched_switch.o
PLUGIN_OBJS += plugin_mac80211.o
PLUGIN_OBJS += plugin_jbd2.o
PLUGIN_OBJS += plugin_function.o
PLUGIN_OBJS += plugin_kvm.o
PLUGIN_OBJS += plugin_blk.o
PLUGIN_OBJS += plugin_cfg80211.o
PLUGINS := $(PLUGIN_OBJS:.o=.so)
ALL_OBJS = $(TRACE_CMD_OBJS) $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) \
$(TRACE_GRAPH_MAIN_OBJS) $(TCMD_LIB_OBJS) $(PLUGIN_OBJS)
CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h libparsevent.a $(LIB_FILE) \
trace-cmd $(PLUGINS) $(BUILD_PYTHON)
GUI_TARGETS = ks_version.h trace-graph trace-view kernelshark
TARGETS = $(CMD_TARGETS) $(GUI_TARGETS)
# cpp $(INCLUDES)
###
# Default we just build trace-cmd
#
# If you want kernelshark, then do: make gui
###
all: all_cmd show_gui_make
all_cmd: $(CMD_TARGETS)
gui: $(CMD_TARGETS)
$(Q)$(MAKE) -f $(src)/Makefile BUILDGUI=1 all_gui
all_gui: $(GUI_TARGETS) show_gui_done
GUI_OBJS = $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) $(TRACE_GRAPH_MAIN_OBJS)
gui_objs := $(sort $(GUI_OBJS))
trace-cmd: $(TRACE_CMD_OBJS)
$(Q)$(do_app_build)
kernelshark: $(KERNEL_SHARK_OBJS)
$(Q)$(G)$(do_app_build)
trace-view: $(TRACE_VIEW_MAIN_OBJS)
$(Q)$(G)$(do_app_build)
trace-graph: $(TRACE_GRAPH_MAIN_OBJS)
$(Q)$(G)$(do_app_build)
trace-cmd: libtracecmd.a
kernelshark: libtracecmd.a
trace-view: libtracecmd.a
trace-graph: libtracecmd.a
libparsevent.so: $(PEVENT_LIB_OBJS)
$(Q)$(do_compile_shared_library)
libparsevent.a: $(PEVENT_LIB_OBJS)
$(Q)$(do_build_static_lib)
$(TCMD_LIB_OBJS): %.o: $(src)/%.c
$(Q)$(do_fpic_compile)
libtracecmd.so: $(TCMD_LIB_OBJS)
$(Q)$(do_compile_shared_library)
libtracecmd.a: $(TCMD_LIB_OBJS)
$(Q)$(do_build_static_lib)
trace-util.o: trace_plugin_dir
$(PLUGIN_OBJS): %.o : $(src)/%.c
$(Q)$(do_compile_plugin_obj)
$(PLUGINS): %.so: %.o
$(Q)$(do_plugin_build)
define make_version.h
(echo '/* This file is automatically generated. Do not modify. */'; \
echo \#define VERSION_CODE $(shell \
expr $(VERSION) \* 256 + $(PATCHLEVEL)); \
echo '#define EXTRAVERSION ' $(EXTRAVERSION); \
echo '#define VERSION_STRING "'$(VERSION).$(PATCHLEVEL).$(EXTRAVERSION)'"'; \
echo '#define FILE_VERSION '$(FILE_VERSION); \
) > $1
endef
define update_version.h
($(call make_version.h, [email protected]); \
if [ -r $@ ] && cmp -s $@ [email protected]; then \
rm -f [email protected]; \
else \
echo ' UPDATE $@'; \
mv -f [email protected] $@; \
fi);
endef
ks_version.h: force
$(Q)$(G)$(call update_version.h)
tc_version.h: force
$(Q)$(N)$(call update_version.h)
define update_dir
(echo $1 > [email protected]; \
if [ -r $@ ] && cmp -s $@ [email protected]; then \
rm -f [email protected]; \
else \
echo ' UPDATE $@'; \
mv -f [email protected] $@; \
fi);
endef
trace_plugin_dir: force
$(Q)$(N)$(call update_dir, 'PLUGIN_DIR=$(PLUGIN_DIR)')
trace_python_dir: force
$(Q)$(N)$(call update_dir, 'PYTHON_DIR=$(PYTHON_DIR)')
## make deps
all_objs := $(sort $(ALL_OBJS))
all_deps := $(all_objs:%.o=.%.d)
gui_deps := $(gui_objs:%.o=.%.d)
non_gui_deps = $(filter-out $(gui_deps),$(all_deps))
define check_gui_deps
if [ ! -z "$(filter $(gui_deps),$(@))" ]; then \
if [ $(BUILDGUI) -ne 1 ]; then \
$(REBUILD_GUI); \
else \
$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@; \
fi \
elif [ $(BUILDGUI) -eq 0 ]; then \
$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@; \
else \
echo SKIPPING $@; \
fi;
endef
$(gui_deps): ks_version.h
$(non_gui_deps): tc_version.h
$(all_deps): .%.d: $(src)/%.c
$(Q)$(call check_gui_deps)
$(all_objs) : %.o : .%.d
ifeq ($(BUILDGUI), 1)
dep_includes := $(wildcard $(gui_deps))
else
dep_includes := $(wildcard $(non_gui_deps))
endif
ifneq ($(dep_includes),)
include $(dep_includes)
endif
show_gui_make:
@echo "Note: to build the gui, type \"make gui\""
@echo " to build man pages, type \"make doc\""
show_gui_done:
@echo "gui build complete"
PHONY += show_gui_make
tags: force
$(RM) tags
find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px
TAGS: force
$(RM) TAGS
find . -name '*.[ch]' | xargs etags
cscope: force
$(RM) cscope*
find . -name '*.[ch]' | cscope -b -q
PLUGINS_INSTALL = $(subst .so,.install,$(PLUGINS)) $(subst .so,.install,$(PYTHON_PLUGINS))
define do_install
$(print_install) \
if [ ! -d '$(DESTDIR_SQ)$2' ]; then \
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \
fi; \
$(INSTALL) $1 '$(DESTDIR_SQ)$2'
endef
define do_install_data
$(print_install) \
if [ ! -d '$(DESTDIR_SQ)$2' ]; then \
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \
fi; \
$(INSTALL) -m 644 $1 '$(DESTDIR_SQ)$2'
endef
$(PLUGINS_INSTALL): %.install : %.so force
$(Q)$(call do_install_data,$<,$(plugin_dir_SQ))
install_plugins: $(PLUGINS_INSTALL)
$(PYTHON_SO_INSTALL): %.install : %.so force
$(Q)$(call do_install_data,$<,$(python_dir_SQ))
$(PYTHON_PY_PROGS): %.install : %.py force
$(Q)$(call do_install,$<,$(python_dir_SQ))
$(PYTHON_PY_LIBS): %.install : %.py force
$(Q)$(call do_install_data,$<,$(python_dir_SQ))
$(PYTHON_PY_PLUGINS): %.install : %.py force
$(Q)$(call do_install_data,$<,$(plugin_dir_SQ))
install_python: $(PYTHON_SO_INSTALL) $(PYTHON_PY_PROGS) $(PYTHON_PY_LIBS) $(PYTHON_PY_PLUGINS)
install_cmd: all_cmd install_plugins install_python
$(Q)$(call do_install,trace-cmd,$(bindir_SQ))
install: install_cmd
@echo "Note: to install the gui, type \"make install_gui\""
@echo " to install man pages, type \"make install_doc\""
install_gui: install_cmd gui
$(Q)$(call do_install,trace-view,$(bindir_SQ))
$(Q)$(call do_install,trace-graph,$(bindir_SQ))
$(Q)$(call do_install,kernelshark,$(bindir_SQ))
doc:
$(MAKE) -C $(src)/Documentation all
doc_clean:
$(MAKE) -C $(src)/Documentation clean
install_doc:
$(MAKE) -C $(src)/Documentation install
clean:
$(RM) *.o *~ $(TARGETS) *.a *.so ctracecmd_wrap.c .*.d
$(RM) tags TAGS cscope*
##### PYTHON STUFF #####
PYTHON_INCLUDES = `pkg-config --cflags $(PYTHON_VERS)`
PYTHON_LDFLAGS = `pkg-config --libs $(PYTHON_VERS)` \
$(shell python -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LINKFORSHARED')")
PYGTK_CFLAGS = `pkg-config --cflags pygtk-2.0`
ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i
swig -Wall -python -noproxy ctracecmd.i
$(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c
$(CC) --shared $(TCMD_LIB_OBJS) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so
ctracecmdgui.so: $(TRACE_VIEW_OBJS) $(LIB_FILE)
swig -Wall -python -noproxy ctracecmdgui.i
$(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c
$(CC) --shared $^ $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so
PHONY += python
python: $(PYTHON)
PHONY += python-gui
python-gui: $(PYTHON_GUI)
PHONY += python-plugin
python-plugin: $(PYTHON_PLUGINS)
CFLAGS_plugin_python.o += $(PYTHON_DIR_SQ)
do_compile_python_plugin_obj = \
($(print_plugin_obj_compile) \
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$@) $(PYTHON_INCLUDES) -fPIC -o $@ $<)
do_python_plugin_build = \
($(print_plugin_build) \
$(CC) $< -shared $(LDFLAGS) $(PYTHON_LDFLAGS) -o $@)
plugin_python.o: %.o : $(src)/%.c trace_python_dir
$(Q)$(do_compile_python_plugin_obj)
plugin_python.so: %.so: %.o
$(Q)$(do_python_plugin_build)
endif # skip-makefile
dist:
git archive --format=tar --prefix=trace-cmd-$(TRACECMD_VERSION)/ HEAD \
> ../trace-cmd-$(TRACECMD_VERSION).tar
cat ../trace-cmd-$(TRACECMD_VERSION).tar | \
bzip2 -c9 > ../trace-cmd-$(TRACECMD_VERSION).tar.bz2
cat ../trace-cmd-$(TRACECMD_VERSION).tar | \
xz -e -c8 > ../trace-cmd-$(TRACECMD_VERSION).tar.xz
PHONY += force
force:
# Declare the contents of the .PHONY variable as phony. We keep that
# information in a variable so we can use it in if_changed and friends.
.PHONY: $(PHONY)