NonRecursiveMakefile
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Proposal:
Switch to a single makefile in src/ that includes all the stuff previously in src/**/Makefile.am.
Top-level makefile continues to be recursive make. This simplifies data installation, and the benefits of changing aren't much for directories outside of src/**.
Use automake's `include' directive on blah/Makefile_insert.
Most existing blah/Makefile.am content goes to blah/Makefile_insert, e.g. blah_libblah_a_{CPPFLAGS,SOURCES,LDFLAGS,LDADD}.
Some "global" variable definitions move to src/Makefile.am: noinst_LIBRARIES, DISTCLEANFILES, EXTRA_DIST, EXTRA_PROGRAMS, TESTS, check_PROGRAMS.
INCLUDES/AM_CPPFLAGS become e.g. blah_libblah_a_CPPFLAGS (i.e. per-target instead of per-directory).
"Local" variable definitions (e.g. used for conditional compilation, e.g. win32_sources) go in src/blah/Makefile_insert, and acquire a `blah_' prefix. (The win32_sources variable from src/Makefile.am goes to src/Makefile_insert with no added prefix.)
src/Makefile.am contains:
include blah/Makefile_insert
Definitions for the aforementioned "global" variables.
dist-hook rule.
Advantages:
Can depend on things from other directories. E.g. some files in display/ depend on helper/sp-marshal.h having been built, and various */*-test programs depend on libraries in other directories (previously hacked with a `check-recursive: all-recursive' dependency in src/Makefile.am).
Compilation is expected to be faster:
- Fewer invocations of automake and make.
- Better parallelization is possible with make -j / make -l (e.g. when using distcc).
However, making CPPFLAGS per-target means much longer generated Makefile content. I haven't yet done timing tests (underway).
Disadvantages:
All files mentioned in the makefile fragments need to specify their directory. E.g. if blah/Makefile.am used to contain
libblah_a_SOURCES = \ foo.cpp foo.h
then blah/Makefile_insert will now contain
blah_libblah_a_SOURCES = \ blah/foo.cpp \ blah/foo.h
Any other advantages/disadvantages?
Checks to be done before switching:
`make install' creates same directory tree.
- Done. Some differences in the inkscape/inkview executable files, all other files bytewise-identical.
`make check' works.
- Done. Works. Hmm, haven't checked that all expected checks are getting run.
`make check' works immediately after `make clean'.
- Not yet checked.
`make distcheck' works.
- Not yet checked.
Any other checks to be done?
pjrm.