Lines Matching +refs:is +refs:pre +refs:merge
21 The top Makefile is responsible for building two major products: vmlinux
62 This document is aimed towards normal developers and arch developers.
76 Section `Goal definitions`_ is a quick intro; further chapters provide
92 This tells kbuild that there is one object in that directory, named
95 If foo.o shall be built as a module, the variable obj-m is used.
96 Therefore the following pattern is often used:
103 If CONFIG_FOO is neither y nor m, then the file will not be compiled
114 ``$(AR) rcSTP`` to merge these files into one built-in.a file.
115 This is a thin archive without a symbol table. It will be later
118 The order of files in $(obj-y) is significant. Duplicates in
122 Link order is significant, because certain functions
153 If a kernel module is built from several source files, you specify
196 There is also the possibility to list objects that will
215 actually recognize that there is a lib.a being built, the directory
220 Use of lib-y is normally restricted to ``lib/`` and ``arch/*/lib``.
225 A Makefile is only responsible for building objects in its own
240 If CONFIG_EXT2_FS is set to either "y" (built-in) or "m" (modular)
255 It is very likely a bug of the Makefile or of dependencies in Kconfig.
258 descending into subdirectories. It is a good fit when you know they
259 do not contain kernel-space objects at all. A typical usage is to let
270 syntax is always used for directories.
272 It is good practice to use a ``CONFIG_`` variable when assigning directory
274 corresponding ``CONFIG_`` option is neither "y" nor "m".
286 The linker script for vmlinux is located at
296 Kbuild skips extra-y when vmlinux is apparently not a final goal.
300 in the next section) is the correct syntax to use.
330 This variable is necessary because the top Makefile owns the
350 The difference is that the subdir- variants have effect for the kbuild
372 part has a literal value which specifies the file that it is for.
384 $(AFLAGS_$@) is a similar feature for source files in assembly
413 not provide the required support. A typical example is
419 Kbuild is not executing in the directory where the Makefile is
426 $(src) is the directory where the Makefile is located. Always use $(src) when
430 $(obj) is the directory where the target is saved. Always use $(obj) when
441 This is a custom rule, following the normal syntax
452 KBUILD_EXTMOD is set. This can be either a relative or an absolute path, but
453 if KBUILD_ABS_SRCTREE=1 is set, it is always an absolute path.
457 kernel, this is the same as $(srcroot).
460 $(objtree) refers to the root of the kernel object tree. It is ``.`` when
461 building the kernel, but it is different when building external modules.
464 echoing information to user in a rule is often a good practice
468 text following $(kecho) to stdout except if ``make -s`` is used.
475 @$(kecho) ' Kernel: $(boot)/$@ is ready'
477 When kbuild is executing with KBUILD_VERBOSE unset, then only a shorthand
478 of a command is normally displayed.
503 When the rule is evaluated, timestamps are compared between the target
505 prerequisites is newer than that.
508 since the last invocation. This is not supported by Make itself, so
511 if_changed is the macro used for this purpose, in the following form::
523 If the target is already listed in the recognized syntax such as
531 Note: It is a typical mistake to forget the FORCE prerequisite.
532 Another common pitfall is that whitespace is sometimes significant; for
543 unwanted results when the target is up to date and only the
552 $(CC) is usually the gcc compiler, but other alternatives are
556 as-option is used to check if $(CC) -- when used to compile
558 second option may be specified if the first option is not supported.
566 -Wa$(comma)-isa=$(isa-y) if it is supported by $(CC).
567 The second argument is optional, and if supplied will be used
568 if first argument is not supported.
577 cc-option is used to check if $(CC) supports a given option, and if
587 The second argument to cc-option is optional, and if omitted,
588 cflags-y will be assigned no value if first option is not supported.
592 cc-option-yn is used to check if $(CC) supports a given option
602 In the above example, $(biarch) is set to y if $(CC) supports the -m32
611 the commandline switch to disable it. This special function is needed, function
613 warn about it if there is another warning in the source file.
623 gcc-min-version tests if the value of $(CONFIG_GCC_VERSION) is greater than
630 In this example, cflags-y will be assigned the value -foo if $(CC) is gcc and
631 $(CONFIG_GCC_VERSION) is >= 7.1.
634 clang-min-version tests if the value of $(CONFIG_CLANG_VERSION) is greater
641 In this example, cflags-y will be assigned the value -foo if $(CC) is clang
642 and $(CONFIG_CLANG_VERSION) is >= 11.0.0.
645 cc-cross-prefix is used to check if there exists a $(CC) in path with
647 prefix$(CC) in the PATH is returned - and if no prefix$(CC) is found
648 then nothing is returned.
653 This functionality is useful for architecture Makefiles that try
657 It is recommended only to try to set CROSS_COMPILE if it is a cross
658 build (host arch is different from target arch). And if CROSS_COMPILE
659 is already set then leave it with the old value.
674 rustc-min-version tests if the value of $(CONFIG_RUSTC_VERSION) is greater
682 $(CONFIG_RUSTC_VERSION) is >= 1.85.0.
688 ld-option is used to check if $(LD) supports the supplied option.
691 The second argument is an optional option that can be used if the
692 first option is not supported by $(LD).
706 as invoking ./scripts/checkpatch.pl, it is recommended to set execute
727 The first step is to tell kbuild that a host program exists. This is
730 The second step is to add an explicit dependency to the executable.
738 In some cases there is a need to compile and run a program on the
739 computer where the build is running.
748 Kbuild assumes in the above example that bin2hex is made from a single
756 The syntax used to define composite objects for host programs is
768 files. In the above example, checklist.c is compiled to checklist.o
769 and lxdialog.c is compiled to lxdialog.o.
772 Note: The syntax <executable>-y is not permitted for host-programs.
778 introduced solely to support kconfig, and is not recommended
787 In the example above the executable is composed of the C++ file
790 If qconf is composed of a mixture of .c and .cc files, then an
804 since a Rust toolchain is not mandatory for kernel compilation,
805 it may only be used in scenarios where Rust is required to be
806 available (e.g. when ``CONFIG_RUST`` is enabled).
820 When compiling host programs, it is possible to set specific flags.
833 is used:
840 It is also possible to specify additional options to the linker.
856 This is possible in two ways:
868 $(obj)/gen-devlist is updated. Note that references to
873 When there is no suitable custom rule, and the host program
874 shall be built when a makefile is entered, the always-y
897 The syntax is quite similar. The difference is to use ``userprogs`` instead of
910 Kbuild assumes in the above example that bpf-direct is made from a
918 The syntax used to define composite objects for userspace programs is
930 files. In the above example, bpf-fancy.c is compiled to bpf-fancy.o
931 and bpf-helper.c is compiled to bpf-helper.o.
934 Note: The syntax <executable>-y is not permitted for userspace programs.
939 When compiling userspace programs, it is possible to set specific flags.
952 is used:
958 It is also possible to specify additional options to the linker.
987 $(obj)/bpfilter_umh is built before $(obj)/bpfilter_umh_blob.o
1007 is compiled. This includes generated files such as host programs.
1012 source tree when ``make clean`` is executed.
1031 is not sufficient this sometimes needs to be explicit.
1039 directory compressed/ when ``make clean`` is executed.
1041 Note 1: arch/$(SRCARCH)/Makefile cannot use ``subdir-``, because that file is
1055 arch/$(SRCARCH)/Makefile contains what is required to set up kbuild
1076 5) All object files are then linked and the resulting file vmlinux is
1093 Often specifying the emulation is sufficient.
1106 LDFLAGS_vmlinux is used to specify additional flags to pass to
1119 When $(call if_changed,objcopy) is used to translate a .o file,
1122 $(call if_changed,objcopy) is often used to generate raw binaries on
1134 In this example, the binary $(obj)/image is a binary version of
1192 is handled in ``scripts/generate_rust_target.rs``.
1203 $(KBUILD_AFLAGS_MODULE) is used to add arch-specific options that
1217 $(KBUILD_CFLAGS_MODULE) is used to add arch-specific options that
1231 $(KBUILD_RUSTFLAGS_MODULE) is used to add arch-specific options that
1239 $(KBUILD_LDFLAGS_MODULE) is used to add arch-specific options
1240 used when linking modules. This is often a linker script.
1262 The archheaders: rule is used to generate header files that
1265 It is run before ``make archprepare`` when run on the
1271 The archprepare: rule is used to list prerequisites that need to be
1274 This is usually used for header files containing assembler constants.
1291 which specify how to build the vmlinux file. Note that there is no
1293 machinery is all architecture-independent.
1327 It is common to locate any additional processing in a boot/
1334 The recommended approach is to include shortcuts in
1345 ``$(Q)$(MAKE) $(build)=<dir>`` is the recommended way to invoke
1359 When make is executed without arguments, the first goal encountered
1361 is all:.
1364 In ``make help``, the default goal is highlighted with a ``*``.
1374 When ``make`` is executed without arguments, bzImage will be built.
1383 Link target. Often, LDFLAGS_$@ is used to set specific options to ld.
1405 The ``: %: %.o`` part of the prerequisite is a shorthand that
1409 It is a common mistake to forget the ``targets :=`` assignment,
1448 When the vmlinux image is built, the linker script
1449 arch/$(SRCARCH)/kernel/vmlinux.lds is used.
1451 The script is a preprocessed variant of the file vmlinux.lds.S
1461 The assignment to extra-y is used to tell kbuild to build the
1472 Note that the full filename is used in this
1475 The kbuild infrastructure for ``*lds`` files is used in several
1484 The recommended approach how to use a generic header file is
1508 The kernel includes a set of headers that is exported to userspace.
1509 Many headers can be exported as-is but other headers require a
1510 minimal pre-processing before they are ready for user-space.
1512 The pre-processing does:
1530 no-export-headers is essentially used by include/uapi/linux/Kbuild to
1538 include/asm-generic then this is listed in the file
1548 file is generated in the directory::
1552 When a header is exported where the architecture uses
1553 the generic header a similar wrapper is generated as part
1581 mandatory-y is essentially used by include/(uapi/)asm-generic/Kbuild
1584 This works like optional generic-y. If a mandatory header is missing
1602 $(EXTRAVERSION) defines an even tinier sublevel for pre-patches
1603 or additional patches. It is usually some non-numeric string
1604 such as "-pre4", and is often blank.
1607 $(KERNELRELEASE) is a single string such as "2.4.0-pre4", suitable
1626 directories are biarch, that is, a single ``arch/*/`` directory supports
1640 installation. This variable is not defined in the Makefile but
1649 If this variable is specified, it will cause modules to be stripped
1650 after they are installed. If INSTALL_MOD_STRIP is "1", then the
1675 into the left-hand side. ``=`` is like a formula definition; it stores the
1677 time the left-hand side is used.
1679 There are some cases where ``=`` is appropriate. Usually, though, ``:=``
1680 is the right choice.