Makefile question

Sergei Organov osv at topconrd.ru
Wed Nov 24 18:27:29 UTC 2004


"Etienne Fortin" <etienne.fortin at sensio.tv> writes:
> Hi everyone,
> I'm currently trying to structure my application directories and
> Makefile and I have some interrogations. I read the Makefile README and
> I don't understand completely how to use the leaf and directory
> Makefiles.
> 
> What I want to do is have a main Makefile at the root of my sources that
> link the final executable of the application. This Makefile recurse all
> subdirectory, each compiling some .o from some sources. The main
> Makefile at the root just link all the .o made by the subdirs into the
> executable.
> 
> My problem is that I don't understand how to make that all work with the
> directory and leaf Makefiles concept of RTEMS applications. It seems
> that a directory Makefile is just used to force creation of
> sub-standalone-executables that are in subdirs. But I really just want
> to compile sub-modules from a main application executable.
> 
> Any help will be appreciated.

As has been already pointed to by Angelo Fraietta, it's probably a good
idea to forget about RTEMS makefiles that are used to build RTEMS
itself. You in no way are forced to use the same build system for your
application.

I'd also suggest to arrange your build system so that it would build
everything in a directory (tree) different than those where the sources
are situated. This approach doesn't clutter up your source tree with
intermediate files, allows the source tree to be read-only, and allows
for co-existing builds with different options (in different build
directories).

Another advice is that it's easier and more efficient to get rid of
recursive make invocations for making different components. You may wish
to just 'include' component makefiles into the main makefile instead.

-- 
Sergei.




More information about the users mailing list