Makefile 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # SPDX-License-Identifier: GPL-2.0
  2. #
  3. # Makefile for the linux kernel.
  4. #
  5. ccflags-y := -fno-function-sections -fno-data-sections
  6. obj-y := main.o version.o mounts.o
  7. ifneq ($(CONFIG_BLK_DEV_INITRD),y)
  8. obj-y += noinitramfs.o
  9. else
  10. obj-$(CONFIG_BLK_DEV_INITRD) += initramfs.o
  11. endif
  12. obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o
  13. obj-y += init_task.o
  14. mounts-y := do_mounts.o
  15. mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o
  16. mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o
  17. #
  18. # UTS_VERSION
  19. #
  20. smp-flag-$(CONFIG_SMP) := SMP
  21. preempt-flag-$(CONFIG_PREEMPT_BUILD) := PREEMPT
  22. preempt-flag-$(CONFIG_PREEMPT_DYNAMIC) := PREEMPT_DYNAMIC
  23. preempt-flag-$(CONFIG_PREEMPT_RT) := PREEMPT_RT
  24. build-version = $(or $(KBUILD_BUILD_VERSION), $(build-version-auto))
  25. build-timestamp = $(or $(KBUILD_BUILD_TIMESTAMP), $(build-timestamp-auto))
  26. # Maximum length of UTS_VERSION is 64 chars
  27. filechk_uts_version = \
  28. utsver=$$(echo '$(pound)'"$(build-version)" $(smp-flag-y) $(preempt-flag-y) "$(build-timestamp)" | cut -b -64); \
  29. echo '$(pound)'define UTS_VERSION \""$${utsver}"\"
  30. #
  31. # Build version.c with temporary UTS_VERSION
  32. #
  33. $(obj)/utsversion-tmp.h: FORCE
  34. $(call filechk,uts_version)
  35. clean-files += utsversion-tmp.h
  36. $(obj)/version.o: $(obj)/utsversion-tmp.h
  37. CFLAGS_version.o := -include $(obj)/utsversion-tmp.h
  38. #
  39. # Build version-timestamp.c with final UTS_VERSION
  40. #
  41. include/generated/utsversion.h: build-version-auto = $(shell $(srctree)/scripts/build-version)
  42. include/generated/utsversion.h: build-timestamp-auto = $(shell LC_ALL=C date)
  43. include/generated/utsversion.h: FORCE
  44. $(call filechk,uts_version)
  45. $(obj)/version-timestamp.o: include/generated/utsversion.h
  46. CFLAGS_version-timestamp.o := -include include/generated/utsversion.h