Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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_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
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


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

Browse other questions tagged or ask your own question.