File: Makefile

package info (click to toggle)
trace-cmd 3.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,056 kB
  • sloc: ansic: 33,750; makefile: 966; sh: 762; python: 604
file content (58 lines) | stat: -rw-r--r-- 1,268 bytes parent folder | download | duplicates (2)
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
# SPDX-License-Identifier: GPL-2.0

include $(src)/scripts/utils.mk

bdir:=$(obj)/utest

TARGETS = $(bdir)/trace-utest

OBJS =
OBJS += trace-utest.o
OBJS += tracecmd-utest.o

LIBS += $(LIBTRACECMD_STATIC) -lcunit $(LIBTRACEEVENT_LDLAGS) $(LIBTRACEFS_LDLAGS)

LIBS += $(ZLIB_LDLAGS) $(LIBZSTD_LDLAGS)

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

VALGRIND = $(shell which valgrind)

$(bdir):
	@mkdir -p $(bdir)

$(OBJS): | $(bdir)
$(DEPS): | $(bdir)

$(bdir)/trace-utest: $(OBJS) $(LIBTRACECMD_STATIC)
	$(Q)$(do_app_build)

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

$(DEPS): $(bdir)/.%.d: %.c
	$(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@
	$(Q)$(CC) -M -MT $(bdir)/$*.o $(CPPFLAGS) $(CFLAGS) $< > $@

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

dep_includes := $(wildcard $(DEPS))

test: $(TARGETS)

test_mem: test
ifeq (, $(VALGRIND))
	$(error "No valgrind in $(PATH), cannot run memory test")
endif
ifneq ($(shell id -u), 0)
	$(error "The memory test should be run as root, as it reuqires full access to tracefs")
endif
	CK_FORK=no $(VALGRIND) \
		--show-leak-kinds=all --leak-resolution=high \
		--leak-check=full --show-possibly-lost=yes \
		--track-origins=yes -s \
		$(bdir)/trace-utest

clean:
	$(RM) $(TARGETS) $(bdir)/*.o $(bdir)/.*.d