Makefile 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. ccflags-y := -DSRCTREE='"$(srctree)"' -DOBJTREE='"$(objtree)"'
  2. # if-lt
  3. # Usage VAR := $(call if-lt, $(a), $(b))
  4. # Returns 1 if (a < b)
  5. if-lt = $(shell [ $(1) -lt $(2) ] && echo 1)
  6. ifeq ($(CONFIG_GCOV_FORMAT_3_4),y)
  7. cc-ver := 0304
  8. else ifeq ($(CONFIG_GCOV_FORMAT_4_7),y)
  9. cc-ver := 0407
  10. else
  11. # Use cc-version if available, otherwise set 0
  12. #
  13. # scripts/Kbuild.include, which contains cc-version function, is not included
  14. # during make clean "make -f scripts/Makefile.clean obj=kernel/gcov"
  15. # Meaning cc-ver is empty causing if-lt test to fail with
  16. # "/bin/sh: line 0: [: -lt: unary operator expected" error mesage.
  17. # This has no affect on the clean phase, but the error message could be
  18. # confusing/annoying. So this dummy workaround sets cc-ver to zero if cc-version
  19. # is not available. We can probably move if-lt to Kbuild.include, so it's also
  20. # not defined during clean or to include Kbuild.include in
  21. # scripts/Makefile.clean. But the following workaround seems least invasive.
  22. cc-ver := $(if $(call cc-version),$(call cc-version),0)
  23. endif
  24. obj-$(CONFIG_GCOV_KERNEL) := base.o fs.o
  25. ifeq ($(call if-lt, $(cc-ver), 0407),1)
  26. obj-$(CONFIG_GCOV_KERNEL) += gcc_3_4.o
  27. else
  28. obj-$(CONFIG_GCOV_KERNEL) += gcc_4_7.o
  29. endif