summaryrefslogtreecommitdiffstats
path: root/src/Makefile
blob: e2965bc5e1e962140676ed73b3155d7ef71a7e5c (plain)
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
# SPDX-License-Identifier: LGPL-2.1

include $(src)/scripts/utils.mk

OBJS =
OBJS += tracefs-utils.o
OBJS += tracefs-instance.o
OBJS += tracefs-events.o
OBJS += tracefs-tools.o
OBJS += tracefs-marker.o
OBJS += tracefs-kprobes.o
OBJS += tracefs-hist.o
OBJS += tracefs-filter.o
OBJS += tracefs-dynevents.o
OBJS += tracefs-eprobes.o
OBJS += tracefs-uprobes.o
OBJS += tracefs-record.o

# Order matters for the the three below
OBJS += sqlhist-lex.o
OBJS += sqlhist.tab.o
OBJS += tracefs-sqlhist.o

OBJS := $(OBJS:%.o=$(bdir)/%.o)

$(LIBTRACEFS_STATIC): $(OBJS)
	$(Q)$(call do_build_static_lib)

$(LIBTRACEFS_SHARED): $(OBJS)
	$(Q)$(call do_compile_shared_library,$(notdir $(LIBTRACEFS_SHARED_VERSION)))

$(LIBTRACEFS_SHARED_VERSION): $(LIBTRACEFS_SHARED)
	@ln -sf $(<F) $@

$(LIBTRACEFS_SHARED_SO): $(LIBTRACEFS_SHARED_VERSION)
	@ln -sf $(<F) $@

libtracefs.so: $(LIBTRACEFS_SHARED_SO)

# bison will create both sqlhist.tab.c and sqlhist.tab.h
sqlhist.tab.h:
sqlhist.tab.c: sqlhist.y sqlhist.tab.h
	bison --debug -v --report-file=bison.report -d -o $@ $<

sqlhist-lex.c: sqlhist.l sqlhist.tab.c
	flex -o $@ $<

$(bdir)/%.o: %.c
	$(Q)$(call do_fpic_compile)

tracefs-sqlhist.o: sqlhist.tab.h

$(OBJS): | $(bdir)

clean:
	$(Q)$(call do_clean,$(OBJS) .*.d)

-include .*.d

$(bdir)/tracefs-sqlhist.o tracefs-sqlhist.o: sqlhist.tab.h

.PHONY: $(LIBTRACEFS_SHARED_SO) $(LIBTRACEFS_STATIC)