From mboxrd@z Thu Jan 1 00:00:00 1970 From: gmate.amit@gmail.com (Kumar amit mehta) Date: Fri, 19 Oct 2012 05:31:01 -0700 Subject: Query on kernel module Makefile Message-ID: <20121019123101.GA517@gmail.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org I came across the following information in ~Documentation/kbuild/makefiles.txt --- 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 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: EXTRA_CFLAGS += $(DEBFLAGS) -I$(LDDINC) .....some rules here......... ............................. depend .depend dep: $(CC) $(EXTRA_CFLAGS) -M *.c > .depend I'm planning to update such occurances of EXTRA_CFLAGS as: ccflags-y += $(DEBFLAGS) -I$(LDDINC) .....some rules for target here......... ........................................ depend .depend dep: $(CC) $(ccflags) -M *.c > .depend 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