1// -*- mode:doc; -*-
2// vim: set syntax=asciidoc:
3
4[[make-tips]]
5=== 'make' tips
6
7This is a collection of tips that help you make the most of Buildroot.
8
9.Display all commands executed by make:
10
11--------------------
12 $ make V=1 <target>
13--------------------
14
15.Display the list of boards with a defconfig:
16
17--------------------
18 $ make list-defconfigs
19--------------------
20
21.Display all available targets:
22
23--------------------
24 $ make help
25--------------------
26
27Not all targets are always available,
28some settings in the +.config+ file may hide some targets:
29
30* +busybox-menuconfig+ only works when +busybox+ is enabled;
31* +linux-menuconfig+ and +linux-savedefconfig+ only work when
32  +linux+ is enabled;
33* +uclibc-menuconfig+ is only available when the uClibc C library is
34  selected in the internal toolchain backend;
35* +barebox-menuconfig+ and +barebox-savedefconfig+ only work when the
36  +barebox+ bootloader is enabled.
37* +uboot-menuconfig+ and +uboot-savedefconfig+ only work when the
38  +U-Boot+ bootloader is enabled and the +uboot+ build system is set
39  to +Kconfig+.
40
41.Cleaning:
42
43Explicit cleaning is required when any of the architecture or toolchain
44configuration options are changed.
45
46To delete all build products (including build directories, host, staging
47and target trees, the images and the toolchain):
48
49--------------------
50 $ make clean
51--------------------
52
53.Generating the manual:
54
55The present manual sources are located in the 'docs/manual' directory.
56To generate the manual:
57
58---------------------------------
59 $ make manual-clean
60 $ make manual
61---------------------------------
62
63The manual outputs will be generated in 'output/docs/manual'.
64
65.Notes
66- A few tools are required to build the documentation (see:
67  xref:requirement-optional[]).
68
69.Resetting Buildroot for a new target:
70
71To delete all build products as well as the configuration:
72
73--------------------
74 $ make distclean
75--------------------
76
77.Notes
78If +ccache+ is enabled, running +make clean+ or +distclean+ does
79not empty the compiler cache used by Buildroot. To delete it, refer
80to xref:ccache[].
81
82.Dumping the internal make variables:
83
84One can dump the variables known to make, along with their values:
85
86----
87 $ make -s printvars VARS='VARIABLE1 VARIABLE2'
88 VARIABLE1=value_of_variable
89 VARIABLE2=value_of_variable
90----
91
92It is possible to tweak the output using some variables:
93
94- +VARS+ will limit the listing to variables which names match the
95  specified make-patterns - this must be set else nothing is printed
96- +QUOTED_VARS+, if set to +YES+, will single-quote the value
97- +RAW_VARS+, if set to +YES+, will print the unexpanded value
98
99For example:
100
101----
102 $ make -s printvars VARS=BUSYBOX_%DEPENDENCIES
103 BUSYBOX_DEPENDENCIES=skeleton toolchain
104 BUSYBOX_FINAL_ALL_DEPENDENCIES=skeleton toolchain
105 BUSYBOX_FINAL_DEPENDENCIES=skeleton toolchain
106 BUSYBOX_FINAL_PATCH_DEPENDENCIES=
107 BUSYBOX_RDEPENDENCIES=ncurses util-linux
108----
109
110----
111 $ make -s printvars VARS=BUSYBOX_%DEPENDENCIES QUOTED_VARS=YES
112 BUSYBOX_DEPENDENCIES='skeleton toolchain'
113 BUSYBOX_FINAL_ALL_DEPENDENCIES='skeleton toolchain'
114 BUSYBOX_FINAL_DEPENDENCIES='skeleton toolchain'
115 BUSYBOX_FINAL_PATCH_DEPENDENCIES=''
116 BUSYBOX_RDEPENDENCIES='ncurses util-linux'
117----
118
119----
120 $ make -s printvars VARS=BUSYBOX_%DEPENDENCIES RAW_VARS=YES
121 BUSYBOX_DEPENDENCIES=skeleton toolchain
122 BUSYBOX_FINAL_ALL_DEPENDENCIES=$(sort $(BUSYBOX_FINAL_DEPENDENCIES) $(BUSYBOX_FINAL_PATCH_DEPENDENCIES))
123 BUSYBOX_FINAL_DEPENDENCIES=$(sort $(BUSYBOX_DEPENDENCIES))
124 BUSYBOX_FINAL_PATCH_DEPENDENCIES=$(sort $(BUSYBOX_PATCH_DEPENDENCIES))
125 BUSYBOX_RDEPENDENCIES=ncurses util-linux
126----
127
128The output of quoted variables can be reused in shell scripts, for example:
129
130----
131 $ eval $(make -s printvars VARS=BUSYBOX_DEPENDENCIES QUOTED_VARS=YES)
132 $ echo $BUSYBOX_DEPENDENCIES
133 skeleton toolchain
134----
135