Makefile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # SPDX-License-Identifier: GPL-2.0
  2. ifeq ($(srctree),)
  3. srctree := $(patsubst %/,%,$(dir $(CURDIR)))
  4. srctree := $(patsubst %/,%,$(dir $(srctree)))
  5. endif
  6. include $(srctree)/tools//scripts/Makefile.include
  7. define allow-override
  8. $(if $(or $(findstring environment,$(origin $(1))),\
  9. $(findstring command line,$(origin $(1)))),,\
  10. $(eval $(1) = $(2)))
  11. endef
  12. $(call allow-override,CC,$(CROSS_COMPILE)gcc)
  13. $(call allow-override,LD,$(CROSS_COMPILE)ld)
  14. export HOSTCC HOSTLD HOSTAR
  15. ifeq ($(V),1)
  16. Q =
  17. else
  18. Q = @
  19. endif
  20. export Q srctree CC LD
  21. MAKEFLAGS := --no-print-directory
  22. build := -f $(srctree)/tools/build/Makefile.build dir=. obj
  23. all: $(OUTPUT)fixdep
  24. # Make sure there's anything to clean,
  25. # feature contains check for existing OUTPUT
  26. TMP_O := $(if $(OUTPUT),$(OUTPUT)feature/,./)
  27. clean:
  28. $(call QUIET_CLEAN, fixdep)
  29. $(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
  30. $(Q)rm -f $(OUTPUT)fixdep
  31. $(call QUIET_CLEAN, feature-detect)
  32. ifneq ($(wildcard $(TMP_O)),)
  33. $(Q)$(MAKE) -C feature OUTPUT=$(TMP_O) clean >/dev/null
  34. endif
  35. $(OUTPUT)fixdep: $(srctree)/tools/build/fixdep.c
  36. $(QUIET_CC)$(HOSTCC) $(KBUILD_HOSTCFLAGS) $(KBUILD_HOSTLDFLAGS) -o $@ $<