kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Query on kernel module Makefile
@ 2012-10-19 12:31 Kumar amit mehta
  0 siblings, 0 replies; only message in thread
From: Kumar amit mehta @ 2012-10-19 12:31 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-19 12:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-19 12:31 Query on kernel module Makefile Kumar amit mehta

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).