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
77
88 HOST_EXTRACFLAGS += -I$(srctree)/tools/include
99
10−hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c
11−hostprogs-$(CONFIG_KALLSYMS) += kallsyms
12−hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount
13−hostprogs-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable
14−hostprogs-$(CONFIG_ASN1) += asn1_compiler
15−hostprogs-$(CONFIG_MODULE_SIG_FORMAT) += sign-file
16−hostprogs-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert
17−hostprogs-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
10+always-$(CONFIG_BUILD_BIN2C) += bin2c
11+always-$(CONFIG_KALLSYMS) += kallsyms
12+always-$(BUILD_C_RECORDMCOUNT) += recordmcount
13+always-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable
14+always-$(CONFIG_ASN1) += asn1_compiler
15+always-$(CONFIG_MODULE_SIG_FORMAT) += sign-file
16+always-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert
17+always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
1818
1919 HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
2020 HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
@@ -30,10 +30,10 @@ HOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED · 9 unmodified lines
3030 HOSTLDLIBS_sorttable = -lpthread
3131 endif
3232
33−always := $(hostprogs-y) $(hostprogs-m)
33+hostprogs := $(always-y) $(always-m)
3434
35−# The following hostprogs-y programs are only build on demand
36−hostprogs-y += unifdef
35+# The following programs are only built on demand
36+hostprogs += unifdef
3737
3838 subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
3939 subdir-$(CONFIG_MODVERSIONS) += genksyms
scripts/Makefile.build+5−3
@@ -16,6 +16,8 @@ obj-m := · 15 unmodified lines
1616 lib-y :=
1717 lib-m :=
1818 always :=
19+always-y :=
20+always-m :=
1921 targets :=
2022 subdir-y :=
2123 subdir-m :=
@@ -44,7 +46,7 @@ include $(kbuild-file) · 22 unmodified lines
4446 include scripts/Makefile.lib
4547
4648 # 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),)
4850 include scripts/Makefile.host
4951 endif
5052
@@ -348,7 +350,7 @@ $(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE · 297 unmodified lines
348350 $(call if_changed_rule,as_o_S)
349351
350352 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)
352354
353355 # Linker scripts preprocessor (.lds.S -> .lds)
354356 # ---------------------------------------------------------------------------
@@ -490,7 +492,7 @@ else · 135 unmodified lines
490492
491493 __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \
492494 $(if $(KBUILD_MODULES),$(obj-m) $(mod-targets) $(modorder-target)) \
493− $(subdir-ym) $(always)
495+ $(subdir-ym) $(always-y)
494496 @:
495497
496498 endif
scripts/Makefile.clean+2−2
@@ -28,8 +28,8 @@ subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) · 27 unmodified lines
2828 # directory
2929
3030 __clean-files := $(extra-y) $(extra-m) $(extra-) \
31− $(always) $(targets) $(clean-files) \
32− $(hostprogs-y) $(hostprogs-m) $(hostprogs-) \
31+ $(always) $(always-y) $(always-m) $(always-) $(targets) $(clean-files) \
32+ $(hostprogs) $(hostprogs-y) $(hostprogs-m) $(hostprogs-) \
3333 $(hostlibs-y) $(hostlibs-m) $(hostlibs-) \
3434 $(hostcxxlibs-y) $(hostcxxlibs-m)
3535
scripts/Makefile.host+4−4
@@ -24,21 +24,21 @@ $(obj)/%.tab.c $(obj)/%.tab.h: $(src)/%.y FORCE · 23 unmodified lines
2424 # Both C and C++ are supported, but preferred language is C for such utilities.
2525 #
2626 # Sample syntax (see Documentation/kbuild/makefiles.rst for reference)
27−# hostprogs-y := bin2hex
27+# hostprogs := bin2hex
2828 # Will compile bin2hex.c and create an executable named bin2hex
2929 #
30−# hostprogs-y := lxdialog
30+# hostprogs := lxdialog
3131 # lxdialog-objs := checklist.o lxdialog.o
3232 # Will compile lxdialog.c and checklist.c, and then link the executable
3333 # lxdialog, based on checklist.o and lxdialog.o
3434 #
35−# hostprogs-y := qconf
35+# hostprogs := qconf
3636 # qconf-cxxobjs := qconf.o
3737 # qconf-objs := menu.o
3838 # Will compile qconf as a C++ program, and menu as a C program.
3939 # They are linked as C++ code to the executable qconf
4040
41−__hostprogs := $(sort $(hostprogs-y) $(hostprogs-m))
41+__hostprogs := $(sort $(hostprogs))
4242 host-cshlib := $(sort $(hostlibs-y) $(hostlibs-m))
4343 host-cxxshlib := $(sort $(hostcxxlibs-y) $(hostcxxlibs-m))
4444
scripts/Makefile.lib+5−1
@@ -4,6 +4,8 @@ asflags-y += $(EXTRA_AFLAGS) · 3 unmodified lines
44 ccflags-y += $(EXTRA_CFLAGS)
55 cppflags-y += $(EXTRA_CPPFLAGS)
66 ldflags-y += $(EXTRA_LDFLAGS)
7+always-y += $(always)
8+hostprogs += $(hostprogs-y) $(hostprogs-m)
79
810 # flags that take effect in current and sub directories
911 KBUILD_AFLAGS += $(subdir-asflags-y)
@@ -59,6 +61,8 @@ subdir-obj-y := $(filter %/built-in.a, $(obj-y)) · 49 unmodified lines
5961 real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
6062 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)))
6163
64+always-y += $(always-m)
65+
6266 # DTB
6367 # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
6468 extra-y += $(dtb-y)
@@ -72,7 +76,7 @@ endif · 7 unmodified lines
7276 # Add subdir path
7377
7478 extra-y := $(addprefix $(obj)/,$(extra-y))
75−always := $(addprefix $(obj)/,$(always))
79+always-y := $(addprefix $(obj)/,$(always-y))
7680 targets := $(addprefix $(obj)/,$(targets))
7781 modorder := $(addprefix $(obj)/,$(modorder))
7882 obj-m := $(addprefix $(obj)/,$(obj-m))
scripts/basic/Makefile+2−2
@@ -2,5 +2,5 @@ · 1 unmodified line
22 #
33 # fixdep: used to generate dependency information during build process
44
5−hostprogs-y := fixdep
6−always := $(hostprogs-y)
5+hostprogs := fixdep
6+always-y := $(hostprogs)
scripts/dtc/Makefile+2−2
@@ -1,8 +1,8 @@
11 # SPDX-License-Identifier: GPL-2.0
22 # scripts/dtc makefile
33
4−hostprogs-$(CONFIG_DTC) := dtc
5−always := $(hostprogs-y)
4+hostprogs := dtc
5+always-$(CONFIG_DTC) := $(hostprogs)
66
77 dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
88 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
2323 targets = randomize_layout_seed.h randomize_layout_hash.h
2424
2525 $(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p)))
26−always := $($(HOSTLIBS)-y)
26+always-y := $($(HOSTLIBS)-y)
2727
2828 $(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o))
2929
scripts/genksyms/Makefile+2−2
@@ -1,7 +1,7 @@
11 # SPDX-License-Identifier: GPL-2.0
22
3−hostprogs-y := genksyms
4−always := $(hostprogs-y)
3+hostprogs := genksyms
4+always-y := $(hostprogs)
55
66 genksyms-objs := genksyms.o parse.tab.o lex.lex.o
77
scripts/kconfig/Makefile+5−5
@@ -157,11 +157,11 @@ HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src) · 156 unmodified lines
157157 HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src)
158158
159159 # conf: Used for defconfig, oldconfig and related targets
160−hostprogs-y += conf
160+hostprogs += conf
161161 conf-objs := conf.o $(common-objs)
162162
163163 # nconf: Used for the nconfig target based on ncurses
164−hostprogs-y += nconf
164+hostprogs += nconf
165165 nconf-objs := nconf.o nconf.gui.o $(common-objs)
166166
167167 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
171171 $(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/nconf-cfg
172172
173173 # mconf: Used for the menuconfig target based on lxdialog
174−hostprogs-y += mconf
174+hostprogs += mconf
175175 lxdialog := $(addprefix lxdialog/, \
176176 checklist.o inputbox.o menubox.o textbox.o util.o yesno.o)
177177 mconf-objs := mconf.o $(lxdialog) $(common-objs)
@@ -183,7 +183,7 @@ $(foreach f, mconf.o $(lxdialog), \ · 5 unmodified lines
183183 $(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg
184184
185185 # qconf: Used for the xconfig target based on Qt
186−hostprogs-y += qconf
186+hostprogs += qconf
187187 qconf-cxxobjs := qconf.o
188188 qconf-objs := images.o $(common-objs)
189189
@@ -199,7 +199,7 @@ $(obj)/%.moc: $(src)/%.h $(obj)/qconf-cfg · 9 unmodified lines
199199 $(call cmd,moc)
200200
201201 # gconf: Used for the gconfig target based on GTK+
202−hostprogs-y += gconf
202+hostprogs += gconf
203203 gconf-objs := gconf.o images.o $(common-objs)
204204
205205 HOSTLDLIBS_gconf = $(shell . $(obj)/gconf-cfg && echo $$libs)
scripts/mod/Makefile+2−2
@@ -1,8 +1,8 @@
11 # SPDX-License-Identifier: GPL-2.0
22 OBJECT_FILES_NON_STANDARD := y
33
4−hostprogs-y := modpost mk_elfconfig
5−always := $(hostprogs-y) empty.o
4+hostprogs := modpost mk_elfconfig
5+always-y := $(hostprogs) empty.o
66
77 modpost-objs := modpost.o file2alias.o sumversion.o
88
scripts/selinux/genheaders/Makefile+2−2
@@ -1,7 +1,7 @@
11 # SPDX-License-Identifier: GPL-2.0
2−hostprogs-y := genheaders
2+hostprogs := genheaders
33 HOST_EXTRACFLAGS += \
44 -I$(srctree)/include/uapi -I$(srctree)/include \
55 -I$(srctree)/security/selinux/include
66
7−always := $(hostprogs-y)
7+always-y := $(hostprogs)
scripts/selinux/mdp/Makefile+2−2
@@ -1,8 +1,8 @@
11 # SPDX-License-Identifier: GPL-2.0
2−hostprogs-y := mdp
2+hostprogs := mdp
33 HOST_EXTRACFLAGS += \
44 -I$(srctree)/include/uapi -I$(srctree)/include \
55 -I$(srctree)/security/selinux/include -I$(objtree)/include
66
7−always := $(hostprogs-y)
7+always-y := $(hostprogs)
88 clean-files := policy.* file_contexts