From e4cc6437c1684039cfc3cb4a1723568b3de5f171 Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Sat, 11 Oct 2014 11:05:21 -0700 Subject: [PATCH] add check-syntax target for flymake --- Makefile.am | 1 + doc/Makefile.am | 2 ++ flymake.am | 12 ++++++++++++ imap/Makefile.am | 1 + 4 files changed, 16 insertions(+) create mode 100644 flymake.am diff --git a/Makefile.am b/Makefile.am index 8166b1b4..021e737b 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 f4e21bce..42d918a4 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 00000000..62fbfd99 --- /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 e423c7ff..f18e0234 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@ -- 2.40.0