88 lines · plain
1# SPDX-License-Identifier: GPL-2.0-only2 3ifeq ($(srctree),)4 srctree := $(patsubst %/,%,$(dir $(CURDIR)))5 srctree := $(patsubst %/,%,$(dir $(srctree)))6 srctree := $(patsubst %/,%,$(dir $(srctree)))7endif8 9include $(srctree)/tools/scripts/Makefile.include10 11# O is an alias for OUTPUT12OUTPUT := $(O)13 14ifeq ($(OUTPUT),)15 OUTPUT := $(CURDIR)/16else17 # subdir is used by the ../Makefile in $(call descend,)18 ifneq ($(subdir),)19 OUTPUT := $(OUTPUT)/$(subdir)20 endif21endif22 23ifneq ($(patsubst %/,,$(lastword $(OUTPUT))),)24 OUTPUT := $(OUTPUT)/25endif26 27RV := $(OUTPUT)rv28RV_IN := $(RV)-in.o29 30VERSION := $(shell sh -c "make -sC ../../.. kernelversion | grep -v make")31DOCSRC := ../../../Documentation/tools/rv/32 33FEATURE_TESTS := libtraceevent34FEATURE_TESTS += libtracefs35FEATURE_DISPLAY := libtraceevent36FEATURE_DISPLAY += libtracefs37 38ifeq ($(V),1)39 Q =40else41 Q = @42endif43 44all: $(RV)45 46include $(srctree)/tools/build/Makefile.include47include Makefile.rv48 49# check for dependencies only on required targets50NON_CONFIG_TARGETS := clean install doc doc_clean doc_install51 52config := 153ifdef MAKECMDGOALS54 ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)55 config := 056endif57endif58 59ifeq ($(config),1)60 include $(srctree)/tools/build/Makefile.feature61 include Makefile.config62endif63 64CFLAGS += $(INCLUDES) $(LIB_INCLUDES)65 66export CFLAGS OUTPUT srctree67 68$(RV): $(RV_IN)69 $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RV) $(RV_IN) $(EXTLIBS)70 71static: $(RV_IN)72 $(eval LDFLAGS += -static)73 $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RV)-static $(RV_IN) $(EXTLIBS)74 75rv.%: fixdep FORCE76 make -f $(srctree)/tools/build/Makefile.build dir=. $@77 78$(RV_IN): fixdep FORCE79 make $(build)=rv80 81clean: doc_clean fixdep-clean82 $(call QUIET_CLEAN, rv)83 $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete84 $(Q)rm -f rv rv-static fixdep FEATURE-DUMP rv-*85 $(Q)rm -rf feature86 87.PHONY: FORCE clean88