xref: /OK3568_Linux_fs/buildroot/docs/manual/make-tips.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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.
39
40.Cleaning:
41
42Explicit cleaning is required when any of the architecture or toolchain
43configuration options are changed.
44
45To delete all build products (including build directories, host, staging
46and target trees, the images and the toolchain):
47
48--------------------
49 $ make clean
50--------------------
51
52.Generating the manual:
53
54The present manual sources are located in the 'docs/manual' directory.
55To generate the manual:
56
57---------------------------------
58 $ make manual-clean
59 $ make manual
60---------------------------------
61
62The manual outputs will be generated in 'output/docs/manual'.
63
64.Notes
65- A few tools are required to build the documentation (see:
66  xref:requirement-optional[]).
67
68.Resetting Buildroot for a new target:
69
70To delete all build products as well as the configuration:
71
72--------------------
73 $ make distclean
74--------------------
75
76.Notes
77If +ccache+ is enabled, running +make clean+ or +distclean+ does
78not empty the compiler cache used by Buildroot. To delete it, refer
79to xref:ccache[].
80
81.Dumping the internal make variables:
82
83One can dump the variables known to make, along with their values:
84
85----
86 $ make -s printvars VARS='VARIABLE1 VARIABLE2'
87 VARIABLE1=value_of_variable
88 VARIABLE2=value_of_variable
89----
90
91It is possible to tweak the output using some variables:
92
93- +VARS+ will limit the listing to variables which names match the
94  specified make-patterns - this must be set else nothing is printed
95- +QUOTED_VARS+, if set to +YES+, will single-quote the value
96- +RAW_VARS+, if set to +YES+, will print the unexpanded value
97
98For example:
99
100----
101 $ make -s printvars VARS=BUSYBOX_%DEPENDENCIES
102 BUSYBOX_DEPENDENCIES=skeleton toolchain
103 BUSYBOX_FINAL_ALL_DEPENDENCIES=skeleton toolchain
104 BUSYBOX_FINAL_DEPENDENCIES=skeleton toolchain
105 BUSYBOX_FINAL_PATCH_DEPENDENCIES=
106 BUSYBOX_RDEPENDENCIES=ncurses util-linux
107----
108
109----
110 $ make -s printvars VARS=BUSYBOX_%DEPENDENCIES QUOTED_VARS=YES
111 BUSYBOX_DEPENDENCIES='skeleton toolchain'
112 BUSYBOX_FINAL_ALL_DEPENDENCIES='skeleton toolchain'
113 BUSYBOX_FINAL_DEPENDENCIES='skeleton toolchain'
114 BUSYBOX_FINAL_PATCH_DEPENDENCIES=''
115 BUSYBOX_RDEPENDENCIES='ncurses util-linux'
116----
117
118----
119 $ make -s printvars VARS=BUSYBOX_%DEPENDENCIES RAW_VARS=YES
120 BUSYBOX_DEPENDENCIES=skeleton toolchain
121 BUSYBOX_FINAL_ALL_DEPENDENCIES=$(sort $(BUSYBOX_FINAL_DEPENDENCIES) $(BUSYBOX_FINAL_PATCH_DEPENDENCIES))
122 BUSYBOX_FINAL_DEPENDENCIES=$(sort $(BUSYBOX_DEPENDENCIES))
123 BUSYBOX_FINAL_PATCH_DEPENDENCIES=$(sort $(BUSYBOX_PATCH_DEPENDENCIES))
124 BUSYBOX_RDEPENDENCIES=ncurses util-linux
125----
126
127The output of quoted variables can be reused in shell scripts, for example:
128
129----
130 $ eval $(make -s printvars VARS=BUSYBOX_DEPENDENCIES QUOTED_VARS=YES)
131 $ echo $BUSYBOX_DEPENDENCIES
132 skeleton toolchain
133----
134