Previous: , Up: Adding support for a new syntax check tool   [Contents][Index]

4.2.2 Example—Configuring a tool called via make

In this example we will add support for C files syntax checked by gcc called via make.

We’re not required to write any new functions, as Flymake already has functions for make. We just add a new entry to the flymake-allowed-file-name-masks:

(setq flymake-allowed-file-name-masks
      (cons '(".+\\.c$"

flymake-simple-make-init builds the following make command line:

(list "make"
      (list "-s" "-C"
            (concat "CHK_SOURCES=" source)

base-dir is a directory containing Makefile, see Locating the buildfile.

Thus, Makefile must contain the check-syntax target. In our case this target might look like this:

	gcc -o /dev/null -S ${CHK_SOURCES}

The format of error messages reported by gcc is already supported by Flymake, so we don’t have to add a new entry to flymake-err-line-patterns. Note that if you are using Automake, you may want to replace gcc with the standard Automake variable COMPILE:

	$(COMPILE) -o /dev/null -S ${CHK_SOURCES}