diff options
Diffstat (limited to 'Documentation/kbuild/makefiles.txt')
-rw-r--r-- | Documentation/kbuild/makefiles.txt | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 5d145bb443c0..47435e56c5da 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -40,11 +40,13 @@ This document describes the Linux kernel Makefiles. | |||
40 | --- 6.6 Commands useful for building a boot image | 40 | --- 6.6 Commands useful for building a boot image |
41 | --- 6.7 Custom kbuild commands | 41 | --- 6.7 Custom kbuild commands |
42 | --- 6.8 Preprocessing linker scripts | 42 | --- 6.8 Preprocessing linker scripts |
43 | --- 6.9 Generic header files | ||
43 | 44 | ||
44 | === 7 Kbuild syntax for exported headers | 45 | === 7 Kbuild syntax for exported headers |
45 | --- 7.1 header-y | 46 | --- 7.1 header-y |
46 | --- 7.2 objhdr-y | 47 | --- 7.2 objhdr-y |
47 | --- 7.3 destination-y | 48 | --- 7.3 destination-y |
49 | --- 7.4 generic-y | ||
48 | 50 | ||
49 | === 8 Kbuild Variables | 51 | === 8 Kbuild Variables |
50 | === 9 Makefile language | 52 | === 9 Makefile language |
@@ -499,6 +501,18 @@ more details, with real examples. | |||
499 | gcc >= 3.00. For gcc < 3.00, -malign-functions=4 is used. | 501 | gcc >= 3.00. For gcc < 3.00, -malign-functions=4 is used. |
500 | Note: cc-option-align uses KBUILD_CFLAGS for $(CC) options | 502 | Note: cc-option-align uses KBUILD_CFLAGS for $(CC) options |
501 | 503 | ||
504 | cc-disable-warning | ||
505 | cc-disable-warning checks if gcc supports a given warning and returns | ||
506 | the commandline switch to disable it. This special function is needed, | ||
507 | because gcc 4.4 and later accept any unknown -Wno-* option and only | ||
508 | warn about it if there is another warning in the source file. | ||
509 | |||
510 | Example: | ||
511 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) | ||
512 | |||
513 | In the above example, -Wno-unused-but-set-variable will be added to | ||
514 | KBUILD_CFLAGS only if gcc really accepts it. | ||
515 | |||
502 | cc-version | 516 | cc-version |
503 | cc-version returns a numerical version of the $(CC) compiler version. | 517 | cc-version returns a numerical version of the $(CC) compiler version. |
504 | The format is <major><minor> where both are two digits. So for example | 518 | The format is <major><minor> where both are two digits. So for example |
@@ -955,6 +969,11 @@ When kbuild executes, the following steps are followed (roughly): | |||
955 | used when linking modules. This is often a linker script. | 969 | used when linking modules. This is often a linker script. |
956 | From commandline LDFLAGS_MODULE shall be used (see kbuild.txt). | 970 | From commandline LDFLAGS_MODULE shall be used (see kbuild.txt). |
957 | 971 | ||
972 | KBUILD_ARFLAGS Options for $(AR) when creating archives | ||
973 | |||
974 | $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic | ||
975 | mode) if this option is supported by $(AR). | ||
976 | |||
958 | --- 6.2 Add prerequisites to archprepare: | 977 | --- 6.2 Add prerequisites to archprepare: |
959 | 978 | ||
960 | The archprepare: rule is used to list prerequisites that need to be | 979 | The archprepare: rule is used to list prerequisites that need to be |
@@ -1209,6 +1228,14 @@ When kbuild executes, the following steps are followed (roughly): | |||
1209 | The kbuild infrastructure for *lds file are used in several | 1228 | The kbuild infrastructure for *lds file are used in several |
1210 | architecture-specific files. | 1229 | architecture-specific files. |
1211 | 1230 | ||
1231 | --- 6.9 Generic header files | ||
1232 | |||
1233 | The directory include/asm-generic contains the header files | ||
1234 | that may be shared between individual architectures. | ||
1235 | The recommended approach how to use a generic header file is | ||
1236 | to list the file in the Kbuild file. | ||
1237 | See "7.4 generic-y" for further info on syntax etc. | ||
1238 | |||
1212 | === 7 Kbuild syntax for exported headers | 1239 | === 7 Kbuild syntax for exported headers |
1213 | 1240 | ||
1214 | The kernel include a set of headers that is exported to userspace. | 1241 | The kernel include a set of headers that is exported to userspace. |
@@ -1265,6 +1292,32 @@ See subsequent chapter for the syntax of the Kbuild file. | |||
1265 | In the example above all exported headers in the Kbuild file | 1292 | In the example above all exported headers in the Kbuild file |
1266 | will be located in the directory "include/linux" when exported. | 1293 | will be located in the directory "include/linux" when exported. |
1267 | 1294 | ||
1295 | --- 7.4 generic-y | ||
1296 | |||
1297 | If an architecture uses a verbatim copy of a header from | ||
1298 | include/asm-generic then this is listed in the file | ||
1299 | arch/$(ARCH)/include/asm/Kbuild like this: | ||
1300 | |||
1301 | Example: | ||
1302 | #arch/x86/include/asm/Kbuild | ||
1303 | generic-y += termios.h | ||
1304 | generic-y += rtc.h | ||
1305 | |||
1306 | During the prepare phase of the build a wrapper include | ||
1307 | file is generated in the directory: | ||
1308 | |||
1309 | arch/$(ARCH)/include/generated/asm | ||
1310 | |||
1311 | When a header is exported where the architecture uses | ||
1312 | the generic header a similar wrapper is generated as part | ||
1313 | of the set of exported headers in the directory: | ||
1314 | |||
1315 | usr/include/asm | ||
1316 | |||
1317 | The generated wrapper will in both cases look like the following: | ||
1318 | |||
1319 | Example: termios.h | ||
1320 | #include <asm-generic/termios.h> | ||
1268 | 1321 | ||
1269 | === 8 Kbuild Variables | 1322 | === 8 Kbuild Variables |
1270 | 1323 | ||