Using GNU make macros with automake

In configure.ac:

LIBCXX_INIT

In Makefile.am:


@LIBCXX_AM@

# Followed by macro calls:

$(call OPTIONS_GEN,cliopts.H,cliopts.xml)

# ...

After the single line containing @LIBCXX_AM@, invoke the OPTIONS_GEN macro to create the make rules.

The LIBCXX_INIT autoconf macro sets LIBCXX_AM to the include statement that pulls in libcxx.mk.

libcxx.mk does a rudimentary check if AUTOMAKE is set. If so, it automatically generates a make distclean rule to remove all targets generated by the macros. The LIBCXX_CLEANFILES variable accumulates the list of targets produced by all macro invocations, and may be utilized by non-automake makefiles for similar purposes. Additionally, all .xml dependencies get added to EXTRA_DIST. Any assignments to EXTRA_DIST in Makefile.am must occur before inclusion of libcxx.mk. It is permitted to use += to add to EXTRA_DIST after the inclusion of libcxx.mk.