diff options
Diffstat (limited to 'Documentation/kbuild/makefiles.txt')
-rw-r--r-- | Documentation/kbuild/makefiles.txt | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 08fbe6cd309d..f099b814d383 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -276,40 +276,39 @@ more details, with real examples. | |||
276 | 276 | ||
277 | --- 3.7 Compilation flags | 277 | --- 3.7 Compilation flags |
278 | 278 | ||
279 | EXTRA_CFLAGS, EXTRA_AFLAGS, EXTRA_LDFLAGS | 279 | ccflags-y, asflags-y and ldflags-y |
280 | The three flags listed above applies only to the kbuild makefile | ||
281 | where they are assigned. They are used for all the normal | ||
282 | cc, as and ld invocation happenign during a recursive build. | ||
283 | Note: Flags with the same behaviour were previously named: | ||
284 | EXTRA_CFLAGS, EXTRA_AFLAGS and EXTRA_LDFLAGS. | ||
285 | They are yet supported but their use are deprecated. | ||
280 | 286 | ||
281 | All the EXTRA_ variables apply only to the kbuild makefile | 287 | ccflags-y specifies options for compiling C files with $(CC). |
282 | where they are assigned. The EXTRA_ variables apply to all | ||
283 | commands executed in the kbuild makefile. | ||
284 | |||
285 | $(EXTRA_CFLAGS) specifies options for compiling C files with | ||
286 | $(CC). | ||
287 | 288 | ||
288 | Example: | 289 | Example: |
289 | # drivers/sound/emu10k1/Makefile | 290 | # drivers/sound/emu10k1/Makefile |
290 | EXTRA_CFLAGS += -I$(obj) | 291 | ccflags-y += -I$(obj) |
291 | ifdef DEBUG | 292 | ccflags-$(DEBUG) += -DEMU10K1_DEBUG |
292 | EXTRA_CFLAGS += -DEMU10K1_DEBUG | ||
293 | endif | ||
294 | 293 | ||
295 | 294 | ||
296 | This variable is necessary because the top Makefile owns the | 295 | This variable is necessary because the top Makefile owns the |
297 | variable $(KBUILD_CFLAGS) and uses it for compilation flags for the | 296 | variable $(KBUILD_CFLAGS) and uses it for compilation flags for the |
298 | entire tree. | 297 | entire tree. |
299 | 298 | ||
300 | $(EXTRA_AFLAGS) is a similar string for per-directory options | 299 | asflags-y is a similar string for per-directory options |
301 | when compiling assembly language source. | 300 | when compiling assembly language source. |
302 | 301 | ||
303 | Example: | 302 | Example: |
304 | #arch/x86_64/kernel/Makefile | 303 | #arch/x86_64/kernel/Makefile |
305 | EXTRA_AFLAGS := -traditional | 304 | asflags-y := -traditional |
306 | 305 | ||
307 | 306 | ||
308 | $(EXTRA_LDFLAGS) is a string for per-directory options to $(LD). | 307 | ldflags-y is a string for per-directory options to $(LD). |
309 | 308 | ||
310 | Example: | 309 | Example: |
311 | #arch/m68k/fpsp040/Makefile | 310 | #arch/m68k/fpsp040/Makefile |
312 | EXTRA_LDFLAGS := -x | 311 | ldflags-y := -x |
313 | 312 | ||
314 | CFLAGS_$@, AFLAGS_$@ | 313 | CFLAGS_$@, AFLAGS_$@ |
315 | 314 | ||
@@ -495,9 +494,9 @@ more details, with real examples. | |||
495 | 494 | ||
496 | Example: | 495 | Example: |
497 | #fs/reiserfs/Makefile | 496 | #fs/reiserfs/Makefile |
498 | EXTRA_CFLAGS := $(call cc-ifversion, -lt, 0402, -O1) | 497 | ccflags-y := $(call cc-ifversion, -lt, 0402, -O1) |
499 | 498 | ||
500 | In this example, EXTRA_CFLAGS will be assigned the value -O1 if the | 499 | In this example, ccflags-y will be assigned the value -O1 if the |
501 | $(CC) version is less than 4.2. | 500 | $(CC) version is less than 4.2. |
502 | cc-ifversion takes all the shell operators: | 501 | cc-ifversion takes all the shell operators: |
503 | -eq, -ne, -lt, -le, -gt, and -ge | 502 | -eq, -ne, -lt, -le, -gt, and -ge |
@@ -783,7 +782,7 @@ When kbuild executes, the following steps are followed (roughly): | |||
783 | Example: | 782 | Example: |
784 | #arch/s390/Makefile | 783 | #arch/s390/Makefile |
785 | LDFLAGS := -m elf_s390 | 784 | LDFLAGS := -m elf_s390 |
786 | Note: EXTRA_LDFLAGS can be used to further customise | 785 | Note: ldflags-y can be used to further customise |
787 | the flags used. See chapter 3.7. | 786 | the flags used. See chapter 3.7. |
788 | 787 | ||
789 | LDFLAGS_MODULE Options for $(LD) when linking modules | 788 | LDFLAGS_MODULE Options for $(LD) when linking modules |
@@ -1100,7 +1099,7 @@ When kbuild executes, the following steps are followed (roughly): | |||
1100 | 1099 | ||
1101 | When building the *.lds target, kbuild uses the variables: | 1100 | When building the *.lds target, kbuild uses the variables: |
1102 | KBUILD_CPPFLAGS : Set in top-level Makefile | 1101 | KBUILD_CPPFLAGS : Set in top-level Makefile |
1103 | EXTRA_CPPFLAGS : May be set in the kbuild makefile | 1102 | cppflags-y : May be set in the kbuild makefile |
1104 | CPPFLAGS_$(@F) : Target specific flags. | 1103 | CPPFLAGS_$(@F) : Target specific flags. |
1105 | Note that the full filename is used in this | 1104 | Note that the full filename is used in this |
1106 | assignment. | 1105 | assignment. |