Makefile 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. ifeq ($(V),1)
  30. Q =
  31. else
  32. Q = @
  33. endif
  34. all: $(RV)
  35. include $(srctree)/tools/build/Makefile.include
  36. include Makefile.rv
  37. # check for dependencies only on required targets
  38. NON_CONFIG_TARGETS := clean install doc doc_clean doc_install
  39. config := 1
  40. ifdef MAKECMDGOALS
  41. ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
  42. config := 0
  43. endif
  44. endif
  45. ifeq ($(config),1)
  46. include $(srctree)/tools/build/Makefile.feature
  47. include Makefile.config
  48. endif
  49. CFLAGS += $(INCLUDES) $(LIB_INCLUDES)
  50. export CFLAGS OUTPUT srctree
  51. $(RV): $(RV_IN)
  52. $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RV) $(RV_IN) $(EXTLIBS)
  53. static: $(RV_IN)
  54. $(eval LDFLAGS += -static)
  55. $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RV)-static $(RV_IN) $(EXTLIBS)
  56. rv.%: fixdep FORCE
  57. make -f $(srctree)/tools/build/Makefile.build dir=. $@
  58. $(RV_IN): fixdep FORCE
  59. make $(build)=rv
  60. clean: doc_clean fixdep-clean
  61. $(call QUIET_CLEAN, rv)
  62. $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
  63. $(Q)rm -f rv rv-static fixdep FEATURE-DUMP rv-*
  64. $(Q)rm -rf feature
  65. .PHONY: FORCE clean