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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to