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