Hello,

On Sat, Jul 18, 2009 at 7:22 PM, Mulyadi Santosa
<[email protected]>wrote:

> On Sat, Jul 18, 2009 at 3:26 PM, Rishi Agrawal<[email protected]>
> wrote:
> > Hello All,
> >
> > I have this particular directory Hierarchy
> >
> > foo
> > |
> > |__ include(directory)
> > |
> > |__kernel(directory)
> > |
> > |__user_space(directory)
> >
> >
> > Include directory has the header file which is required by both the
> kernel
> > space code and the user space code
> >
> > kernel has a character device driver, and a kern_make_file.mk to compile
> the
> > chardev
> >
> > user_space has the user space code, make_file and the configure script.
> >
> > I want to compile the chardev using the user space make file
> >
> > for this I added a line "include kern_make_file.mk" in the user space
> make
> > file
> >
> > but it is giving me the warnings and does not compile the user space code
> >
> > the warnings are :
> >
> > Makefile:16: warning: overriding commands for target `all'
> > ../kernel/make_kernel.mk:8: warning: ignoring old commands for target
> `all'
>
> Is there "all" target in your kernel makefile? seems there is a
> clash.... Perhaps you need to show us the content of your Makefile,
> both for user and kernel space code, to ease clarification...
>
> > Moreover I would like to know wether it is possible to compile the user
> > space code and kernel space code in one make file
>
> I think yes, you just need to be careful for things like : CFLAGS
> (likely it will be different for user and kernel code), include path
> and so on.
>
> So, to avoid headache, I think it's better to separate the Makefile....
>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer
> blog: the-hydra.blogspot.com
>

I have used separate makefiles and added this piece of code in the Makefile
in the topmost directory

@for dir in ${subdirs}; do \
      (cd $$dir && $(MAKE) all) \
      || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
    done && test -z "$$fail"

This loop goes into each and subdir and executes "make"





-- 
Regards,
Rishi B. Agrawal
http://www.linkedin.com/in/rishibagrawal
http://code.google.com/p/fscops/

Reply via email to