Function: flymake-proc-get-project-include-dirs-imp

flymake-proc-get-project-include-dirs-imp is a byte-compiled function defined in flymake-proc.el.gz.

Signature

(flymake-proc-get-project-include-dirs-imp BASEDIR)

Documentation

Include dirs for the project current file belongs to.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/flymake-proc.el.gz
(defun flymake-proc-get-project-include-dirs-imp (basedir)
  "Include dirs for the project current file belongs to."
  (if (flymake-proc--get-project-include-dirs-from-cache basedir)
      (progn
	(flymake-proc--get-project-include-dirs-from-cache basedir))
    ;;else
    (let* ((command-line  (concat "make -C "
				  (shell-quote-argument basedir)
				  " DUMPVARS=INCLUDE_DIRS dumpvars"))
	   (output        (shell-command-to-string command-line))
	   (lines         (split-string output "\n" t))
	   (count         (length lines))
	   (idx           0)
	   (inc-dirs      nil))
      (while (and (< idx count) (not (string-match "^INCLUDE_DIRS=.*" (nth idx lines))))
	(setq idx (1+ idx)))
      (when (< idx count)
	(let* ((inc-lines  (split-string (nth idx lines) " *-I" t))
	       (inc-count  (length inc-lines)))
	  (while (> inc-count 0)
	    (when (not (string-match "^INCLUDE_DIRS=.*" (nth (1- inc-count) inc-lines)))
	      (push (replace-regexp-in-string "\"" "" (nth (1- inc-count) inc-lines)) inc-dirs))
	    (setq inc-count (1- inc-count)))))
      (flymake-proc--add-project-include-dirs-to-cache basedir inc-dirs)
      inc-dirs)))