Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / tools / tracing / rtla / Makefile
bloba6a7dee16622d2b916de34c19b4960dafc113978
1 # SPDX-License-Identifier: GPL-2.0-only
3 ifeq ($(srctree),)
4 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
5 srctree := $(patsubst %/,%,$(dir $(srctree)))
6 srctree := $(patsubst %/,%,$(dir $(srctree)))
7 endif
9 include $(srctree)/tools/scripts/Makefile.include
11 # O is an alias for OUTPUT
12 OUTPUT := $(O)
14 ifeq ($(OUTPUT),)
15 OUTPUT := $(CURDIR)
16 else
17 # subdir is used by the ../Makefile in $(call descend,)
18 ifneq ($(subdir),)
19 OUTPUT := $(OUTPUT)/$(subdir)
20 endif
21 endif
23 ifneq ($(patsubst %/,,$(lastword $(OUTPUT))),)
24 OUTPUT := $(OUTPUT)/
25 endif
27 RTLA := $(OUTPUT)rtla
28 RTLA_IN := $(RTLA)-in.o
30 VERSION := $(shell sh -c "make -sC ../../.. kernelversion | grep -v make")
31 DOCSRC := ../../../Documentation/tools/rtla/
33 FEATURE_TESTS := libtraceevent
34 FEATURE_TESTS += libtracefs
35 FEATURE_TESTS += libcpupower
36 FEATURE_DISPLAY := libtraceevent
37 FEATURE_DISPLAY += libtracefs
38 FEATURE_DISPLAY += libcpupower
40 ifeq ($(V),1)
41 Q =
42 else
43 Q = @
44 endif
46 all: $(RTLA)
48 include $(srctree)/tools/build/Makefile.include
49 include Makefile.rtla
51 # check for dependencies only on required targets
52 NON_CONFIG_TARGETS := clean install tarball doc doc_clean doc_install
54 config := 1
55 ifdef MAKECMDGOALS
56 ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
57 config := 0
58 endif
59 endif
61 ifeq ($(config),1)
62 include $(srctree)/tools/build/Makefile.feature
63 include Makefile.config
64 endif
66 CFLAGS += $(INCLUDES) $(LIB_INCLUDES)
68 export CFLAGS OUTPUT srctree
70 $(RTLA): $(RTLA_IN)
71 $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RTLA) $(RTLA_IN) $(EXTLIBS)
73 static: $(RTLA_IN)
74 $(eval LDFLAGS += -static)
75 $(QUIET_LINK)$(CC) -static $(LDFLAGS) -o $(RTLA)-static $(RTLA_IN) $(EXTLIBS)
77 rtla.%: fixdep FORCE
78 make -f $(srctree)/tools/build/Makefile.build dir=. $@
80 $(RTLA_IN): fixdep FORCE
81 make $(build)=rtla
83 clean: doc_clean fixdep-clean
84 $(call QUIET_CLEAN, rtla)
85 $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
86 $(Q)rm -f rtla rtla-static fixdep FEATURE-DUMP rtla-*
87 $(Q)rm -rf feature
88 .PHONY: FORCE clean