@@ -28,7 +28,6 @@ This document describes the Linux kernel Makefiles.
2828 --- 4.3 Using C++ for host programs
2929 --- 4.4 Controlling compiler options for host programs
3030 --- 4.5 When host programs are actually built
31- --- 4.6 Using hostprogs-$(CONFIG_FOO)
3231
3332 === 5 Kbuild clean infrastructure
3433
@@ -595,11 +594,11 @@ compilation stage.
595594Two steps are required in order to use a host executable.
596595
597596The first step is to tell kbuild that a host program exists. This is
598- done utilising the variable hostprogs-y .
597+ done utilising the variable " hostprogs" .
599598
600599The second step is to add an explicit dependency to the executable.
601600This can be done in two ways. Either add the dependency in a rule,
602- or utilise the variable $( always) .
601+ or utilise the variable " always-y" .
603602Both possibilities are described in the following.
604603
6056044.1 Simple Host Program
@@ -612,7 +611,7 @@ Both possibilities are described in the following.
612611
613612 Example::
614613
615- hostprogs-y := bin2hex
614+ hostprogs := bin2hex
616615
617616 Kbuild assumes in the above example that bin2hex is made from a single
618617 c-source file named bin2hex.c located in the same directory as
@@ -630,7 +629,7 @@ Both possibilities are described in the following.
630629 Example::
631630
632631 #scripts/lxdialog/Makefile
633- hostprogs-y := lxdialog
632+ hostprogs := lxdialog
634633 lxdialog-objs := checklist.o lxdialog.o
635634
636635 Objects with extension .o are compiled from the corresponding .c
@@ -650,7 +649,7 @@ Both possibilities are described in the following.
650649 Example::
651650
652651 #scripts/kconfig/Makefile
653- hostprogs-y := qconf
652+ hostprogs := qconf
654653 qconf-cxxobjs := qconf.o
655654
656655 In the example above the executable is composed of the C++ file
@@ -662,7 +661,7 @@ Both possibilities are described in the following.
662661 Example::
663662
664663 #scripts/kconfig/Makefile
665- hostprogs-y := qconf
664+ hostprogs := qconf
666665 qconf-cxxobjs := qconf.o
667666 qconf-objs := check.o
668667
@@ -710,55 +709,39 @@ Both possibilities are described in the following.
710709 Example::
711710
712711 #drivers/pci/Makefile
713- hostprogs-y := gen-devlist
712+ hostprogs := gen-devlist
714713 $(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist
715714 ( cd $(obj); ./gen-devlist ) < $<
716715
717716 The target $(obj)/devlist.h will not be built before
718717 $(obj)/gen-devlist is updated. Note that references to
719718 the host programs in special rules must be prefixed with $(obj).
720719
721- (2) Use $( always)
720+ (2) Use always-y
722721
723722 When there is no suitable special rule, and the host program
724- shall be built when a makefile is entered, the $( always)
723+ shall be built when a makefile is entered, the always-y
725724 variable shall be used.
726725
727726 Example::
728727
729728 #scripts/lxdialog/Makefile
730- hostprogs-y := lxdialog
731- always := $(hostprogs-y )
729+ hostprogs := lxdialog
730+ always-y := $(hostprogs)
732731
733732 This will tell kbuild to build lxdialog even if not referenced in
734733 any rule.
735734
736- 4.6 Using hostprogs-$(CONFIG_FOO)
737- ---------------------------------
738-
739- A typical pattern in a Kbuild file looks like this:
740-
741- Example::
742-
743- #scripts/Makefile
744- hostprogs-$(CONFIG_KALLSYMS) += kallsyms
745-
746- Kbuild knows about both 'y' for built-in and 'm' for module.
747- So if a config symbol evaluates to 'm', kbuild will still build
748- the binary. In other words, Kbuild handles hostprogs-m exactly
749- like hostprogs-y. But only hostprogs-y is recommended to be used
750- when no CONFIG symbols are involved.
751-
7527355 Kbuild clean infrastructure
753736=============================
754737
755738"make clean" deletes most generated files in the obj tree where the kernel
756739is compiled. This includes generated files such as host programs.
757- Kbuild knows targets listed in $(hostprogs-y ), $(hostprogs-m ), $(always),
758- $(extra-y) and $(targets). They are all deleted during "make clean".
759- Files matching the patterns "*.[oas]", " *.ko", plus some additional files
760- generated by kbuild are deleted all over the kernel src tree when
761- "make clean" is executed.
740+ Kbuild knows targets listed in $(hostprogs), $(always-y ), $(always-m ),
741+ $(always-), $( extra-y), $(extra-) and $(targets). They are all deleted
742+ during "make clean". Files matching the patterns "*.[oas]", " *.ko", plus
743+ some additional files generated by kbuild are deleted all over the kernel
744+ source tree when "make clean" is executed.
762745
763746Additional files or directories can be specified in kbuild makefiles by use of
764747$(clean-files).
@@ -1269,12 +1252,12 @@ When kbuild executes, the following steps are followed (roughly):
12691252 Example::
12701253
12711254 #arch/x86/kernel/Makefile
1272- always := vmlinux.lds
1255+ extra-y := vmlinux.lds
12731256
12741257 #Makefile
12751258 export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
12761259
1277- The assignment to $(always) is used to tell kbuild to build the
1260+ The assignment to extra-y is used to tell kbuild to build the
12781261 target vmlinux.lds.
12791262 The assignment to $(CPPFLAGS_vmlinux.lds) tells kbuild to use the
12801263 specified options when building the target vmlinux.lds.
0 commit comments