Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1# SPDX-License-Identifier: GPL-2.0-only
2
3ifeq ($(srctree),)
4 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
5 srctree := $(patsubst %/,%,$(dir $(srctree)))
6 srctree := $(patsubst %/,%,$(dir $(srctree)))
7endif
8
9include $(srctree)/tools/scripts/Makefile.include
10
11# O is an alias for OUTPUT
12OUTPUT := $(O)
13
14ifeq ($(OUTPUT),)
15 OUTPUT := $(CURDIR)/
16else
17 # subdir is used by the ../Makefile in $(call descend,)
18 ifneq ($(subdir),)
19 OUTPUT := $(OUTPUT)/$(subdir)
20 endif
21endif
22
23ifneq ($(patsubst %/,,$(lastword $(OUTPUT))),)
24 OUTPUT := $(OUTPUT)/
25endif
26
27RV := $(OUTPUT)rv
28RV_IN := $(RV)-in.o
29
30VERSION := $(shell sh -c "make -sC ../../.. kernelversion | grep -v make")
31DOCSRC := ../../../Documentation/tools/rv/
32
33FEATURE_TESTS := libtraceevent
34FEATURE_TESTS += libtracefs
35FEATURE_DISPLAY := libtraceevent
36FEATURE_DISPLAY += libtracefs
37
38all: $(RV)
39
40include $(srctree)/tools/build/Makefile.include
41include Makefile.rv
42
43# check for dependencies only on required targets
44NON_CONFIG_TARGETS := clean install doc doc_clean doc_install
45
46config := 1
47ifdef MAKECMDGOALS
48 ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
49 config := 0
50endif
51endif
52
53ifeq ($(config),1)
54 include $(srctree)/tools/build/Makefile.feature
55 include Makefile.config
56endif
57
58CFLAGS += $(INCLUDES) $(LIB_INCLUDES)
59
60export CFLAGS OUTPUT srctree
61
62$(RV): $(RV_IN)
63 $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RV) $(RV_IN) $(EXTLIBS)
64
65static: $(RV_IN)
66 $(eval LDFLAGS += -static)
67 $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RV)-static $(RV_IN) $(EXTLIBS)
68
69rv.%: fixdep FORCE
70 make -f $(srctree)/tools/build/Makefile.build dir=. $@
71
72$(RV_IN): fixdep FORCE
73 make $(build)=rv
74
75clean: doc_clean fixdep-clean
76 $(call QUIET_CLEAN, rv)
77 $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
78 $(Q)rm -f rv rv-static fixdep FEATURE-DUMP rv-*
79 $(Q)rm -rf feature
80
81.PHONY: FORCE clean