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 25EXAMPLES += guest 26EXAMPLES += cpu-buf 27EXAMPLES += instances-stat 28EXAMPLES += instances-subbuf 29EXAMPLES += cpu-map 30 31TARGETS := 32TARGETS += sqlhist 33TARGETS += $(EXAMPLES) 34 35sdir := $(obj)/bin 36 37TARGETS := $(patsubst %,$(sdir)/%,$(TARGETS)) 38 39all: $(TARGETS) 40 41$(bdir)/sqlhist.c: $(src)/Documentation/libtracefs-sql.txt 42 $(call extract_example,$<,$@) 43 44$(bdir)/%.c: ../Documentation/libtracefs-%.txt 45 $(call extract_example,$<,$@) 46 47$(sdir): 48 @mkdir -p $(sdir) 49 50sqlhist: $(sdir)/sqlhist 51 52$(TARGETS): $(sdir) 53 54# sqlhist is unique and stands on its own 55$(sdir)/sqlhist: $(bdir)/sqlhist.c $(LIBTRACEFS_STATIC) 56 $(call do_sample_build,$@,$<) 57 58$(sdir)/%: $(bdir)/%.o 59 $(call do_sample_build,$@,$<) 60 61$(EXAMPLES): $(patsubst %,$(sdir)/%,$(TARGETS)) 62 63## The intermediate files get removed by Make. 64## To examine the .c files created by one of the man pages, 65## uncomment the below, and replace the XX with the exec example 66## name, and the file will not be discarded by make. 67# 68# $(bdir)/XX.o: $(bdir)/XX.c 69# $(CC) -g -Wall $(CFLAGS) -c -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES) 70$(bdir)/cpu-map.o: $(bdir)/cpu-map.c 71 $(CC) -g -Wall $(CFLAGS) -c -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES) 72$(bdir)/kprobes.o: $(bdir)/kprobes.c 73 $(CC) -g -Wall $(CFLAGS) -c -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES) 74 75$(bdir)/%.o: $(bdir)/%.c 76 $(call do_sample_obj,$@,$^) 77 78$(bdir)/XX.o: $(bdir)/hist.c 79 $(CC) -g -Wall $(CFLAGS) -c -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES) 80 81clean: 82 $(Q)$(call do_clean,$(sdir)/* $(bdir)/sqlhist.c $(bdir)/sqlhist.o) 83 84.PHONY: sqlhist 85