Function: vhdl-get-compile-options

vhdl-get-compile-options is a byte-compiled function defined in vhdl-mode.el.gz.

Signature

(vhdl-get-compile-options PROJECT COMPILER FILE-NAME &optional FILE-OPTIONS-ONLY)

Documentation

Get compiler options. Returning nil means do not compile this file.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
(defun vhdl-get-compile-options (project compiler file-name
					 &optional file-options-only)
  "Get compiler options.  Returning nil means do not compile this file."
  (let* ((compiler-options (nth 1 compiler))
	 (project-entry (vhdl-aget (nth 4 project) vhdl-compiler))
	 (project-options (nth 0 project-entry))
	 (exception-list (and file-name (nth 2 project-entry)))
	 (work-library (vhdl-work-library))
	 (case-fold-search nil)
	 file-options)
    (while (and exception-list
		(not (string-match (caar exception-list) file-name)))
      (setq exception-list (cdr exception-list)))
    (if (and exception-list (not (cdar exception-list)))
	nil
      (if (and file-options-only (not exception-list))
	  'default
	(setq file-options (cdar exception-list))
	;; insert library name in compiler-specific options
	(setq compiler-options
	      (vhdl-replace-string (cons "\\(.*\\)" compiler-options)
				   work-library))
	;; insert compiler-specific options in project-specific options
	(when project-options
	  (setq project-options
		(vhdl-replace-string
		 (cons "\\(.*\\)\n\\(.*\\)" project-options)
		 (concat work-library "\n" compiler-options))))
	;; insert project-specific options in file-specific options
	(when file-options
	  (setq file-options
		(vhdl-replace-string
		 (cons "\\(.*\\)\n\\(.*\\)\n\\(.*\\)" file-options)
		 (concat work-library "\n" compiler-options "\n"
			 project-options))))
	;; return options
	(or file-options project-options compiler-options)))))