1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 21da177e4SLinus Torvalds# 31da177e4SLinus Torvalds# Makefile for the linux kernel. 41da177e4SLinus Torvalds# 51da177e4SLinus Torvalds 6b67067f1SNicholas Pigginccflags-y := -fno-function-sections -fno-data-sections 7b67067f1SNicholas Piggin 8c33df4eaSJean-Paul Samanobj-y := main.o version.o mounts.o 9c33df4eaSJean-Paul Samanifneq ($(CONFIG_BLK_DEV_INITRD),y) 10c33df4eaSJean-Paul Samanobj-y += noinitramfs.o 11c33df4eaSJean-Paul Samanelse 12c33df4eaSJean-Paul Samanobj-$(CONFIG_BLK_DEV_INITRD) += initramfs.o 13c33df4eaSJean-Paul Samanendif 141da177e4SLinus Torvaldsobj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o 15a6359d1eSThomas Gleixner 16a6359d1eSThomas Gleixnerobj-y += init_task.o 171da177e4SLinus Torvalds 181da177e4SLinus Torvaldsmounts-y := do_mounts.o 191da177e4SLinus Torvaldsmounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o 201da177e4SLinus Torvaldsmounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o 211da177e4SLinus Torvalds 222df8220cSMasahiro Yamada# 232df8220cSMasahiro Yamada# UTS_VERSION 242df8220cSMasahiro Yamada# 251da177e4SLinus Torvalds 262df8220cSMasahiro Yamadasmp-flag-$(CONFIG_SMP) := SMP 272df8220cSMasahiro Yamadapreempt-flag-$(CONFIG_PREEMPT_BUILD) := PREEMPT 282df8220cSMasahiro Yamadapreempt-flag-$(CONFIG_PREEMPT_DYNAMIC) := PREEMPT_DYNAMIC 292df8220cSMasahiro Yamadapreempt-flag-$(CONFIG_PREEMPT_RT) := PREEMPT_RT 303eb3c740SRoman Zippel 312df8220cSMasahiro Yamadabuild-version = $(or $(KBUILD_BUILD_VERSION), $(build-version-auto)) 322df8220cSMasahiro Yamadabuild-timestamp = $(or $(KBUILD_BUILD_TIMESTAMP), $(build-timestamp-auto)) 332df8220cSMasahiro Yamada 342df8220cSMasahiro Yamada# Maximum length of UTS_VERSION is 64 chars 352df8220cSMasahiro Yamadafilechk_uts_version = \ 362df8220cSMasahiro Yamada utsver=$$(echo '$(pound)'"$(build-version)" $(smp-flag-y) $(preempt-flag-y) "$(build-timestamp)" | cut -b -64); \ 372df8220cSMasahiro Yamada echo '$(pound)'define UTS_VERSION \""$${utsver}"\" 382df8220cSMasahiro Yamada 392df8220cSMasahiro Yamada# 402df8220cSMasahiro Yamada# Build version.c with temporary UTS_VERSION 412df8220cSMasahiro Yamada# 422df8220cSMasahiro Yamada 432df8220cSMasahiro Yamada$(obj)/utsversion-tmp.h: FORCE 442df8220cSMasahiro Yamada $(call filechk,uts_version) 452df8220cSMasahiro Yamada 462df8220cSMasahiro Yamadaclean-files += utsversion-tmp.h 472df8220cSMasahiro Yamada 48*a55f283eSMasahiro Yamada$(obj)/version.o: $(obj)/utsversion-tmp.h 492df8220cSMasahiro YamadaCFLAGS_version.o := -include $(obj)/utsversion-tmp.h 502df8220cSMasahiro Yamada 512df8220cSMasahiro Yamada# 522df8220cSMasahiro Yamada# Build version-timestamp.c with final UTS_VERSION 532df8220cSMasahiro Yamada# 542df8220cSMasahiro Yamada 552df8220cSMasahiro Yamadainclude/generated/utsversion.h: build-version-auto = $(shell $(srctree)/$(src)/build-version) 562df8220cSMasahiro Yamadainclude/generated/utsversion.h: build-timestamp-auto = $(shell LC_ALL=C date) 572df8220cSMasahiro Yamadainclude/generated/utsversion.h: FORCE 582df8220cSMasahiro Yamada $(call filechk,uts_version) 592df8220cSMasahiro Yamada 602df8220cSMasahiro Yamada$(obj)/version-timestamp.o: include/generated/utsversion.h 612df8220cSMasahiro YamadaCFLAGS_version-timestamp.o := -include include/generated/utsversion.h 62