Makefile 1.8 KB

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