From: Brendan Cully Date: Sat, 11 Oct 2014 18:05:21 +0000 (-0700) Subject: add check-syntax target for flymake X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=74c79713640dabd2c26f1a837ca9f5c10222f931;p=neomutt add check-syntax target for flymake --- diff --git a/Makefile.am b/Makefile.am index 8166b1b46..021e737b7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,6 @@ ## Process this file with automake to produce Makefile.in ## Use aclocal -I m4; automake --foreign +include $(top_srcdir)/flymake.am AUTOMAKE_OPTIONS = 1.6 foreign EXTRA_PROGRAMS = mutt_dotlock pgpring pgpewrap mutt_md5 diff --git a/doc/Makefile.am b/doc/Makefile.am index f4e21bce3..42d918a47 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/flymake.am + subdir = doc DSLROOT = @DSLROOT@ diff --git a/flymake.am b/flymake.am new file mode 100644 index 000000000..62fbfd998 --- /dev/null +++ b/flymake.am @@ -0,0 +1,12 @@ +get_cs_flags = $(foreach target,$(subst .,_,$(subst -,_,$($(2)))),$($(target)_$(1)FLAGS)) +get_cs_all_flags = $(foreach type,$(2),$(call get_cs_flags,$(1),$(type))) +get_cs_compile = $(if $(subst C,,$(1)),$($(1)COMPILE),$(COMPILE)) +get_cs_cmdline = $(call get_cs_compile,$(1)) $(call get_cs_all_flags,$(1),check_PROGRAMS bin_PROGRAMS lib_LTLIBRARIES) -fsyntax-only + +check-syntax: + s=$(suffix $(CHK_SOURCES));\ + if [ "$$s" = ".c" ]; then \ + $(call get_cs_cmdline,C) $(call get_cs_cmdline,CPP) $(CHK_SOURCES);\ + else exit 1; fi + +.PHONY: check-syntax diff --git a/imap/Makefile.am b/imap/Makefile.am index e423c7ff7..f18e02347 100644 --- a/imap/Makefile.am +++ b/imap/Makefile.am @@ -1,4 +1,5 @@ ## Process this file with automake to produce Makefile.in +include $(top_srcdir)/flymake.am AR=@AR@