For PR automake/428: Support for conditionally defined -hook and -local rules. * automake.in (user_phony_rule): New function. (handle_dist, handle_install, handle_all, do_check_merge_target, handle_factored_dependencies): Use user_phony_rule before adding a user -hook or -local rule as a dependency to ensure it is always defined an phony. * tests/cond37.test, tests/condhook.test: New files. * tests/Makefile.am (TESTS): Add them. Report from Simon Josefsson and Nik A. Melchior.