@@ -18,7 +18,7 @@ This document describes the Linux kernel Makefiles.
18
18
--- 3.7 Compilation flags
19
19
--- 3.8 <deleted>
20
20
--- 3.9 Dependency tracking
21
- --- 3.10 Special Rules
21
+ --- 3.10 Custom Rules
22
22
--- 3.11 $(CC) support functions
23
23
--- 3.12 $(LD) support functions
24
24
--- 3.13 Script Invocation
@@ -46,7 +46,7 @@ This document describes the Linux kernel Makefiles.
46
46
--- 7.5 Architecture-specific boot images
47
47
--- 7.6 Building non-kbuild targets
48
48
--- 7.7 Commands useful for building a boot image
49
- --- 7.8 Custom kbuild commands
49
+ --- 7.8 <deleted>
50
50
--- 7.9 Preprocessing linker scripts
51
51
--- 7.10 Generic header files
52
52
--- 7.11 Post-link pass
@@ -422,21 +422,21 @@ more details, with real examples.
422
422
Thus, if you change an option to $(CC) all affected files will
423
423
be re-compiled.
424
424
425
- 3.10 Special Rules
425
+ 3.10 Custom Rules
426
426
------------------
427
427
428
- Special rules are used when the kbuild infrastructure does
428
+ Custom rules are used when the kbuild infrastructure does
429
429
not provide the required support. A typical example is
430
430
header files generated during the build process.
431
431
Another example are the architecture-specific Makefiles which
432
- need special rules to prepare boot images etc.
432
+ need custom rules to prepare boot images etc.
433
433
434
- Special rules are written as normal Make rules.
434
+ Custom rules are written as normal Make rules.
435
435
Kbuild is not executing in the directory where the Makefile is
436
- located, so all special rules shall provide a relative
436
+ located, so all custom rules shall use a relative
437
437
path to prerequisite files and target files.
438
438
439
- Two variables are used when defining special rules:
439
+ Two variables are used when defining custom rules:
440
440
441
441
$(src)
442
442
$(src) is a relative path which points to the directory
@@ -454,7 +454,7 @@ more details, with real examples.
454
454
$(obj)/53c8xx_d.h: $(src)/53c7,8xx.scr $(src)/script_asm.pl
455
455
$(CPP) -DCHIP=810 - < $< | ... $(src)/script_asm.pl
456
456
457
- This is a special rule, following the normal syntax
457
+ This is a custom rule, following the normal syntax
458
458
required by make.
459
459
460
460
The target file depends on two prerequisite files. References
@@ -471,11 +471,33 @@ more details, with real examples.
471
471
472
472
Example::
473
473
474
- #arch/blackfin/boot /Makefile
475
- $(obj)/vmImage: $(obj)/ vmlinux.gz
476
- $(call if_changed,uimage)
477
- @$(kecho) 'Kernel: $@ is ready'
474
+ # arch/arm /Makefile
475
+ $(BOOT_TARGETS): vmlinux
476
+ $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
477
+ @$(kecho) ' Kernel: $(boot)/ $@ is ready'
478
478
479
+ When kbuild is executing with KBUILD_VERBOSE=0, then only a shorthand
480
+ of a command is normally displayed.
481
+ To enable this behaviour for custom commands kbuild requires
482
+ two variables to be set::
483
+
484
+ quiet_cmd_<command> - what shall be echoed
485
+ cmd_<command> - the command to execute
486
+
487
+ Example::
488
+
489
+ # lib/Makefile
490
+ quiet_cmd_crc32 = GEN $@
491
+ cmd_crc32 = $< > $@
492
+
493
+ $(obj)/crc32table.h: $(obj)/gen_crc32table
494
+ $(call cmd,crc32)
495
+
496
+ When updating the $(obj)/crc32table.h target, the line:
497
+
498
+ GEN lib/crc32table.h
499
+
500
+ will be displayed with "make KBUILD_VERBOSE=0".
479
501
480
502
3.11 $(CC) support functions
481
503
----------------------------
@@ -744,7 +766,7 @@ Both possibilities are described in the following.
744
766
as a prerequisite.
745
767
This is possible in two ways:
746
768
747
- (1) List the prerequisite explicitly in a special rule.
769
+ (1) List the prerequisite explicitly in a custom rule.
748
770
749
771
Example::
750
772
@@ -755,11 +777,11 @@ Both possibilities are described in the following.
755
777
756
778
The target $(obj)/devlist.h will not be built before
757
779
$(obj)/gen-devlist is updated. Note that references to
758
- the host programs in special rules must be prefixed with $(obj).
780
+ the host programs in custom rules must be prefixed with $(obj).
759
781
760
782
(2) Use always-y
761
783
762
- When there is no suitable special rule, and the host program
784
+ When there is no suitable custom rule, and the host program
763
785
shall be built when a makefile is entered, the always-y
764
786
variable shall be used.
765
787
@@ -1281,8 +1303,8 @@ When kbuild executes, the following steps are followed (roughly):
1281
1303
otherwise the command line check will fail, and the target will
1282
1304
always be built.
1283
1305
Assignments to $(targets) are without $(obj)/ prefix.
1284
- if_changed may be used in conjunction with custom commands as
1285
- defined in 7.8 " Custom kbuild commands ".
1306
+ if_changed may be used in conjunction with custom rules as
1307
+ defined in "3.10 Custom Rules ".
1286
1308
1287
1309
Note: It is a typical mistake to forget the FORCE prerequisite.
1288
1310
Another common pitfall is that whitespace is sometimes
@@ -1362,36 +1384,6 @@ When kbuild executes, the following steps are followed (roughly):
1362
1384
targets += $(dtb-y)
1363
1385
DTC_FLAGS ?= -p 1024
1364
1386
1365
- 7.8 Custom kbuild commands
1366
- --------------------------
1367
-
1368
- When kbuild is executing with KBUILD_VERBOSE=0, then only a shorthand
1369
- of a command is normally displayed.
1370
- To enable this behaviour for custom commands kbuild requires
1371
- two variables to be set::
1372
-
1373
- quiet_cmd_<command> - what shall be echoed
1374
- cmd_<command> - the command to execute
1375
-
1376
- Example::
1377
-
1378
- #
1379
- quiet_cmd_image = BUILD $@
1380
- cmd_image = $(obj)/tools/build $(BUILDFLAGS) \
1381
- $(obj)/vmlinux.bin > $@
1382
-
1383
- targets += bzImage
1384
- $(obj)/bzImage: $(obj)/vmlinux.bin $(obj)/tools/build FORCE
1385
- $(call if_changed,image)
1386
- @echo 'Kernel: $@ is ready'
1387
-
1388
- When updating the $(obj)/bzImage target, the line:
1389
-
1390
- BUILD arch/x86/boot/bzImage
1391
-
1392
- will be displayed with "make KBUILD_VERBOSE=0".
1393
-
1394
-
1395
1387
7.9 Preprocessing linker scripts
1396
1388
--------------------------------
1397
1389
0 commit comments