diff --git a/Makefile.am b/Makefile.am index c8c36812b5c722a1369bbd789d3f0c0290a09487..321d166b00ff8b34da71b5c69606861f5c447988 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1314,24 +1314,40 @@ PEP8_IGNORE = E111,E261,E501 # For excluding pep8 expects filenames only, not whole paths PEP8_EXCLUDE = $(subst $(space),$(comma),$(strip $(notdir $(BUILT_PYTHON_SOURCES)))) +LINT_TARGETS = pylint pylint-qa +if HAS_PEP8 +LINT_TARGETS += pep8 +endif +if HAS_HLINT +LINT_TARGETS += hlint +endif + .PHONY: lint -lint: $(BUILT_SOURCES) +lint: $(LINT_TARGETS) + +.PHONY: pylint +pylint: $(BUILT_SOURCES) @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; } - if test -z "$(PEP8)"; then \ - echo '"pep8" not found during configure' >&2; \ - else \ - $(PEP8) --repeat --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \ - $(pep8_python_code); \ - fi $(PYLINT) $(LINT_OPTS) $(lint_python_code) + +.PHONY: pylint-qa +pylint-qa: $(BUILT_SOURCES) + @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; } cd $(top_srcdir)/qa && \ PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \ --rcfile ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts)) +.PHONY: pep8 +pep8: $(BUILT_SOURCES) + @test -n "$(PEP8)" || { echo 'pep8' not found during configure; exit 1; } + $(PEP8) --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \ + --repeat $(pep8_python_code) + .PHONY: hlint hlint: $(HS_BUILT_SRCS) htools/lint-hints.hs + @test -n "$(HLINT)" || { echo 'hlint' not found during configure; exit 1; } if tty -s; then C="-c"; else C=""; fi; \ - hlint --report=doc/hs-lint.html --cross $$C \ + $(HLINT) --report=doc/hs-lint.html --cross $$C \ --ignore "Use first" \ --ignore "Use comparing" \ --ignore "Use on" \ diff --git a/configure.ac b/configure.ac index 7520c67d1e144873327c8deef2ed0e4cdce59f50..0a36b0b3460e4d2da6eaa0105a60efa0699f033f 100644 --- a/configure.ac +++ b/configure.ac @@ -387,6 +387,7 @@ if test -z "$PEP8" then AC_MSG_WARN([pep8 not found, checking code will not be complete]) fi +AM_CONDITIONAL([HAS_PEP8], [test "$PEP8"]) # Check for socat AC_ARG_VAR(SOCAT, [socat path]) @@ -518,6 +519,14 @@ if test "$HADDOCK" && test "$HSCOLOUR"; then fi AC_SUBST(HTOOLS_APIDOC) +# Check for hlint +HLINT=no +AC_ARG_VAR(HLINT, [hlint path]) +AC_PATH_PROG(HLINT, [hlint], []) +if test -z "$HLINT"; then + AC_MSG_WARN([hlint not found, checking code will not be possible]) +fi + fi # end if enable_htools, define automake conditions if test "$HTOOLS" != "yes" && test "$HS_CONFD" = "True"; then @@ -528,6 +537,7 @@ fi AM_CONDITIONAL([WANT_HTOOLS], [test x$HTOOLS = xyes]) AM_CONDITIONAL([WANT_HTOOLSTESTS], [test "x$GHC_PKG_QUICKCHECK" != x]) AM_CONDITIONAL([WANT_HTOOLSAPIDOC], [test x$HTOOLS_APIDOC = xyes]) +AM_CONDITIONAL([HAS_HLINT], [test "$HLINT"]) # Check for fakeroot AC_ARG_VAR(FAKEROOT_PATH, [fakeroot path])