Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm not familiar with Makefiles, I can kinda understand them, but with the Linux Kernel I have a question.

(Using 3.7.1, Patched with BFS so line numbers may be a bit off)

On line 248

HOSTCFLAGS   = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer

Is this passed to all the Makefiles?

Then on Lines 349 and 352 Respectively

CFLAGS_MODULE   =
....
CFLAGS_KERNEL   =
....
CFLAGS_GCOV = -fprofile-arcs -ftest-coverage

I'm guessing CFLAGS_MODULE is passed to things built as a module, and the next is specific to the kernel itself? And CFLAGS_GCOV is for debugging and profiling?

Then there are a bunch of KBUILD_CFLAGS

KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)

I'm guessing the previous line removes those options, and the next line adds?

KBUILD_CFLAGS   += -fno-omit-frame-pointer -fno-optimize-sibling-calls

I haven't found a good tutorial about this either.

share|improve this question
2  
What have you tried? The very first search result I got is Using Variables in the GNU make manual. –  gertvdijk Dec 28 '12 at 16:26
    
The Problem is I can't for the life of me figure out the general idea of what values are used where. –  John Dec 29 '12 at 16:13
    
Yes, the Linux Makefiles are a real mess ;-) There are many different compilations: Build tools that run on the machine doing the build, compile stuff that goes in modules, compile stuff that isn't modules should cover the three macros you cite. Take a tour at kernelnewbies.org, that should quench your thirst for knowledge. –  vonbrand Jan 22 '13 at 1:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.