From: gmate.amit@gmail.com (Kumar amit mehta)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Query on kernel module Makefile
Date: Fri, 19 Oct 2012 05:31:01 -0700 [thread overview]
Message-ID: <20121019123101.GA517@gmail.com> (raw)
I came across the following information in
~Documentation/kbuild/makefiles.txt
<snip>
--- 3.7 Compilation flags
ccflags-y, asflags-y and ldflags-y
These three flags apply only to the kbuild makefile in which they
are assigned. They are used for all the normal cc, as and ld
invocations happening during a recursive build.
Note: Flags with the same behaviour were previously named:
EXTRA_CFLAGS, EXTRA_AFLAGS and EXTRA_LDFLAGS.
They are still supported but their usage is deprecated.
ccflags-y specifies options for compiling with $(CC).
Example:
# drivers/acpi/Makefile
ccflags-y := -Os
ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT
<snip>
So My understanding is that we should be getting rid of these three flags
(EXTRA_CFLAGS, EXTRA_AFLAGS and EXTRA_LDFLAGS) from Makefiles under
kernel sources and also anywhere outside the kernel build system(e.g.
our loadable modules). For learing purpose, I'm trying to maintain the ldd3
examples with the latest kernel sources and I see that the Makefiles
under the ldd3 examples have something like this:
<snip from original Makefile>
EXTRA_CFLAGS += $(DEBFLAGS) -I$(LDDINC)
.....some rules here.........
.............................
depend .depend dep:
$(CC) $(EXTRA_CFLAGS) -M *.c > .depend
<snip from original Makefile>
I'm planning to update such occurances of EXTRA_CFLAGS as:
<snip from modified Makefile>
ccflags-y += $(DEBFLAGS) -I$(LDDINC)
.....some rules for target here.........
........................................
depend .depend dep:
$(CC) $(ccflags) -M *.c > .depend
<snip from modified Makefile>
With the above change, the module compilation, load, unload etc works
fine, but I'm not sure how this make 'depend' works and how to check if
the rules for resolving auto dependency is written correctly.
-Amit
reply other threads:[~2012-10-19 12:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121019123101.GA517@gmail.com \
--to=gmate.amit@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).