Makefile 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. RTLA := $(OUTPUT)rtla
  22. RTLA_IN := $(RTLA)-in.o
  23. VERSION := $(shell sh -c "make -sC ../../.. kernelversion | grep -v make")
  24. DOCSRC := ../../../Documentation/tools/rtla/
  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: $(RTLA)
  35. include $(srctree)/tools/build/Makefile.include
  36. include Makefile.rtla
  37. # check for dependencies only on required targets
  38. NON_CONFIG_TARGETS := clean install tarball 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. $(RTLA): $(RTLA_IN)
  52. $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RTLA) $(RTLA_IN) $(EXTLIBS)
  53. static: $(RTLA_IN)
  54. $(eval LDFLAGS += -static)
  55. $(QUIET_LINK)$(CC) -static $(LDFLAGS) -o $(RTLA)-static $(RTLA_IN) $(EXTLIBS)
  56. rtla.%: fixdep FORCE
  57. make -f $(srctree)/tools/build/Makefile.build dir=. $@
  58. $(RTLA_IN): fixdep FORCE
  59. make $(build)=rtla
  60. clean: doc_clean fixdep-clean
  61. $(call QUIET_CLEAN, rtla)
  62. $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
  63. $(Q)rm -f rtla rtla-static fixdep FEATURE-DUMP rtla-*
  64. $(Q)rm -rf feature
  65. .PHONY: FORCE clean