diff options
-rw-r--r-- | Makefile | 27 |
1 files changed, 24 insertions, 3 deletions
@@ -7,11 +7,13 @@ LIBS = -L. -ltracecmd -ldl | |||
7 | 7 | ||
8 | PACKAGES= gtk+-2.0 | 8 | PACKAGES= gtk+-2.0 |
9 | 9 | ||
10 | ifeq ($(BUILDGUI), 1) | ||
10 | CONFIG_FLAGS = $(shell pkg-config --cflags $(PACKAGES)) \ | 11 | CONFIG_FLAGS = $(shell pkg-config --cflags $(PACKAGES)) \ |
11 | -DGTK_VERSION=$(shell pkg-config --modversion gtk+-2.0 | \ | 12 | -DGTK_VERSION=$(shell pkg-config --modversion gtk+-2.0 | \ |
12 | awk 'BEGIN{FS="."}{ a = ($$1 * (2^16)) + $$2 * (2^8) + $$3; printf ("%d", a);}') | 13 | awk 'BEGIN{FS="."}{ a = ($$1 * (2^16)) + $$2 * (2^8) + $$3; printf ("%d", a);}') |
13 | 14 | ||
14 | CONFIG_LIBS = $(shell pkg-config --libs $(PACKAGES)) | 15 | CONFIG_LIBS = $(shell pkg-config --libs $(PACKAGES)) |
16 | endif | ||
15 | 17 | ||
16 | CFLAGS = -g -Wall $(CONFIG_FLAGS) | 18 | CFLAGS = -g -Wall $(CONFIG_FLAGS) |
17 | 19 | ||
@@ -21,10 +23,22 @@ CFLAGS = -g -Wall $(CONFIG_FLAGS) | |||
21 | PLUGINS = plugin_hrtimer.so plugin_mac80211.so plugin_sched_switch.so \ | 23 | PLUGINS = plugin_hrtimer.so plugin_mac80211.so plugin_sched_switch.so \ |
22 | plugin_kmem.so | 24 | plugin_kmem.so |
23 | 25 | ||
24 | TARGETS = libparsevent.a libtracecmd.a trace-cmd $(PLUGINS) \ | 26 | CMD_TARGETS = libparsevent.a libtracecmd.a trace-cmd $(PLUGINS) |
25 | trace-graph trace-view kernelshark | ||
26 | 27 | ||
27 | all: $(TARGETS) | 28 | GUI_TARGETS = trace-graph trace-view kernelshark |
29 | |||
30 | ### | ||
31 | # Default we just build trace-cmd | ||
32 | # | ||
33 | # If you want kernelshark, then do: make gui | ||
34 | ### | ||
35 | |||
36 | all: $(CMD_TARGETS) | ||
37 | |||
38 | gui: $(CMD_TARGETS) | ||
39 | $(MAKE) BUILDGUI=1 all_gui | ||
40 | |||
41 | all_gui: $(GUI_TARGETS) | ||
28 | 42 | ||
29 | LIB_FILE = libtracecmd.a | 43 | LIB_FILE = libtracecmd.a |
30 | 44 | ||
@@ -55,9 +69,16 @@ trace-view:: trace-view-main.o $(TRACE_VIEW_OBJS) | |||
55 | trace-graph:: trace-graph-main.o trace-graph.o trace-compat.o trace-hash.o trace-filter.o | 69 | trace-graph:: trace-graph-main.o trace-graph.o trace-compat.o trace-hash.o trace-filter.o |
56 | $(CC) $^ -rdynamic -o $@ $(CONFIG_LIBS) $(LIBS) | 70 | $(CC) $^ -rdynamic -o $@ $(CONFIG_LIBS) $(LIBS) |
57 | 71 | ||
72 | ifeq ($(BUILDGUI), 1) | ||
58 | kernelshark:: kernel-shark.o trace-compat.o $(TRACE_VIEW_OBJS) trace-graph.o \ | 73 | kernelshark:: kernel-shark.o trace-compat.o $(TRACE_VIEW_OBJS) trace-graph.o \ |
59 | trace-hash.o | 74 | trace-hash.o |
60 | $(CC) $^ -rdynamic -o $@ $(CONFIG_LIBS) $(LIBS) | 75 | $(CC) $^ -rdynamic -o $@ $(CONFIG_LIBS) $(LIBS) |
76 | else | ||
77 | kernelshark: force | ||
78 | @echo '**************************************' | ||
79 | @echo '** To build kernel shark: make gui **' | ||
80 | @echo '**************************************' | ||
81 | endif | ||
61 | 82 | ||
62 | .PHONY: gtk_depends | 83 | .PHONY: gtk_depends |
63 | view_depends: | 84 | view_depends: |