Makefile restructuring?

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Tue Aug 14 01:41:14 PDT 2012


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).

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.

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?

/Magnus



More information about the build-infra-dev mailing list