Makefile restructuring?

David Holmes david.holmes at oracle.com
Tue Aug 14 02:29:32 PDT 2012


Hi Magnus,

Welcome back :)

On 14/08/2012 6:41 PM, Magnus Ihse Bursie wrote:
> Now that the new makefiles in build-infra is getting more and more
> complete, I think it's time to start some of the finishing touches to
> make it maintainable and open to new developers.
>
> Two things strikes me:
> 1) CompileNativeLibraries.gmk is waaay to large. It desperately needs
> splitting into smaller parts.
> 2) The top-level "makefiles" directory is too polluted. All these Gensrc
> and Gendata files hides the relevant files. Gensrc and Gendata files
> should be moved to a separate subdirectory.
>
> For 1, my suggestion is that we create a directory, e.g.
> makefiles/nativelibs, and split CompileNativeLibraries.gmk into several
> smaller files into this directory.
>
> One approach is to have one file per library, named after the library.
> The pros is that it is easy to figure out where to find logic for a
> specific library, and it is easy to understand how to add a new library
> (just add a new file with the proper name). The con is mainly that we
> will get many very small files (currently ~60).

Wow do we really have 60+ native libs?

> Another approach is to organise it by some kind of more coarse grained
> separation, like "AWT" etc. This will lead to fewer and perhaps more
> reasonably sized files, but then it will not always be clear where to
> find a specific library, or where to add a new library.

How well do these libraries currently group?

Seems to me that this file would shrink considerably if we could move 
away from having to list all the source files individually. It might 
also help to split out into os specific variants and do away with the 
ifdefs. Otherwise it is not clear to me that any of the three options:
- mega file
- file per lib
- file per "area"
really stand out as better or worse.

> For 2, my suggestion is that we create makefiles/gensrc and
> makefiles/gendata, and move the Gensrc* and Gendata* files there. We can
> then automatically include all files in these directories in the proper
> places. This will make us apply the same principles to the makefiles as
> we have tried to apply for source code (viz. that you should not have to
> add explicit includes when adding a new source file). :-)
>
> Any thoughts on this?

I must admit I hadn't yet had a chance to really figure out all the Gen* 
files. It certainly is not obvious to me what belongs in each file - or 
where I would go to find specific things. My concern with moving them 
into subdirectories is that at present I tend to use "grep <val> *" an 
awful lot to find things, and that will be harder with subdirectories 
involved :)

Cheers,
David

> /Magnus



More information about the build-infra-dev mailing list