• Home
  • Raw
  • Download

Lines Matching +full:top +full:- +full:level

12 	   --- 3.1 Goal definitions
13 --- 3.2 Built-in object goals - obj-y
14 --- 3.3 Loadable module goals - obj-m
15 --- 3.4 Objects which export symbols
16 --- 3.5 Library file goals - lib-y
17 --- 3.6 Descending down in directories
18 --- 3.7 Compilation flags
19 --- 3.8 Command line dependency
20 --- 3.9 Dependency tracking
21 --- 3.10 Special Rules
22 --- 3.11 $(CC) support functions
23 --- 3.12 $(LD) support functions
26 --- 4.1 Simple Host Program
27 --- 4.2 Composite Host Programs
28 --- 4.3 Using C++ for host programs
29 --- 4.4 Controlling compiler options for host programs
30 --- 4.5 When host programs are actually built
31 --- 4.6 Using hostprogs-$(CONFIG_FOO)
36 --- 6.1 Set variables to tweak the build to the architecture
37 --- 6.2 Add prerequisites to archheaders:
38 --- 6.3 Add prerequisites to archprepare:
39 --- 6.4 List directories to visit when descending
40 --- 6.5 Architecture-specific boot images
41 --- 6.6 Building non-kbuild targets
42 --- 6.7 Commands useful for building a boot image
43 --- 6.8 Custom kbuild commands
44 --- 6.9 Preprocessing linker scripts
45 --- 6.10 Generic header files
46 --- 6.11 Post-link pass
49 --- 7.1 no-export-headers
50 --- 7.2 generic-y
51 --- 7.3 generated-y
52 --- 7.4 mandatory-y
64 Makefile the top Makefile.
70 The top Makefile reads the .config file, which comes from the kernel
73 The top Makefile is responsible for building two major products: vmlinux
78 configuration. The top Makefile textually includes an arch Makefile
80 architecture-specific information to the top Makefile.
85 any built-in or modular targets.
131 --------------------
141 obj-y += foo.o
146 If foo.o shall be built as a module, the variable obj-m is used.
151 obj-$(CONFIG_FOO) += foo.o
153 $(CONFIG_FOO) evaluates to either y (for built-in) or m (for module).
157 3.2 Built-in object goals - obj-y
158 ---------------------------------
161 in the $(obj-y) lists. These lists depend on the kernel
164 Kbuild compiles all the $(obj-y) files. It then calls
165 "$(AR) rcSTP" to merge these files into one built-in.a file.
167 linked into vmlinux by scripts/link-vmlinux.sh
169 The order of files in $(obj-y) is significant. Duplicates in
171 built-in.a and succeeding instances will be ignored.
184 obj-$(CONFIG_ISDN_I4L) += isdn.o
185 obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o
187 3.3 Loadable module goals - obj-m
188 ---------------------------------
190 $(obj-m) specifies object files which are built as loadable
195 simply adds the file to $(obj-m).
200 obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o
207 module from, so you have to tell it by setting a $(<module_name>-y)
213 obj-$(CONFIG_ISDN_I4L) += isdn.o
214 isdn-y := isdn_net_lib.o isdn_v110.o isdn_common.o
217 compile the objects listed in $(isdn-y) and then run
218 "$(LD) -r" on the list of these files to generate isdn.o.
220 Due to kbuild recognizing $(<module_name>-y) for composite objects,
227 obj-$(CONFIG_EXT2_FS) += ext2.o
228 ext2-y := balloc.o dir.o file.o ialloc.o inode.o ioctl.o \
230 ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o xattr_user.o \
240 parts and then link this into built-in.a, as you would expect.
243 --------------------------------
248 3.5 Library file goals - lib-y
249 ------------------------------
251 Objects listed with obj-* are used for modules, or
252 combined in a built-in.a for that specific directory.
255 All objects listed with lib-y are combined in a single
257 Objects that are listed in obj-y and additionally listed in
258 lib-y will not be included in the library, since they will
260 For consistency, objects listed in lib-m will be included in lib.a.
262 Note that the same kbuild makefile may list files to be built-in
264 may contain both a built-in.a and a lib.a file.
269 lib-y := delay.o
273 shall be listed in libs-y.
277 Use of lib-y is normally restricted to `lib/` and `arch/*/lib`.
280 ----------------------------------
288 To do so, obj-y and obj-m are used.
295 obj-$(CONFIG_EXT2_FS) += ext2/
297 If CONFIG_EXT2_FS is set to either 'y' (built-in) or 'm' (modular)
298 the corresponding obj- variable will be set, and kbuild will descend
302 specifies what is modular and what is built-in.
309 ---------------------
311 ccflags-y, asflags-y and ldflags-y
319 ccflags-y specifies options for compiling with $(CC).
324 ccflags-y := -Os -D_LINUX -DBUILDING_ACPICA
325 ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT
327 This variable is necessary because the top Makefile owns the
331 asflags-y specifies assembler options.
336 asflags-y := -ansi
338 ldflags-y specifies options for linking with $(LD).
343 ldflags-y += -T $(srctree)/$(src)/decompress_$(arch-y).lds
345 subdir-ccflags-y, subdir-asflags-y
346 The two flags listed above are similar to ccflags-y and asflags-y.
347 The difference is that the subdir- variants have effect for the kbuild
349 Options specified using subdir-* are added to the commandline before
350 the options specified using the non-subdir variants.
354 subdir-ccflags-y := -Werror
360 $(CFLAGS_$@) specifies per-file options for $(CC). The $@
366 CFLAGS_aha152x.o = -DAHA152X_STAT -DAUTOCONF
367 CFLAGS_gdth.o = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ \
368 -DGDTH_STATISTICS
378 AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
379 AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312
380 AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt
384 -----------------------
390 3) Command-line used to compile target
393 be re-compiled.
396 ------------------
401 Another example are the architecture-specific Makefiles which
425 $(CPP) -DCHIP=810 - < $< | ... $(src)/script_asm.pl
437 but when execution "make -s" one does not expect to see any output
440 text following $(kecho) to stdout except if "make -s" is used.
451 ----------------------------
459 as-option
460 as-option is used to check if $(CC) -- when used to compile
461 assembler (`*.S`) files -- supports the given option. An optional
467 cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),)
469 In the above example, cflags-y will be assigned the option
470 -Wa$(comma)-isa=$(isa-y) if it is supported by $(CC).
474 as-instr
475 as-instr checks if the assembler reports a specific instruction
478 Note: as-instr-option uses KBUILD_AFLAGS for assembler options
480 cc-option
481 cc-option is used to check if $(CC) supports a given option, and if
487 cflags-y += $(call cc-option,-march=pentium-mmx,-march=i586)
489 In the above example, cflags-y will be assigned the option
490 -march=pentium-mmx if supported by $(CC), otherwise -march=i586.
491 The second argument to cc-option is optional, and if omitted,
492 cflags-y will be assigned no value if first option is not supported.
493 Note: cc-option uses KBUILD_CFLAGS for $(CC) options
495 cc-option-yn
496 cc-option-yn is used to check if gcc supports a given option
502 biarch := $(call cc-option-yn, -m32)
503 aflags-$(biarch) += -a32
504 cflags-$(biarch) += -m32
506 In the above example, $(biarch) is set to y if $(CC) supports the -m32
507 option. When $(biarch) equals 'y', the expanded variables $(aflags-y)
508 and $(cflags-y) will be assigned the values -a32 and -m32,
510 Note: cc-option-yn uses KBUILD_CFLAGS for $(CC) options
512 cc-disable-warning
513 cc-disable-warning checks if gcc supports a given warning and returns
515 because gcc 4.4 and later accept any unknown -Wno-* option and only
520 KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
522 In the above example, -Wno-unused-but-set-variable will be added to
525 cc-ifversion
526 cc-ifversion tests the version of $(CC) and equals the fourth parameter
533 ccflags-y := $(call cc-ifversion, -lt, 0402, -O1)
535 In this example, ccflags-y will be assigned the value -O1 if the
537 cc-ifversion takes all the shell operators:
538 -eq, -ne, -lt, -le, -gt, and -ge
542 cc-cross-prefix
543 cc-cross-prefix is used to check if there exists a $(CC) in path with
545 prefix$(CC) in the PATH is returned - and if no prefix$(CC) is found
548 call of cc-cross-prefix.
550 to set CROSS_COMPILE to well-known values but may have several
561 CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu-)
566 ----------------------------
568 ld-option
569 ld-option is used to check if $(LD) supports the supplied option.
570 ld-option takes two options as arguments.
577 LDFLAGS_vmlinux += $(call ld-option, -X)
588 done utilising the variable hostprogs-y.
596 -----------------------
605 hostprogs-y := bin2hex
608 c-source file named bin2hex.c located in the same directory as
612 ---------------------------
617 $(<executable>-objs) lists all objects used to link the final
623 hostprogs-y := lxdialog
624 lxdialog-objs := checklist.o lxdialog.o
631 Note: The syntax <executable>-y is not permitted for host-programs.
634 -------------------------------
643 hostprogs-y := qconf
644 qconf-cxxobjs := qconf.o
647 qconf.cc - identified by $(qconf-cxxobjs).
655 hostprogs-y := qconf
656 qconf-cxxobjs := qconf.o
657 qconf-objs := check.o
660 --------------------------------------------------
671 HOST_EXTRACFLAGS += -I/usr/include/ncurses
679 HOSTCFLAGS_piggyback.o := -DKERNELBASE=$(KERNELBASE)
686 HOSTLDLIBS_qconf := -L$(QTDIR)/lib
689 "-L$(QTDIR)/lib".
692 -----------------------------------------
694 Kbuild will only build host-programs when they are referenced
703 hostprogs-y := gen-devlist
704 $(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist
705 ( cd $(obj); ./gen-devlist ) < $<
708 $(obj)/gen-devlist is updated. Note that references to
720 hostprogs-y := lxdialog
721 always := $(hostprogs-y)
726 4.6 Using hostprogs-$(CONFIG_FOO)
727 ---------------------------------
734 hostprogs-$(CONFIG_KALLSYMS) += kallsyms
736 Kbuild knows about both 'y' for built-in and 'm' for module.
738 the binary. In other words, Kbuild handles hostprogs-m exactly
739 like hostprogs-y. But only hostprogs-y is recommended to be used
747 Kbuild knows targets listed in $(hostprogs-y), $(hostprogs-m), $(always),
748 $(extra-y) and $(targets). They are all deleted during "make clean".
754 $(clean-files).
759 clean-files := crc32table.h
766 $(no-clean-files) variable.
768 Usually kbuild descends down in subdirectories due to "obj-* := dir/",
775 subdir- := compressed/
791 the subdir- trick to descend further down.
793 Note 1: arch/$(ARCH)/Makefile cannot use "subdir-", because that file is
794 included in the top level makefile, and the kbuild infrastructure
797 Note 2: All directories listed in core-y, libs-y, drivers-y and net-y will
803 The top level Makefile sets up the environment and does the preparation,
805 The top level makefile contains the generic part, whereas
816 - Additional prerequisites are specified in arch/$(ARCH)/Makefile
818 init-* core* drivers-* net-* libs-* and build all targets.
819 - The values of the above variables are expanded in arch/$(ARCH)/Makefile.
822 The very first objects linked are listed in head-y, assigned by
824 6) Finally, the architecture-specific part does any required post processing
826 - This includes building boot records
827 - Preparing initrd images and the like
831 --------------------------------------------------------
842 LDFLAGS := -m elf_s390
844 Note: ldflags-y can be used to further customise
857 LDFLAGS_vmlinux := -e stext
870 OBJCOPYFLAGS := -O binary
882 Default value - see top level Makefile
888 KBUILD_AFLAGS += -m64 -mcpu=ultrasparc
893 Default value - see top level Makefile
901 cflags-$(CONFIG_X86_32) := -march=i386
902 cflags-$(CONFIG_X86_64) := -mcmodel=small
903 KBUILD_CFLAGS += $(cflags-y)
911 cflags-$(CONFIG_MPENTIUMII) += $(call cc-option,\
912 -march=pentium2,-march=i686)
914 # Disable unit-at-a-time mode ...
915 KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time)
923 Assembler options specific for built-in
931 $(KBUILD_AFLAGS_MODULE) is used to add arch-specific options that
937 $(CC) options specific for built-in
945 $(KBUILD_CFLAGS_MODULE) is used to add arch-specific options that
952 $(KBUILD_LDFLAGS_MODULE) is used to add arch-specific options
959 The linker script with full path. Assigned by the top-level Makefile.
963 The module linker script with full path. Assigned by the top-level
978 ------------------------------------
988 ------------------------------------
1001 See also chapter XXX-TODO that describe how kbuild supports
1006 ---------------------------------------------
1008 An arch Makefile cooperates with the top Makefile to define variables
1010 corresponding arch-specific section for modules; the module-building
1011 machinery is all architecture-independent.
1014 head-y, init-y, core-y, libs-y, drivers-y, net-y
1015 $(head-y) lists objects to be linked first in vmlinux.
1017 $(libs-y) lists directories where a lib.a archive can be located.
1019 The rest list directories where a built-in.a object file can be
1022 $(init-y) objects will be located after $(head-y).
1026 $(core-y), $(libs-y), $(drivers-y) and $(net-y).
1028 The top level Makefile defines values for all generic directories,
1029 and arch/$(ARCH)/Makefile only adds architecture-specific
1035 core-y += arch/sparc64/kernel/
1036 libs-y += arch/sparc64/prom/ arch/sparc64/lib/
1037 drivers-$(CONFIG_OPROFILE) += arch/sparc64/oprofile/
1040 6.5 Architecture-specific boot images
1041 -------------------------------------
1069 There are no rules for naming architecture-specific targets,
1077 echo '* bzImage - Image (arch/$(ARCH)/boot/bzImage)'
1081 will be built. In the top level Makefile the first goal present
1095 6.6 Building non-kbuild targets
1096 -------------------------------
1098 extra-y
1099 extra-y specifies additional targets created in the current
1100 directory, in addition to any targets specified by `obj-*`.
1102 Listing all targets in extra-y is required for two purposes:
1106 - When $(call if_changed,xxx) is used
1113 extra-y := head.o init_task.o
1115 In this example, extra-y is used to list object files that
1116 shall be built, but shall not be linked as part of built-in.a.
1118 header-test-y
1120 header-test-y specifies headers (`*.h`) in the current directory that
1121 should be compile tested to ensure they are self-contained,
1123 this builds them as part of extra-y.
1125 header-test-pattern-y
1127 This works as a weaker version of header-test-y, and accepts wildcard
1130 header-test-pattern-y += *.h
1133 directory, but the files in 'header-test-' are excluded.
1136 ---------------------------------------------
1183 LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
1184 LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext
1192 LDFLAGS_$@ syntax - one for each potential target.
1218 $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
1225 blob to non-init memory prior to calling unflatten_device_tree().
1227 To use this command, simply add `*.dtb` into obj-y or targets, or make
1235 targets += $(dtb-y)
1236 DTC_FLAGS ?= -p 1024
1239 --------------------------
1246 quiet_cmd_<command> - what shall be echoed
1247 cmd_<command> - the command to execute
1268 --- 6.9 Preprocessing linker scripts
1274 kbuild knows .lds files and includes a rule `*lds.S` -> `*lds`.
1282 export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
1291 KBUILD_CPPFLAGS : Set in top-level Makefile
1292 cppflags-y : May be set in the kbuild makefile
1293 CPPFLAGS_$(@F) : Target-specific flags.
1298 architecture-specific files.
1301 -------------------------
1303 The directory include/asm-generic contains the header files
1307 See "7.2 generic-y" for further info on syntax etc.
1309 6.11 Post-link pass
1310 -------------------
1313 will be invoked for post-link objects (vmlinux and modules.ko)
1314 for architectures to run post-link passes on. Must also handle
1320 .tmp_vmlinux? targets to be called from link-vmlinux.sh.
1326 ------------------------------------
1329 Many headers can be exported as-is but other headers require a
1330 minimal pre-processing before they are ready for user-space.
1331 The pre-processing does:
1333 - drop kernel-specific annotations
1334 - drop include of compiler.h
1335 - drop all sections that are kernel internal (guarded by `ifdef __KERNEL__`)
1342 arch/<arch>/include/asm/ to list asm files coming from asm-generic.
1345 7.1 no-export-headers
1346 ---------------------
1348 no-export-headers is essentially used by include/uapi/linux/Kbuild to
1352 7.2 generic-y
1353 -------------
1356 include/asm-generic then this is listed in the file
1362 generic-y += termios.h
1363 generic-y += rtc.h
1380 #include <asm-generic/termios.h>
1382 7.3 generated-y
1383 ---------------
1385 If an architecture generates other header files alongside generic-y
1386 wrappers, generated-y specifies them.
1388 This prevents them being treated as stale asm-generic wrappers and
1394 generated-y += syscalls_32.h
1396 7.4 mandatory-y
1397 ---------------
1399 mandatory-y is essentially used by include/(uapi/)asm-generic/Kbuild
1402 This works like optional generic-y. If a mandatory header is missing
1404 a wrapper of the asm-generic one.
1412 The top Makefile exports the following variables:
1420 three-part version number, such as "2", "4", and "0". These three
1423 $(EXTRAVERSION) defines an even tinier sublevel for pre-patches
1424 or additional patches. It is usually some non-numeric string
1425 such as "-pre4", and is often blank.
1428 $(KERNELRELEASE) is a single string such as "2.4.0-pre4", suitable
1437 By default, the top Makefile sets $(ARCH) to be the same as the
1447 Use this for architecture-specific install targets.
1455 The top Makefile defines $(MODLIB) to
1462 default option --strip-debug will be used. Otherwise, the
1474 GNU Make supports elementary list-processing functions. The kernel
1479 immediate evaluation of the right-hand side and stores an actual string
1480 into the left-hand side. "=" is like a formula definition; it stores the
1481 right-hand side in an unevaluated form and then evaluates this form each
1482 time the left-hand side is used.
1490 - Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net>
1491 - Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
1492 - Updates by Sam Ravnborg <sam@ravnborg.org>
1493 - Language QA by Jan Engelhardt <jengelh@gmx.de>
1498 - Describe how kbuild supports shipped files with _shipped.
1499 - Generating offset header files.
1500 - Add more variables to section 7?