summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am1
-rw-r--r--doc/Makefile.am2
-rw-r--r--flymake.am12
-rw-r--r--imap/Makefile.am1
4 files changed, 16 insertions, 0 deletions
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@