Makefile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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-$(CONFIG_INITRAMFS_TEST) += initramfs_test.o
  14. obj-y += init_task.o
  15. mounts-y := do_mounts.o
  16. mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o
  17. mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o
  18. #
  19. # UTS_VERSION
  20. #
  21. smp-flag-$(CONFIG_SMP) := SMP
  22. preempt-flag-$(CONFIG_PREEMPT_BUILD) := PREEMPT
  23. preempt-flag-$(CONFIG_PREEMPT_DYNAMIC) := PREEMPT_DYNAMIC
  24. preempt-flag-$(CONFIG_PREEMPT_RT) := PREEMPT_RT
  25. build-version = $(or $(KBUILD_BUILD_VERSION), $(build-version-auto))
  26. build-timestamp = $(or $(KBUILD_BUILD_TIMESTAMP), $(build-timestamp-auto))
  27. # Maximum length of UTS_VERSION is 64 chars
  28. filechk_uts_version = \
  29. utsver=$$(echo '$(pound)'"$(build-version)" $(smp-flag-y) $(preempt-flag-y) "$(build-timestamp)" | cut -b -64); \
  30. echo '$(pound)'define UTS_VERSION \""$${utsver}"\"
  31. #
  32. # Build version.c with temporary UTS_VERSION
  33. #
  34. $(obj)/utsversion-tmp.h: FORCE
  35. $(call filechk,uts_version)
  36. clean-files += utsversion-tmp.h
  37. $(obj)/version.o: $(obj)/utsversion-tmp.h
  38. CFLAGS_version.o := -include $(obj)/utsversion-tmp.h
  39. #
  40. # Build version-timestamp.c with final UTS_VERSION
  41. #
  42. include/generated/utsversion.h: build-version-auto = $(shell $(srctree)/scripts/build-version)
  43. include/generated/utsversion.h: build-timestamp-auto = $(shell LC_ALL=C date)
  44. include/generated/utsversion.h: FORCE
  45. $(call filechk,uts_version)
  46. $(obj)/version-timestamp.o: include/generated/utsversion.h
  47. CFLAGS_version-timestamp.o := -include include/generated/utsversion.h