Function: makefile-make-font-lock-keywords

makefile-make-font-lock-keywords is a byte-compiled function defined in make-mode.el.gz.

Signature

(makefile-make-font-lock-keywords VAR KEYWORDS SPACE &optional NEGATION &rest FL-KEYWORDS)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/make-mode.el.gz
(defun makefile-make-font-lock-keywords (var keywords space
					     &optional negation
					     &rest fl-keywords)
  `(;; Do macro assignments.  These get the "variable-name" face.
    (,makefile-macroassign-regex
     (1 font-lock-variable-name-face)
     ;; This is for after !=
     (2 'makefile-shell prepend t)
     ;; This is for after normal assignment
     (3 'font-lock-string-face prepend t))

    ;; Rule actions.
    ;; FIXME: When this spans multiple lines we need font-lock-multiline.
    (makefile-match-action
     (1 font-lock-type-face nil t)
     (2 'makefile-shell prepend)
     ;; Only makepp has builtin commands.
     (3 font-lock-builtin-face prepend t))

    ;; Variable references even in targets/strings/comments.
    (,var 2 font-lock-variable-name-face prepend)

    ;; Automatic variable references and single character variable references,
    ;; but not shell variables references.
    ("[^$]\\$\\([@%<?^+*_]\\|[a-zA-Z0-9]\\>\\)"
     1 font-lock-constant-face prepend)
    ("[^$]\\(\\$[@%*]\\)"
     1 'makefile-targets append)

    ,@(if keywords
          ;; Fontify conditionals and includes.
          `((,(concat "^\\(?: [ \t]*\\)?"
	      (string-replace
	       " " "[ \t]+"
	       (if (eq (car keywords) t)
		   (string-replace "-" "[_-]" (regexp-opt (cdr keywords) t))
		 (regexp-opt keywords t)))
	      "\\>[ \t]*\\([^: \t\n#]*\\)")
             (1 font-lock-keyword-face) (2 font-lock-variable-name-face))))

    ,@(if negation
	  `((,negation (1 font-lock-negation-char-face prepend)
		       (2 font-lock-negation-char-face prepend t))))

    ,@(if space
	  '(;; Highlight lines that contain just whitespace.
	    ;; They can cause trouble, especially if they start with a tab.
	    ("^[ \t]+$" . makefile-space)

	    ;; Highlight shell comments that Make treats as commands,
	    ;; since these can fool people.
	    ("^\t+#" 0 makefile-space t)

	    ;; Highlight spaces that precede tabs.
	    ;; They can make a tab fail to be effective.
	    ("^\\( +\\)\t" 1 makefile-space)))

    ,@fl-keywords

    ;; Do dependencies.
    (makefile-match-dependency
     (1 'makefile-targets prepend)
     (3 'makefile-shell prepend t))))