• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# SPDX-License-Identifier: LGPL-2.1
2
3#
4# The samples are pulled out of the examples used in the man pages
5# that are located in the Documentation directory.
6#
7
8include $(src)/scripts/utils.mk
9
10EXAMPLES :=
11EXAMPLES += dynevents
12EXAMPLES += kprobes
13EXAMPLES += eprobes
14EXAMPLES += uprobes
15EXAMPLES += synth
16EXAMPLES += error
17EXAMPLES += filter
18EXAMPLES += function-filter
19EXAMPLES += hist
20EXAMPLES += hist-cont
21EXAMPLES += tracer
22EXAMPLES += stream
23EXAMPLES += instances-affinity
24EXAMPLES += cpu
25
26TARGETS :=
27TARGETS += sqlhist
28TARGETS += $(EXAMPLES)
29
30sdir := $(obj)/bin
31
32TARGETS := $(patsubst %,$(sdir)/%,$(TARGETS))
33
34all: $(TARGETS)
35
36$(bdir)/sqlhist.c: $(src)/Documentation/libtracefs-sql.txt
37	$(call extract_example,$<,$@)
38
39$(bdir)/%.c: ../Documentation/libtracefs-%.txt
40	$(call extract_example,$<,$@)
41
42$(sdir):
43	@mkdir -p $(sdir)
44
45sqlhist: $(sdir)/sqlhist
46
47$(TARGETS): $(sdir)
48
49# sqlhist is unique and stands on its own
50$(sdir)/sqlhist: $(bdir)/sqlhist.c $(LIBTRACEFS_STATIC)
51	$(call do_sample_build,$@,$<)
52
53$(sdir)/%: $(bdir)/%.o
54	$(call do_sample_build,$@,$<)
55
56$(EXAMPLES): $(patsubst %,$(sdir)/%,$(TARGETS))
57
58## The intermediate files get removed by Make.
59## To examine the .c files created by one of the man pages,
60## uncomment the below, and replace the XX with the exec example
61## name, and the file will not be discarded by make.
62#
63# $(bdir)/XX.o: $(bdir)/XX.c
64#	$(CC) -g -Wall $(CFLAGS) -c -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES)
65
66$(bdir)/%.o: $(bdir)/%.c
67	$(call do_sample_obj,$@,$^)
68
69$(bdir)/XX.o: $(bdir)/hist.c
70	$(CC) -g -Wall $(CFLAGS) -c -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES)
71
72clean:
73	$(Q)$(call do_clean,$(sdir)/* $(bdir)/sqlhist.c $(bdir)/sqlhist.o)
74
75.PHONY: sqlhist
76