diff options
Diffstat (limited to 'Documentation/kbuild/makefiles.txt')
-rw-r--r-- | Documentation/kbuild/makefiles.txt | 93 |
1 files changed, 85 insertions, 8 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 51104f9194a5..d76cfd8712e1 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -40,10 +40,16 @@ This document describes the Linux kernel Makefiles. | |||
40 | --- 6.7 Custom kbuild commands | 40 | --- 6.7 Custom kbuild commands |
41 | --- 6.8 Preprocessing linker scripts | 41 | --- 6.8 Preprocessing linker scripts |
42 | 42 | ||
43 | === 7 Kbuild Variables | 43 | === 7 Kbuild syntax for exported headers |
44 | === 8 Makefile language | 44 | --- 7.1 header-y |
45 | === 9 Credits | 45 | --- 7.2 objhdr-y |
46 | === 10 TODO | 46 | --- 7.3 destination-y |
47 | --- 7.4 unifdef-y (deprecated) | ||
48 | |||
49 | === 8 Kbuild Variables | ||
50 | === 9 Makefile language | ||
51 | === 10 Credits | ||
52 | === 11 TODO | ||
47 | 53 | ||
48 | === 1 Overview | 54 | === 1 Overview |
49 | 55 | ||
@@ -310,6 +316,16 @@ more details, with real examples. | |||
310 | #arch/m68k/fpsp040/Makefile | 316 | #arch/m68k/fpsp040/Makefile |
311 | ldflags-y := -x | 317 | ldflags-y := -x |
312 | 318 | ||
319 | subdir-ccflags-y, subdir-asflags-y | ||
320 | The two flags listed above are similar to ccflags-y and as-falgs-y. | ||
321 | The difference is that the subdir- variants has effect for the kbuild | ||
322 | file where tey are present and all subdirectories. | ||
323 | Options specified using subdir-* are added to the commandline before | ||
324 | the options specified using the non-subdir variants. | ||
325 | |||
326 | Example: | ||
327 | subdir-ccflags-y := -Werror | ||
328 | |||
313 | CFLAGS_$@, AFLAGS_$@ | 329 | CFLAGS_$@, AFLAGS_$@ |
314 | 330 | ||
315 | CFLAGS_$@ and AFLAGS_$@ only apply to commands in current | 331 | CFLAGS_$@ and AFLAGS_$@ only apply to commands in current |
@@ -1143,8 +1159,69 @@ When kbuild executes, the following steps are followed (roughly): | |||
1143 | The kbuild infrastructure for *lds file are used in several | 1159 | The kbuild infrastructure for *lds file are used in several |
1144 | architecture-specific files. | 1160 | architecture-specific files. |
1145 | 1161 | ||
1162 | === 7 Kbuild syntax for exported headers | ||
1163 | |||
1164 | The kernel include a set of headers that is exported to userspace. | ||
1165 | Many headers can be exported as-is but other headers requires a | ||
1166 | minimal pre-processing before they are ready for user-space. | ||
1167 | The pre-processing does: | ||
1168 | - drop kernel specific annotations | ||
1169 | - drop include of compiler.h | ||
1170 | - drop all sections that is kernel internat (guarded by ifdef __KERNEL__) | ||
1171 | |||
1172 | Each relevant directory contain a file name "Kbuild" which specify the | ||
1173 | headers to be exported. | ||
1174 | See subsequent chapter for the syntax of the Kbuild file. | ||
1175 | |||
1176 | --- 7.1 header-y | ||
1177 | |||
1178 | header-y specify header files to be exported. | ||
1179 | |||
1180 | Example: | ||
1181 | #include/linux/Kbuild | ||
1182 | header-y += usb/ | ||
1183 | header-y += aio_abi.h | ||
1184 | |||
1185 | The convention is to list one file per line and | ||
1186 | preferably in alphabetic order. | ||
1187 | |||
1188 | header-y also specify which subdirectories to visit. | ||
1189 | A subdirectory is identified by a trailing '/' which | ||
1190 | can be seen in the example above for the usb subdirectory. | ||
1191 | |||
1192 | Subdirectories are visited before their parent directories. | ||
1193 | |||
1194 | --- 7.2 objhdr-y | ||
1195 | |||
1196 | objhdr-y specifies generated files to be exported. | ||
1197 | Generated files are special as they need to be looked | ||
1198 | up in another directory when doing 'make O=...' builds. | ||
1199 | |||
1200 | Example: | ||
1201 | #include/linux/Kbuild | ||
1202 | objhdr-y += version.h | ||
1203 | |||
1204 | --- 7.3 destination-y | ||
1205 | |||
1206 | When an architecture have a set of exported headers that needs to be | ||
1207 | exported to a different directory destination-y is used. | ||
1208 | destination-y specify the destination directory for all exported | ||
1209 | headers in the file where it is present. | ||
1210 | |||
1211 | Example: | ||
1212 | #arch/xtensa/platforms/s6105/include/platform/Kbuild | ||
1213 | destination-y := include/linux | ||
1214 | |||
1215 | In the example above all exported headers in the Kbuild file | ||
1216 | will be located in the directory "include/linux" when exported. | ||
1217 | |||
1218 | |||
1219 | --- 7.4 unifdef-y (deprecated) | ||
1220 | |||
1221 | unifdef-y is deprecated. A direct replacement is header-y. | ||
1222 | |||
1146 | 1223 | ||
1147 | === 7 Kbuild Variables | 1224 | === 8 Kbuild Variables |
1148 | 1225 | ||
1149 | The top Makefile exports the following variables: | 1226 | The top Makefile exports the following variables: |
1150 | 1227 | ||
@@ -1206,7 +1283,7 @@ The top Makefile exports the following variables: | |||
1206 | INSTALL_MOD_STRIP will used as the option(s) to the strip command. | 1283 | INSTALL_MOD_STRIP will used as the option(s) to the strip command. |
1207 | 1284 | ||
1208 | 1285 | ||
1209 | === 8 Makefile language | 1286 | === 9 Makefile language |
1210 | 1287 | ||
1211 | The kernel Makefiles are designed to be run with GNU Make. The Makefiles | 1288 | The kernel Makefiles are designed to be run with GNU Make. The Makefiles |
1212 | use only the documented features of GNU Make, but they do use many | 1289 | use only the documented features of GNU Make, but they do use many |
@@ -1225,14 +1302,14 @@ time the left-hand side is used. | |||
1225 | There are some cases where "=" is appropriate. Usually, though, ":=" | 1302 | There are some cases where "=" is appropriate. Usually, though, ":=" |
1226 | is the right choice. | 1303 | is the right choice. |
1227 | 1304 | ||
1228 | === 9 Credits | 1305 | === 10 Credits |
1229 | 1306 | ||
1230 | Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net> | 1307 | Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net> |
1231 | Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 1308 | Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> |
1232 | Updates by Sam Ravnborg <sam@ravnborg.org> | 1309 | Updates by Sam Ravnborg <sam@ravnborg.org> |
1233 | Language QA by Jan Engelhardt <jengelh@gmx.de> | 1310 | Language QA by Jan Engelhardt <jengelh@gmx.de> |
1234 | 1311 | ||
1235 | === 10 TODO | 1312 | === 11 TODO |
1236 | 1313 | ||
1237 | - Describe how kbuild supports shipped files with _shipped. | 1314 | - Describe how kbuild supports shipped files with _shipped. |
1238 | - Generating offset header files. | 1315 | - Generating offset header files. |