In old days, the "host-progs" syntax was used for specifying host programs. It was renamed to the current "hostprogs-y" in 2004. It is typically useful in scripts/Makefile because it allows Kbuild to selectively compile host programs based on the kernel configuration. This commit renames like follows: always -> always-y hostprogs-y -> hostprogs So, scripts/Makefile will look like this: always-$(CONFIG_BUILD_BIN2C) += ... always-$(CONFIG_KALLSYMS) += ... ... hostprogs := $(always-y) $(always-m) I think this makes more sense because a host program is always a host program, irrespective of the kernel configuration. We want to specify which ones to compile by CONFIG options, so always-y will be handier. The "always", "hostprogs-y", "hostprogs-m" will be kept for backward compatibility for a while.
Showing the changes to scripts (13 of 49 files). Show all
Unified · Split
| @@ -7,14 +7,14 @@ · 6 unmodified lines | |||
| 7 | 7 | ||
| 8 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include | 8 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include |
| 9 | 9 | ||
| 10 | hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c | 10 | always-$(CONFIG_BUILD_BIN2C) += bin2c |
| 11 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms | 11 | always-$(CONFIG_KALLSYMS) += kallsyms |
| 12 | hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount | 12 | always-$(BUILD_C_RECORDMCOUNT) += recordmcount |
| 13 | hostprogs-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable | 13 | always-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable |
| 14 | hostprogs-$(CONFIG_ASN1) += asn1_compiler | 14 | always-$(CONFIG_ASN1) += asn1_compiler |
| 15 | hostprogs-$(CONFIG_MODULE_SIG_FORMAT) += sign-file | 15 | always-$(CONFIG_MODULE_SIG_FORMAT) += sign-file |
| 16 | hostprogs-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert | 16 | always-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert |
| 17 | hostprogs-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert | 17 | always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert |
| 18 | 18 | ||
| 19 | HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include | 19 | HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include |
| 20 | HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include | 20 | HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include |
| @@ -30,10 +30,10 @@ HOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED · 9 unmodified lines | |||
| 30 | HOSTLDLIBS_sorttable = -lpthread | 30 | HOSTLDLIBS_sorttable = -lpthread |
| 31 | endif | 31 | endif |
| 32 | 32 | ||
| 33 | always := $(hostprogs-y) $(hostprogs-m) | 33 | hostprogs := $(always-y) $(always-m) |
| 34 | 34 | ||
| 35 | # The following hostprogs-y programs are only build on demand | 35 | # The following programs are only built on demand |
| 36 | hostprogs-y += unifdef | 36 | hostprogs += unifdef |
| 37 | 37 | ||
| 38 | subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins | 38 | subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins |
| 39 | subdir-$(CONFIG_MODVERSIONS) += genksyms | 39 | subdir-$(CONFIG_MODVERSIONS) += genksyms |
| @@ -16,6 +16,8 @@ obj-m := · 15 unmodified lines | |||
| 16 | lib-y := | 16 | lib-y := |
| 17 | lib-m := | 17 | lib-m := |
| 18 | always := | 18 | always := |
| 19 | always-y := | ||
| 20 | always-m := | ||
| 19 | targets := | 21 | targets := |
| 20 | subdir-y := | 22 | subdir-y := |
| 21 | subdir-m := | 23 | subdir-m := |
| @@ -44,7 +46,7 @@ include $(kbuild-file) · 22 unmodified lines | |||
| 44 | include scripts/Makefile.lib | 46 | include scripts/Makefile.lib |
| 45 | 47 | ||
| 46 | # Do not include host rules unless needed | 48 | # Do not include host rules unless needed |
| 47 | ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),) | 49 | ifneq ($(hostprogs)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),) |
| 48 | include scripts/Makefile.host | 50 | include scripts/Makefile.host |
| 49 | endif | 51 | endif |
| 50 | 52 | ||
| @@ -348,7 +350,7 @@ $(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE · 297 unmodified lines | |||
| 348 | $(call if_changed_rule,as_o_S) | 350 | $(call if_changed_rule,as_o_S) |
| 349 | 351 | ||
| 350 | targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) $(real-obj-m) $(lib-y) | 352 | targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) $(real-obj-m) $(lib-y) |
| 351 | targets += $(extra-y) $(MAKECMDGOALS) $(always) | 353 | targets += $(extra-y) $(always-y) $(MAKECMDGOALS) |
| 352 | 354 | ||
| 353 | # Linker scripts preprocessor (.lds.S -> .lds) | 355 | # Linker scripts preprocessor (.lds.S -> .lds) |
| 354 | # --------------------------------------------------------------------------- | 356 | # --------------------------------------------------------------------------- |
| @@ -490,7 +492,7 @@ else · 135 unmodified lines | |||
| 490 | 492 | ||
| 491 | __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ | 493 | __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ |
| 492 | $(if $(KBUILD_MODULES),$(obj-m) $(mod-targets) $(modorder-target)) \ | 494 | $(if $(KBUILD_MODULES),$(obj-m) $(mod-targets) $(modorder-target)) \ |
| 493 | $(subdir-ym) $(always) | 495 | $(subdir-ym) $(always-y) |
| 494 | @: | 496 | @: |
| 495 | 497 | ||
| 496 | endif | 498 | endif |
| @@ -28,8 +28,8 @@ subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) · 27 unmodified lines | |||
| 28 | # directory | 28 | # directory |
| 29 | 29 | ||
| 30 | __clean-files := $(extra-y) $(extra-m) $(extra-) \ | 30 | __clean-files := $(extra-y) $(extra-m) $(extra-) \ |
| 31 | $(always) $(targets) $(clean-files) \ | 31 | $(always) $(always-y) $(always-m) $(always-) $(targets) $(clean-files) \ |
| 32 | $(hostprogs-y) $(hostprogs-m) $(hostprogs-) \ | 32 | $(hostprogs) $(hostprogs-y) $(hostprogs-m) $(hostprogs-) \ |
| 33 | $(hostlibs-y) $(hostlibs-m) $(hostlibs-) \ | 33 | $(hostlibs-y) $(hostlibs-m) $(hostlibs-) \ |
| 34 | $(hostcxxlibs-y) $(hostcxxlibs-m) | 34 | $(hostcxxlibs-y) $(hostcxxlibs-m) |
| 35 | 35 | ||
| @@ -24,21 +24,21 @@ $(obj)/%.tab.c $(obj)/%.tab.h: $(src)/%.y FORCE · 23 unmodified lines | |||
| 24 | # Both C and C++ are supported, but preferred language is C for such utilities. | 24 | # Both C and C++ are supported, but preferred language is C for such utilities. |
| 25 | # | 25 | # |
| 26 | # Sample syntax (see Documentation/kbuild/makefiles.rst for reference) | 26 | # Sample syntax (see Documentation/kbuild/makefiles.rst for reference) |
| 27 | # hostprogs-y := bin2hex | 27 | # hostprogs := bin2hex |
| 28 | # Will compile bin2hex.c and create an executable named bin2hex | 28 | # Will compile bin2hex.c and create an executable named bin2hex |
| 29 | # | 29 | # |
| 30 | # hostprogs-y := lxdialog | 30 | # hostprogs := lxdialog |
| 31 | # lxdialog-objs := checklist.o lxdialog.o | 31 | # lxdialog-objs := checklist.o lxdialog.o |
| 32 | # Will compile lxdialog.c and checklist.c, and then link the executable | 32 | # Will compile lxdialog.c and checklist.c, and then link the executable |
| 33 | # lxdialog, based on checklist.o and lxdialog.o | 33 | # lxdialog, based on checklist.o and lxdialog.o |
| 34 | # | 34 | # |
| 35 | # hostprogs-y := qconf | 35 | # hostprogs := qconf |
| 36 | # qconf-cxxobjs := qconf.o | 36 | # qconf-cxxobjs := qconf.o |
| 37 | # qconf-objs := menu.o | 37 | # qconf-objs := menu.o |
| 38 | # Will compile qconf as a C++ program, and menu as a C program. | 38 | # Will compile qconf as a C++ program, and menu as a C program. |
| 39 | # They are linked as C++ code to the executable qconf | 39 | # They are linked as C++ code to the executable qconf |
| 40 | 40 | ||
| 41 | __hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) | 41 | __hostprogs := $(sort $(hostprogs)) |
| 42 | host-cshlib := $(sort $(hostlibs-y) $(hostlibs-m)) | 42 | host-cshlib := $(sort $(hostlibs-y) $(hostlibs-m)) |
| 43 | host-cxxshlib := $(sort $(hostcxxlibs-y) $(hostcxxlibs-m)) | 43 | host-cxxshlib := $(sort $(hostcxxlibs-y) $(hostcxxlibs-m)) |
| 44 | 44 | ||
| @@ -4,6 +4,8 @@ asflags-y += $(EXTRA_AFLAGS) · 3 unmodified lines | |||
| 4 | ccflags-y += $(EXTRA_CFLAGS) | 4 | ccflags-y += $(EXTRA_CFLAGS) |
| 5 | cppflags-y += $(EXTRA_CPPFLAGS) | 5 | cppflags-y += $(EXTRA_CPPFLAGS) |
| 6 | ldflags-y += $(EXTRA_LDFLAGS) | 6 | ldflags-y += $(EXTRA_LDFLAGS) |
| 7 | always-y += $(always) | ||
| 8 | hostprogs += $(hostprogs-y) $(hostprogs-m) | ||
| 7 | 9 | ||
| 8 | # flags that take effect in current and sub directories | 10 | # flags that take effect in current and sub directories |
| 9 | KBUILD_AFLAGS += $(subdir-asflags-y) | 11 | KBUILD_AFLAGS += $(subdir-asflags-y) |
| @@ -59,6 +61,8 @@ subdir-obj-y := $(filter %/built-in.a, $(obj-y)) · 49 unmodified lines | |||
| 59 | real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) | 61 | real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) |
| 60 | real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) | 62 | real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) |
| 61 | 63 | ||
| 64 | always-y += $(always-m) | ||
| 65 | |||
| 62 | # DTB | 66 | # DTB |
| 63 | # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built | 67 | # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built |
| 64 | extra-y += $(dtb-y) | 68 | extra-y += $(dtb-y) |
| @@ -72,7 +76,7 @@ endif · 7 unmodified lines | |||
| 72 | # Add subdir path | 76 | # Add subdir path |
| 73 | 77 | ||
| 74 | extra-y := $(addprefix $(obj)/,$(extra-y)) | 78 | extra-y := $(addprefix $(obj)/,$(extra-y)) |
| 75 | always := $(addprefix $(obj)/,$(always)) | 79 | always-y := $(addprefix $(obj)/,$(always-y)) |
| 76 | targets := $(addprefix $(obj)/,$(targets)) | 80 | targets := $(addprefix $(obj)/,$(targets)) |
| 77 | modorder := $(addprefix $(obj)/,$(modorder)) | 81 | modorder := $(addprefix $(obj)/,$(modorder)) |
| 78 | obj-m := $(addprefix $(obj)/,$(obj-m)) | 82 | obj-m := $(addprefix $(obj)/,$(obj-m)) |
| @@ -2,5 +2,5 @@ · 1 unmodified line | |||
| 2 | # | 2 | # |
| 3 | # fixdep: used to generate dependency information during build process | 3 | # fixdep: used to generate dependency information during build process |
| 4 | 4 | ||
| 5 | hostprogs-y := fixdep | 5 | hostprogs := fixdep |
| 6 | always := $(hostprogs-y) | 6 | always-y := $(hostprogs) |
| @@ -1,8 +1,8 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | # scripts/dtc makefile | 2 | # scripts/dtc makefile |
| 3 | 3 | ||
| 4 | hostprogs-$(CONFIG_DTC) := dtc | 4 | hostprogs := dtc |
| 5 | always := $(hostprogs-y) | 5 | always-$(CONFIG_DTC) := $(hostprogs) |
| 6 | 6 | ||
| 7 | dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ | 7 | dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ |
| 8 | srcpos.o checks.o util.o | 8 | srcpos.o checks.o util.o |
| @@ -23,7 +23,7 @@ $(objtree)/$(obj)/randomize_layout_seed.h: FORCE · 22 unmodified lines | |||
| 23 | targets = randomize_layout_seed.h randomize_layout_hash.h | 23 | targets = randomize_layout_seed.h randomize_layout_hash.h |
| 24 | 24 | ||
| 25 | $(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p))) | 25 | $(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p))) |
| 26 | always := $($(HOSTLIBS)-y) | 26 | always-y := $($(HOSTLIBS)-y) |
| 27 | 27 | ||
| 28 | $(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o)) | 28 | $(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o)) |
| 29 | 29 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | ||
| 3 | hostprogs-y := genksyms | 3 | hostprogs := genksyms |
| 4 | always := $(hostprogs-y) | 4 | always-y := $(hostprogs) |
| 5 | 5 | ||
| 6 | genksyms-objs := genksyms.o parse.tab.o lex.lex.o | 6 | genksyms-objs := genksyms.o parse.tab.o lex.lex.o |
| 7 | 7 | ||
| @@ -157,11 +157,11 @@ HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src) · 156 unmodified lines | |||
| 157 | HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src) | 157 | HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src) |
| 158 | 158 | ||
| 159 | # conf: Used for defconfig, oldconfig and related targets | 159 | # conf: Used for defconfig, oldconfig and related targets |
| 160 | hostprogs-y += conf | 160 | hostprogs += conf |
| 161 | conf-objs := conf.o $(common-objs) | 161 | conf-objs := conf.o $(common-objs) |
| 162 | 162 | ||
| 163 | # nconf: Used for the nconfig target based on ncurses | 163 | # nconf: Used for the nconfig target based on ncurses |
| 164 | hostprogs-y += nconf | 164 | hostprogs += nconf |
| 165 | nconf-objs := nconf.o nconf.gui.o $(common-objs) | 165 | nconf-objs := nconf.o nconf.gui.o $(common-objs) |
| 166 | 166 | ||
| 167 | HOSTLDLIBS_nconf = $(shell . $(obj)/nconf-cfg && echo $$libs) | 167 | HOSTLDLIBS_nconf = $(shell . $(obj)/nconf-cfg && echo $$libs) |
| @@ -171,7 +171,7 @@ HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/nconf-cfg && echo $$cflags) · 3 unmodified lines | |||
| 171 | $(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/nconf-cfg | 171 | $(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/nconf-cfg |
| 172 | 172 | ||
| 173 | # mconf: Used for the menuconfig target based on lxdialog | 173 | # mconf: Used for the menuconfig target based on lxdialog |
| 174 | hostprogs-y += mconf | 174 | hostprogs += mconf |
| 175 | lxdialog := $(addprefix lxdialog/, \ | 175 | lxdialog := $(addprefix lxdialog/, \ |
| 176 | checklist.o inputbox.o menubox.o textbox.o util.o yesno.o) | 176 | checklist.o inputbox.o menubox.o textbox.o util.o yesno.o) |
| 177 | mconf-objs := mconf.o $(lxdialog) $(common-objs) | 177 | mconf-objs := mconf.o $(lxdialog) $(common-objs) |
| @@ -183,7 +183,7 @@ $(foreach f, mconf.o $(lxdialog), \ · 5 unmodified lines | |||
| 183 | $(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg | 183 | $(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg |
| 184 | 184 | ||
| 185 | # qconf: Used for the xconfig target based on Qt | 185 | # qconf: Used for the xconfig target based on Qt |
| 186 | hostprogs-y += qconf | 186 | hostprogs += qconf |
| 187 | qconf-cxxobjs := qconf.o | 187 | qconf-cxxobjs := qconf.o |
| 188 | qconf-objs := images.o $(common-objs) | 188 | qconf-objs := images.o $(common-objs) |
| 189 | 189 | ||
| @@ -199,7 +199,7 @@ $(obj)/%.moc: $(src)/%.h $(obj)/qconf-cfg · 9 unmodified lines | |||
| 199 | $(call cmd,moc) | 199 | $(call cmd,moc) |
| 200 | 200 | ||
| 201 | # gconf: Used for the gconfig target based on GTK+ | 201 | # gconf: Used for the gconfig target based on GTK+ |
| 202 | hostprogs-y += gconf | 202 | hostprogs += gconf |
| 203 | gconf-objs := gconf.o images.o $(common-objs) | 203 | gconf-objs := gconf.o images.o $(common-objs) |
| 204 | 204 | ||
| 205 | HOSTLDLIBS_gconf = $(shell . $(obj)/gconf-cfg && echo $$libs) | 205 | HOSTLDLIBS_gconf = $(shell . $(obj)/gconf-cfg && echo $$libs) |
| @@ -1,8 +1,8 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | OBJECT_FILES_NON_STANDARD := y | 2 | OBJECT_FILES_NON_STANDARD := y |
| 3 | 3 | ||
| 4 | hostprogs-y := modpost mk_elfconfig | 4 | hostprogs := modpost mk_elfconfig |
| 5 | always := $(hostprogs-y) empty.o | 5 | always-y := $(hostprogs) empty.o |
| 6 | 6 | ||
| 7 | modpost-objs := modpost.o file2alias.o sumversion.o | 7 | modpost-objs := modpost.o file2alias.o sumversion.o |
| 8 | 8 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | hostprogs-y := genheaders | 2 | hostprogs := genheaders |
| 3 | HOST_EXTRACFLAGS += \ | 3 | HOST_EXTRACFLAGS += \ |
| 4 | -I$(srctree)/include/uapi -I$(srctree)/include \ | 4 | -I$(srctree)/include/uapi -I$(srctree)/include \ |
| 5 | -I$(srctree)/security/selinux/include | 5 | -I$(srctree)/security/selinux/include |
| 6 | 6 | ||
| 7 | always := $(hostprogs-y) | 7 | always-y := $(hostprogs) |
| @@ -1,8 +1,8 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | hostprogs-y := mdp | 2 | hostprogs := mdp |
| 3 | HOST_EXTRACFLAGS += \ | 3 | HOST_EXTRACFLAGS += \ |
| 4 | -I$(srctree)/include/uapi -I$(srctree)/include \ | 4 | -I$(srctree)/include/uapi -I$(srctree)/include \ |
| 5 | -I$(srctree)/security/selinux/include -I$(objtree)/include | 5 | -I$(srctree)/security/selinux/include -I$(objtree)/include |
| 6 | 6 | ||
| 7 | always := $(hostprogs-y) | 7 | always-y := $(hostprogs) |
| 8 | clean-files := policy.* file_contexts | 8 | clean-files := policy.* file_contexts |