]> granicus.if.org Git - mutt/commitdiff
add check-syntax target for flymake
authorBrendan Cully <brendan@kublai.com>
Sat, 11 Oct 2014 18:05:21 +0000 (11:05 -0700)
committerBrendan Cully <brendan@kublai.com>
Sat, 11 Oct 2014 18:05:21 +0000 (11:05 -0700)
Makefile.am
doc/Makefile.am
flymake.am [new file with mode: 0644]
imap/Makefile.am

index 8166b1b46ca37228e068168004f3022746565a62..021e737b7ab1df5852f94d9b2efc72574d87b145 100644 (file)
@@ -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
index f4e21bce392c748b00515711ffa379536f435437..42d918a477601b3c40364ab6aaa9f8b0d6dedb28 100644 (file)
@@ -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 (file)
index 0000000..62fbfd9
--- /dev/null
@@ -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
index e423c7ff7229e2524bcf676864de5de426656353..f18e023477c4d50121ad2455226f9fc032c9b506 100644 (file)
@@ -1,4 +1,5 @@
 ## Process this file with automake to produce Makefile.in
+include $(top_srcdir)/flymake.am
 
 AR=@AR@