aboutsummaryrefslogtreecommitdiff
path: root/tools/verification/rv/Makefile
blob: 411d62b3d8eb93abf85526ad33cafd783df86bc1 (plain) (blame)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# SPDX-License-Identifier: GPL-2.0-only

ifeq ($(srctree),)
  srctree	:= $(patsubst %/,%,$(dir $(CURDIR)))
  srctree	:= $(patsubst %/,%,$(dir $(srctree)))
  srctree	:= $(patsubst %/,%,$(dir $(srctree)))
endif

include $(srctree)/tools/scripts/Makefile.include

# O is an alias for OUTPUT
OUTPUT          := $(O)

ifeq ($(OUTPUT),)
  OUTPUT       := $(CURDIR)/
else
  # subdir is used by the ../Makefile in $(call descend,)
  ifneq ($(subdir),)
    OUTPUT        := $(OUTPUT)/$(subdir)
  endif
endif

ifneq ($(patsubst %/,,$(lastword $(OUTPUT))),)
  OUTPUT := $(OUTPUT)/
endif

RV		:= $(OUTPUT)rv
RV_IN		:= $(RV)-in.o

VERSION		:= $(shell sh -c "make -sC ../../.. kernelversion | grep -v make")
DOCSRC		:= ../../../Documentation/tools/rv/

FEATURE_TESTS	:= libtraceevent
FEATURE_TESTS	+= libtracefs
FEATURE_DISPLAY	:= libtraceevent
FEATURE_DISPLAY	+= libtracefs

ifeq ($(V),1)
  Q		=
else
  Q		= @
endif

all: $(RV)

include $(srctree)/tools/build/Makefile.include
include Makefile.rv

# check for dependencies only on required targets
NON_CONFIG_TARGETS := clean install doc doc_clean doc_install

config		:= 1
ifdef MAKECMDGOALS
  ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
  config	:= 0
endif
endif

ifeq ($(config),1)
  include $(srctree)/tools/build/Makefile.feature
  include Makefile.config
endif

CFLAGS		+= $(INCLUDES) $(LIB_INCLUDES)

export CFLAGS OUTPUT srctree

$(RV): $(RV_IN)
	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RV) $(RV_IN) $(EXTLIBS)

static: $(RV_IN)
	$(eval LDFLAGS += -static)
	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RV)-static $(RV_IN) $(EXTLIBS)

rv.%: fixdep FORCE
	make -f $(srctree)/tools/build/Makefile.build dir=. $@

$(RV_IN): fixdep FORCE
	make $(build)=rv

clean: doc_clean fixdep-clean
	$(call QUIET_CLEAN, rv)
	$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
	$(Q)rm -f rv rv-static fixdep FEATURE-DUMP rv-*
	$(Q)rm -rf feature

.PHONY: FORCE clean