aboutsummaryrefslogtreecommitdiff
path: root/flymake.mk
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-02-21 15:57:11 +0100
committerGuido Günther <agx@sigxcpu.org>2014-02-24 08:39:05 +0100
commit891b34e2ef64f354474c4c6bec8e35f905e3c1db (patch)
tree9ff4373f980caa5eab84c4f3abaff6640783d817 /flymake.mk
Initial commit
Diffstat (limited to 'flymake.mk')
-rw-r--r--flymake.mk12
1 files changed, 12 insertions, 0 deletions
diff --git a/flymake.mk b/flymake.mk
new file mode 100644
index 0000000..8228150
--- /dev/null
+++ b/flymake.mk
@@ -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) $(CHK_SOURCES);\
+ elif [ "$$s" = ".cpp" ]; then $(call get_cs_cmdline,CXX) $(CHK_SOURCES);\
+ else exit 1; fi
+
+PHONY: check-syntax