xref: /openbmc/linux/init/Makefile (revision 2df8220c)
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
22*2df8220cSMasahiro Yamada#
23*2df8220cSMasahiro Yamada# UTS_VERSION
24*2df8220cSMasahiro Yamada#
251da177e4SLinus Torvalds
26*2df8220cSMasahiro Yamadasmp-flag-$(CONFIG_SMP)			:= SMP
27*2df8220cSMasahiro Yamadapreempt-flag-$(CONFIG_PREEMPT_BUILD)	:= PREEMPT
28*2df8220cSMasahiro Yamadapreempt-flag-$(CONFIG_PREEMPT_DYNAMIC)	:= PREEMPT_DYNAMIC
29*2df8220cSMasahiro Yamadapreempt-flag-$(CONFIG_PREEMPT_RT)	:= PREEMPT_RT
303eb3c740SRoman Zippel
31*2df8220cSMasahiro Yamadabuild-version = $(or $(KBUILD_BUILD_VERSION), $(build-version-auto))
32*2df8220cSMasahiro Yamadabuild-timestamp = $(or $(KBUILD_BUILD_TIMESTAMP), $(build-timestamp-auto))
33*2df8220cSMasahiro Yamada
34*2df8220cSMasahiro Yamada# Maximum length of UTS_VERSION is 64 chars
35*2df8220cSMasahiro Yamadafilechk_uts_version = \
36*2df8220cSMasahiro Yamada	utsver=$$(echo '$(pound)'"$(build-version)" $(smp-flag-y) $(preempt-flag-y) "$(build-timestamp)" | cut -b -64); \
37*2df8220cSMasahiro Yamada	echo '$(pound)'define UTS_VERSION \""$${utsver}"\"
38*2df8220cSMasahiro Yamada
39*2df8220cSMasahiro Yamada#
40*2df8220cSMasahiro Yamada# Build version.c with temporary UTS_VERSION
41*2df8220cSMasahiro Yamada#
42*2df8220cSMasahiro Yamada
43*2df8220cSMasahiro Yamada$(obj)/utsversion-tmp.h: FORCE
44*2df8220cSMasahiro Yamada	$(call filechk,uts_version)
45*2df8220cSMasahiro Yamada
46*2df8220cSMasahiro Yamadaclean-files += utsversion-tmp.h
47*2df8220cSMasahiro Yamada
48*2df8220cSMasahiro Yamada$(obj)/version.o: include/generated/compile.h $(obj)/utsversion-tmp.h
49*2df8220cSMasahiro YamadaCFLAGS_version.o := -include $(obj)/utsversion-tmp.h
50*2df8220cSMasahiro Yamada
51*2df8220cSMasahiro Yamadafilechk_compile.h = $(srctree)/scripts/mkcompile_h \
52*2df8220cSMasahiro Yamada	"$(UTS_MACHINE)" "$(CONFIG_CC_VERSION_TEXT)" "$(LD)"
5341eba23eSMasahiro Yamada
5441eba23eSMasahiro Yamadainclude/generated/compile.h: FORCE
55*2df8220cSMasahiro Yamada	$(call filechk,compile.h)
56*2df8220cSMasahiro Yamada
57*2df8220cSMasahiro Yamada#
58*2df8220cSMasahiro Yamada# Build version-timestamp.c with final UTS_VERSION
59*2df8220cSMasahiro Yamada#
60*2df8220cSMasahiro Yamada
61*2df8220cSMasahiro Yamadainclude/generated/utsversion.h: build-version-auto = $(shell $(srctree)/$(src)/build-version)
62*2df8220cSMasahiro Yamadainclude/generated/utsversion.h: build-timestamp-auto = $(shell LC_ALL=C date)
63*2df8220cSMasahiro Yamadainclude/generated/utsversion.h: FORCE
64*2df8220cSMasahiro Yamada	$(call filechk,uts_version)
65*2df8220cSMasahiro Yamada
66*2df8220cSMasahiro Yamada$(obj)/version-timestamp.o: include/generated/utsversion.h
67*2df8220cSMasahiro YamadaCFLAGS_version-timestamp.o := -include include/generated/utsversion.h
68