History

kbuild: rename hostprogs-y/always to hostprogs/always-y

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.

Masahiro Yamada committed 6 years ago

Commit 5f2fb521 parent faa7bdd49 files · +172 −190Browse files

Showing the changes to scripts (13 of 49 files). Show all

Unified · Split

13 files
  1. scripts/Makefile +11 −11
  2. scripts/Makefile.build +5 −3
  3. scripts/Makefile.clean +2 −2
  4. scripts/Makefile.host +4 −4
  5. scripts/Makefile.lib +5 −1
  6. scripts/basic/Makefile +2 −2
  7. scripts/dtc/Makefile +2 −2
  8. scripts/gcc-plugins/Makefile +1 −1
  9. scripts/genksyms/Makefile +2 −2
  10. scripts/kconfig/Makefile +5 −5
  11. scripts/mod/Makefile +2 −2
  12. scripts/selinux/genheaders/Makefile +2 −2
  13. scripts/selinux/mdp/Makefile +2 −2
scripts/Makefile+11−11
@@ -7,14 +7,14 @@ · 6 unmodified lines
7 7
8HOST_EXTRACFLAGS += -I$(srctree)/tools/include8HOST_EXTRACFLAGS += -I$(srctree)/tools/include
9 9
10hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c10always-$(CONFIG_BUILD_BIN2C) += bin2c
11hostprogs-$(CONFIG_KALLSYMS) += kallsyms11always-$(CONFIG_KALLSYMS) += kallsyms
12hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount12always-$(BUILD_C_RECORDMCOUNT) += recordmcount
13hostprogs-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable13always-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable
14hostprogs-$(CONFIG_ASN1) += asn1_compiler14always-$(CONFIG_ASN1) += asn1_compiler
15hostprogs-$(CONFIG_MODULE_SIG_FORMAT) += sign-file15always-$(CONFIG_MODULE_SIG_FORMAT) += sign-file
16hostprogs-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert16always-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert
17hostprogs-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert17always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
18 18
19HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include19HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
20HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include20HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
@@ -30,10 +30,10 @@ HOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED · 9 unmodified lines
30HOSTLDLIBS_sorttable = -lpthread30HOSTLDLIBS_sorttable = -lpthread
31endif31endif
32 32
33always := $(hostprogs-y) $(hostprogs-m)33hostprogs := $(always-y) $(always-m)
34 34
35# The following hostprogs-y programs are only build on demand35# The following programs are only built on demand
36hostprogs-y += unifdef36hostprogs += unifdef
37 37
38subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins38subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
39subdir-$(CONFIG_MODVERSIONS) += genksyms39subdir-$(CONFIG_MODVERSIONS) += genksyms
scripts/Makefile.build+5−3
@@ -16,6 +16,8 @@ obj-m := · 15 unmodified lines
16lib-y :=16lib-y :=
17lib-m :=17lib-m :=
18always :=18always :=
19always-y :=
20always-m :=
19targets :=21targets :=
20subdir-y :=22subdir-y :=
21subdir-m :=23subdir-m :=
@@ -44,7 +46,7 @@ include $(kbuild-file) · 22 unmodified lines
44include scripts/Makefile.lib46include scripts/Makefile.lib
45 47
46# Do not include host rules unless needed48# Do not include host rules unless needed
47ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),)49ifneq ($(hostprogs)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),)
48include scripts/Makefile.host50include scripts/Makefile.host
49endif51endif
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
350targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) $(real-obj-m) $(lib-y)352targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) $(real-obj-m) $(lib-y)
351targets += $(extra-y) $(MAKECMDGOALS) $(always)353targets += $(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
496endif498endif
scripts/Makefile.clean+2−2
@@ -28,8 +28,8 @@ subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) · 27 unmodified lines
28# directory28# 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
scripts/Makefile.host+4−4
@@ -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 := bin2hex27# hostprogs := bin2hex
28# Will compile bin2hex.c and create an executable named bin2hex28# Will compile bin2hex.c and create an executable named bin2hex
29#29#
30# hostprogs-y := lxdialog30# hostprogs := lxdialog
31# lxdialog-objs := checklist.o lxdialog.o31# lxdialog-objs := checklist.o lxdialog.o
32# Will compile lxdialog.c and checklist.c, and then link the executable32# Will compile lxdialog.c and checklist.c, and then link the executable
33# lxdialog, based on checklist.o and lxdialog.o33# lxdialog, based on checklist.o and lxdialog.o
34#34#
35# hostprogs-y := qconf35# hostprogs := qconf
36# qconf-cxxobjs := qconf.o36# qconf-cxxobjs := qconf.o
37# qconf-objs := menu.o37# 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 qconf39# They are linked as C++ code to the executable qconf
40 40
41__hostprogs := $(sort $(hostprogs-y) $(hostprogs-m))41__hostprogs := $(sort $(hostprogs))
42host-cshlib := $(sort $(hostlibs-y) $(hostlibs-m))42host-cshlib := $(sort $(hostlibs-y) $(hostlibs-m))
43host-cxxshlib := $(sort $(hostcxxlibs-y) $(hostcxxlibs-m))43host-cxxshlib := $(sort $(hostcxxlibs-y) $(hostcxxlibs-m))
44 44
scripts/Makefile.lib+5−1
@@ -4,6 +4,8 @@ asflags-y += $(EXTRA_AFLAGS) · 3 unmodified lines
4ccflags-y += $(EXTRA_CFLAGS)4ccflags-y += $(EXTRA_CFLAGS)
5cppflags-y += $(EXTRA_CPPFLAGS)5cppflags-y += $(EXTRA_CPPFLAGS)
6ldflags-y += $(EXTRA_LDFLAGS)6ldflags-y += $(EXTRA_LDFLAGS)
7always-y += $(always)
8hostprogs += $(hostprogs-y) $(hostprogs-m)
7 9
8# flags that take effect in current and sub directories10# flags that take effect in current and sub directories
9KBUILD_AFLAGS += $(subdir-asflags-y)11KBUILD_AFLAGS += $(subdir-asflags-y)
@@ -59,6 +61,8 @@ subdir-obj-y := $(filter %/built-in.a, $(obj-y)) · 49 unmodified lines
59real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))61real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
60real-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)))62real-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
64always-y += $(always-m)
65
62# DTB66# DTB
63# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built67# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
64extra-y += $(dtb-y)68extra-y += $(dtb-y)
@@ -72,7 +76,7 @@ endif · 7 unmodified lines
72# Add subdir path76# Add subdir path
73 77
74extra-y := $(addprefix $(obj)/,$(extra-y))78extra-y := $(addprefix $(obj)/,$(extra-y))
75always := $(addprefix $(obj)/,$(always))79always-y := $(addprefix $(obj)/,$(always-y))
76targets := $(addprefix $(obj)/,$(targets))80targets := $(addprefix $(obj)/,$(targets))
77modorder := $(addprefix $(obj)/,$(modorder))81modorder := $(addprefix $(obj)/,$(modorder))
78obj-m := $(addprefix $(obj)/,$(obj-m))82obj-m := $(addprefix $(obj)/,$(obj-m))
scripts/basic/Makefile+2−2
@@ -2,5 +2,5 @@ · 1 unmodified line
2#2#
3# fixdep: used to generate dependency information during build process3# fixdep: used to generate dependency information during build process
4 4
5hostprogs-y := fixdep5hostprogs := fixdep
6always := $(hostprogs-y)6always-y := $(hostprogs)
scripts/dtc/Makefile+2−2
@@ -1,8 +1,8 @@
1# SPDX-License-Identifier: GPL-2.01# SPDX-License-Identifier: GPL-2.0
2# scripts/dtc makefile2# scripts/dtc makefile
3 3
4hostprogs-$(CONFIG_DTC) := dtc4hostprogs := dtc
5always := $(hostprogs-y)5always-$(CONFIG_DTC) := $(hostprogs)
6 6
7dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \7dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
8 srcpos.o checks.o util.o8 srcpos.o checks.o util.o
scripts/gcc-plugins/Makefile+1−1
@@ -23,7 +23,7 @@ $(objtree)/$(obj)/randomize_layout_seed.h: FORCE · 22 unmodified lines
23targets = randomize_layout_seed.h randomize_layout_hash.h23targets = 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)))
26always := $($(HOSTLIBS)-y)26always-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
scripts/genksyms/Makefile+2−2
@@ -1,7 +1,7 @@
1# SPDX-License-Identifier: GPL-2.01# SPDX-License-Identifier: GPL-2.0
2 2
3hostprogs-y := genksyms3hostprogs := genksyms
4always := $(hostprogs-y)4always-y := $(hostprogs)
5 5
6genksyms-objs := genksyms.o parse.tab.o lex.lex.o6genksyms-objs := genksyms.o parse.tab.o lex.lex.o
7 7
scripts/kconfig/Makefile+5−5
@@ -157,11 +157,11 @@ HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src) · 156 unmodified lines
157HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src)157HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src)
158 158
159# conf: Used for defconfig, oldconfig and related targets159# conf: Used for defconfig, oldconfig and related targets
160hostprogs-y += conf160hostprogs += conf
161conf-objs := conf.o $(common-objs)161conf-objs := conf.o $(common-objs)
162 162
163# nconf: Used for the nconfig target based on ncurses163# nconf: Used for the nconfig target based on ncurses
164hostprogs-y += nconf164hostprogs += nconf
165nconf-objs := nconf.o nconf.gui.o $(common-objs)165nconf-objs := nconf.o nconf.gui.o $(common-objs)
166 166
167HOSTLDLIBS_nconf = $(shell . $(obj)/nconf-cfg && echo $$libs)167HOSTLDLIBS_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-cfg171$(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/nconf-cfg
172 172
173# mconf: Used for the menuconfig target based on lxdialog173# mconf: Used for the menuconfig target based on lxdialog
174hostprogs-y += mconf174hostprogs += mconf
175lxdialog := $(addprefix lxdialog/, \175lxdialog := $(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)
177mconf-objs := mconf.o $(lxdialog) $(common-objs)177mconf-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-cfg183$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg
184 184
185# qconf: Used for the xconfig target based on Qt185# qconf: Used for the xconfig target based on Qt
186hostprogs-y += qconf186hostprogs += qconf
187qconf-cxxobjs := qconf.o187qconf-cxxobjs := qconf.o
188qconf-objs := images.o $(common-objs)188qconf-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+
202hostprogs-y += gconf202hostprogs += gconf
203gconf-objs := gconf.o images.o $(common-objs)203gconf-objs := gconf.o images.o $(common-objs)
204 204
205HOSTLDLIBS_gconf = $(shell . $(obj)/gconf-cfg && echo $$libs)205HOSTLDLIBS_gconf = $(shell . $(obj)/gconf-cfg && echo $$libs)
scripts/mod/Makefile+2−2
@@ -1,8 +1,8 @@
1# SPDX-License-Identifier: GPL-2.01# SPDX-License-Identifier: GPL-2.0
2OBJECT_FILES_NON_STANDARD := y2OBJECT_FILES_NON_STANDARD := y
3 3
4hostprogs-y := modpost mk_elfconfig4hostprogs := modpost mk_elfconfig
5always := $(hostprogs-y) empty.o5always-y := $(hostprogs) empty.o
6 6
7modpost-objs := modpost.o file2alias.o sumversion.o7modpost-objs := modpost.o file2alias.o sumversion.o
8 8
scripts/selinux/genheaders/Makefile+2−2
@@ -1,7 +1,7 @@
1# SPDX-License-Identifier: GPL-2.01# SPDX-License-Identifier: GPL-2.0
2hostprogs-y := genheaders2hostprogs := genheaders
3HOST_EXTRACFLAGS += \3HOST_EXTRACFLAGS += \
4 -I$(srctree)/include/uapi -I$(srctree)/include \4 -I$(srctree)/include/uapi -I$(srctree)/include \
5 -I$(srctree)/security/selinux/include5 -I$(srctree)/security/selinux/include
6 6
7always := $(hostprogs-y)7always-y := $(hostprogs)
scripts/selinux/mdp/Makefile+2−2
@@ -1,8 +1,8 @@
1# SPDX-License-Identifier: GPL-2.01# SPDX-License-Identifier: GPL-2.0
2hostprogs-y := mdp2hostprogs := mdp
3HOST_EXTRACFLAGS += \3HOST_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)/include5 -I$(srctree)/security/selinux/include -I$(objtree)/include
6 6
7always := $(hostprogs-y)7always-y := $(hostprogs)
8clean-files := policy.* file_contexts8clean-files := policy.* file_contexts