From 5d9d8951a3f851ffca0e4ec4b5538cefe84d3344 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Mon, 5 Sep 2011 22:53:32 +0200 Subject: [PATCH] Use flymake --- flymake.mk | 13 +++++++++++++ src/Makefile.am | 1 + src/bisection-simpler-example.cc | 2 ++ src/bisection-simpler-example2-gradient.cc | 2 ++ src/bisection-simpler-example2.cc | 2 ++ 5 files changed, 20 insertions(+) create mode 100644 flymake.mk diff --git a/flymake.mk b/flymake.mk new file mode 100644 index 00000000..b4136e53 --- /dev/null +++ b/flymake.mk @@ -0,0 +1,13 @@ +# Taken from http://www.emacswiki.org/emacs/FlyMake#toc4 + +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 + +.PHONY: check-syntax +check-syntax: + s=$(suffix $(CHK_SOURCES));\ + if [ "$$s" = ".c" ]; then LANG=C $(call get_cs_cmdline,C) $(CHK_SOURCES);\ + elif [ "$$s" = ".cc" ]; then LANG=C $(call get_cs_cmdline,CXX) $(call get_cs_cmdline,CPP) $(CHK_SOURCES);\ + else exit 1; fi diff --git a/src/Makefile.am b/src/Makefile.am index a57492b1..2cd56b5c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,3 +39,4 @@ DISTCHECK_CONFIGURE_FLAGS = --with-dune-common=$(DUNE_COMMON_ROOT) --with-dune-f include $(top_srcdir)/am/global-rules +include $(top_srcdir)/flymake.mk diff --git a/src/bisection-simpler-example.cc b/src/bisection-simpler-example.cc index f3ca7273..e38deb6b 100644 --- a/src/bisection-simpler-example.cc +++ b/src/bisection-simpler-example.cc @@ -1,3 +1,5 @@ +/* -*- mode:c++; mode: flymake -*- */ + #include <dune/fufem/interval.hh> #include <dune/tnnmg/nonlinearities/smallfunctional.hh> diff --git a/src/bisection-simpler-example2-gradient.cc b/src/bisection-simpler-example2-gradient.cc index 2637a48f..c4bc87d9 100644 --- a/src/bisection-simpler-example2-gradient.cc +++ b/src/bisection-simpler-example2-gradient.cc @@ -1,3 +1,5 @@ +/* -*- mode:c++; mode: flymake -*- */ + // FIXME: is there a bette way to do this? //#define DUNE_MINIMAL_DEBUG_LEVEL 2 #include <dune/common/stdstreams.hh> diff --git a/src/bisection-simpler-example2.cc b/src/bisection-simpler-example2.cc index dde6268c..840cd002 100644 --- a/src/bisection-simpler-example2.cc +++ b/src/bisection-simpler-example2.cc @@ -1,3 +1,5 @@ +/* -*- mode:c++; mode: flymake -*- */ + #include <dune/fufem/interval.hh> #include <dune/tnnmg/nonlinearities/smallfunctional.hh> -- GitLab