On Wed, 10 Apr 2002 11:13:14 -0700, 
Wesley Smith <[EMAIL PROTECTED]> wrote:
>In the Rules.make file in both 2.4.18 and 2.5.7 kernels, the rule to
>make a .c into a .o looks like this:
>
>%.o: %.c
>       $(CC) $(CFLAGS) [stuff deleted]  -c -o $@ $<
>
>The rule to build a .c into .o when the .o happens to be in
>$(export-objs) looks like this:
>
>$(export-objs): $(export-objs:.o=.c) [ deleted ]
>       $(CC) $(CFLAGS) [stuff deleted] -DEXPORT_SYMTAB -c $(@:.o=.c)
>
>
>Notice that the export-objs rule is missing a "-o" flag to the compiler.
>
>This means that if my module's Makefile needs to get some files out a a
>subdirectory, say "extrastuff/extra.c", and I put "extrastuff/extra.o"
>in $(obj-m), then the compiler will put the .o in the extrastuff
>subdirectory as "extrastuff/extra.o".  But if that file is in the
>$(exports-objs) list, then
>the compiler, missing any -o option, will put the output in "extra.o".

Do not build objects in a sub-directory, it has side effects on the
code that checks if the flags have changed.  If you need objects to be
built in a sub directory then that sub directory needs its own Makefile
which is mentioned in the parent.

Always build in the local directory and link into the parent directory.
See drivers/acpi/Makefile, variable acpi-subdirs and the Makefiles in
the acpi sub directories for an example.


_______________________________________________
kbuild-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/kbuild-devel

Reply via email to