[kea-dev] Makefile.am guideline

Francis Dupont fdupont at isc.org
Thu Sep 3 12:24:10 UTC 2015


This is a proposal for a new Makefile.am section of coding guidelines.

First when there is a least a subdirectory the SUBDIRS entry, e.g.:
SUBDIRS = . tests

Followed by AM_CPPFLAGS set to source and build tree at the second level
and external dependency includes and CPPFLAGS, e.g.:
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES)

Directory variables should be relative (i.e., no abs_top_builddir)
for efficiency.
Third (or more) levels should not be used, e.g.:
NO += -I$(top_srcdir)/src/lib/dns -I$(top_builddir)/src/lib/dns

AM_CXXFLAGS should be initialized to KEA_CXXFLAGS, e.g.:
AM_CXXFLAGS = $(KEA_CXXFLAGS)

When executables are build, AM_LDFLAGS must be conditionally set
to static, e.g.:
if USE_STATIC_LINK
AM_LDFLAGS = -static
endif

At the exception of archives, (dynamic) libraries and executables should
be linked with all dependencies in the opposite order of src/lib/Makefile.am
for shared libraries (so finishing by libkea-exceptions.la) followed
y external dependencies. The idea is to not rely on libtool which has
shown some problems handling dependencies.

Dynamic Shared Objects built as modules to be dynamically loaded must have
no dependency when static linking is enforced: their undefined symbols
should be resolved using executables they are loaded into.

PS: please comment/improve if you think this should not go as it is
into coding guidelines.

Regards

Francis Dupont <fdupont at isc.org>


More information about the kea-dev mailing list