On Fri, 2019-07-26 at 10:23 +0100, Daniel P. Berrangé wrote: > On Fri, Jul 26, 2019 at 11:18:03AM +0200, Andrea Bolognani wrote: > > On Tue, 2019-07-23 at 17:02 +0100, Daniel P. Berrangé wrote: > > [...] > > > +AUG_TEST_NAMES = $(subst /,-, $(augeastest_DATA)) > > > > > > check-local: check-augeas > > > > > > -check-augeas: $(AUGEAS_DIRS:%=check-augeas-%) > > > +check-augeas: $(AUG_TEST_NAMES:%=check-augeas-%) > > > + > > > +check-augeas-%: $(augeas_DATA) $(augeastest_DATA) > > > + $(AM_V_GEN)export FILE=`echo $* | sed -e 's/.*-//'`; \ > > > + export DIR=`echo $* | sed -e 's/-.*//'`; \ > > > + if test -x '$(AUGPARSE)'; then \ > > > + '$(AUGPARSE)' -I $(srcdir)/$$DIR -I $(builddir)/$$DIR $$DIR/$$FILE; \ > > > + fi > > > > How about we skip the double conversion steps and just do > > > > check-augeas: $(augeas_DATA) $(augeastest_DATA) > > $(AM_V_GEN) \ > > if test -x "$(AUGPARSE)"; then \ > > for f in $(augeastest_DATA); do \ > > DIR=$$(dirname "$$f"); \ > > FILE=$$(basename "$$f"); \ > > "$(AUGPARSE)" \ > > -I "$(srcdir)/$$DIR" -I "$(builddir)/$$DIR" \ > > "$$DIR/$$FILE"; \ > > done; \ > > fi > > .PHONY: check-augeas > > > > instead? As an added bonus, this version avoids doing any work if > > augparse is not available and is correctly marked as PHONY, which > > the rules you're replacing also were. > > This doesn't show any output for the files - I wanted to see the > make output for each file being checked, as its a useful confirmation > that we're actually processing the files we expect to have. That's only a couple small tweaks away: check-augeas: $(augeas_DATA) $(augeastest_DATA) @if test -x "$(AUGPARSE)"; then \ for f in $(augeastest_DATA); do \ DIR=$$(dirname "$$f"); \ FILE=$$(basename "$$f"); \ echo "AUGPARSE $$f"; \ "$(AUGPARSE)" \ -I "$(srcdir)/$$DIR" -I "$(builddir)/$$DIR" \ "$$DIR/$$FILE"; \ done; \ fi .PHONY: check-augeas This version even results in a more accurate output, as we're not really generating the files but rather validating them. -- Andrea Bolognani / Red Hat / Virtualization -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list