jeudi 1 septembre 2016

Automake: adding local convenience behavior to "make check"

With a standard project layout of

$(src_topdir)/include
$(src_topdir)/src
$(src_topdir)/tests

I would like to run all the tests in $(src_topdir)/tests when typing "make check" in $(src_topdir)/src in addition to running any configured tests in $(src_topdir)/src.

Automake provides an extension to add additional targets to the check Makefile target, by adding (in Makefile.am) the target local-check which I can define to

local-check:
        cd ../tests && $(MAKE) $(AM_MAKEFLAGS) check

And while this permits me to make check within the $(src_topdir)/src directory with satisfaction, unfortunately it breaks the call to make check from the $(src_topdir) directory. This is because calling from $(src_topdir) recursively enters both $(src_topdir)/src and $(src_topdir)/tests triggering the tests in $(src_topdir)/tests twice.

Is there a way in which I would be able to alter my Makefile.am in $(src_topdir)/src such that local make check calls trigger the desired additional testing while make check calls from the rest of the tooling are unaffected?

Aucun commentaire:

Enregistrer un commentaire