Hi Steffen, * Steffen DETTMER wrote on Wed, Jan 20, 2010 at 11:48:49AM CET: > ------------------------------------------------------------------->8======= > install-data-local: myinstbase > > uninstall-local: myuninstbase > > myinstbase: > mkdir -p $(DESTDIR)$(prefix) > touch $(DESTDIR)$(prefix)/foo > myuninstbase: > rm -f $(DESTDIR)$(prefix)/foo > -rmdir -p $(DESTDIR)$(prefix) > > # these rules could be in some include `featureinst.mak': > if FEATURE > install-data-local: myinstfeature > uninstall-local: myuninstfeature > myinstfeature: > mkdir -p $(DESTDIR)$(prefix) > touch $(DESTDIR)$(prefix)/feature > myuninstfeature: > rm -f $(DESTDIR)$(prefix)/feature > -rmdir -p $(DESTDIR)$(prefix) > endif > =======8<------------------------------------------------------------------- > > automake-1.6.3 tells: > > ------------------------------------------------------------------->8======= > test/Makefile.am:1: install-data-local defined both conditionally and > unconditionally > test/Makefile.am:3: uninstall-local defined both conditionally and > unconditionally > make: *** [Makefile.in] Error 1
Yeah, this is a bug (or at least an ugly limitation). You know, automake is a bit thick, it cannot really tell recipes with commands from those without (given that it tries to cope with GNU make-specific constructs, that is fairly nontrivial to do, really). It assumes recipes have commands. So it warns if they are defined in overlapping conditions (at least current automake warns only, but doesn't fail). I agree that it's awkward. If I see a clear way to avoid this without breaking conditional handling, then I'd improve that. Or maybe we should have a -Wno-override-user to silence overriding of user rules. A simple way to avoid the warning is to do the install-data-local rule addition unconditionally and declare the feature rules in both conditions: # these rules could be in some include `featureinst.mak': install-data-local: myinstfeature uninstall-local: myuninstfeature if FEATURE myinstfeature: mkdir -p $(DESTDIR)$(prefix) touch $(DESTDIR)$(prefix)/feature myuninstfeature: rm -f $(DESTDIR)$(prefix)/feature -rmdir -p $(DESTDIR)$(prefix) else myinstfeature: myuninstfeature: endif I've only tested that with current Automake now, though, but I think it should work with older. BTW, you should really update to a newer Automake version. We've recently fixed a security-related issue in the 'dist' and 'distcheck' rules, that is present in all older Automake versions. Cheers, Ralf