Messages in this thread Patch in this message | | | From | Masahiro Yamada <> | Date | Fri, 2 Sep 2022 18:41:01 +0900 | Subject | Re: [PATCH 05/15] kbuild: build init/built-in.a just once |
| |
On Sun, Aug 28, 2022 at 11:40 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> --- a/init/Makefile > +++ b/init/Makefile > @@ -19,20 +19,47 @@ mounts-y := do_mounts.o > mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o > mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o > > -# dependencies on generated files need to be listed explicitly > -$(obj)/version.o: include/generated/compile.h > +# > +# UTS_VERSION > +# > + > +smp-flag-$(CONFIG_SMP) := SMP > +preempt-flag-$(CONFIG_PREEMPT_BUILD) := PREEMPT > +preempt-flag-$(CONFIG_PREEMPT_DYNAMIC) := PREEMPT_DYNAMIC > +preempt-flag-$(CONFIG_PREEMPT_RT) := PREEMPT_RT > + > +build-version = $(or $(KBUILD_BUILD_VERSION), $(build-version-auto)) > +build-timestamp = $(or $(KBUILD_BUILD_TIMESTAMP), $(build-timestamp-auto)) > + > +# Maximum length of UTS_VERSION is 64 chars > +filechk_uts_version = \ > + utsver=$$(echo '$(pound)'"$(build-version)" $(smp-flag-y) $(preempt-flag-y) "$(build-timestamp)" | cut -b -64); \ > + echo '$(pound)'define UTS_VERSION \""$${utsver}"\" > + > +# > +# Build version.c with temporary UTS_VERSION > +# > + > +$(obj)/utsversion-tmp.h: FORCE > + $(call filechk,uts_version)
I missed to clean up init/utsversion-tmp.h.
I patched like follows, and also added it to init/.gitignore.
diff --git a/init/Makefile b/init/Makefile index 63f53d210cad..ba90eb817185 100644 --- a/init/Makefile +++ b/init/Makefile @@ -43,6 +43,8 @@ filechk_uts_version = \ $(obj)/utsversion-tmp.h: FORCE $(call filechk,uts_version)
+clean-files += utsversion-tmp.h + $(obj)/version.o: include/generated/compile.h $(obj)/utsversion-tmp.h CFLAGS_version.o := -include $(obj)/utsversion-tmp.h
-- Best Regards Masahiro Yamada
| |