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