1 ;;; ede/make.el --- General information about "make"
3 ;;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
24 ;; This file needs to choose the version of "make" it wants to use.
25 ;; Whenever an executable "gmake" is available, we prefer that since
26 ;; it usually means GNU Make. If it doesn't exist, use "make".
28 ;; Run tests on make --version to be sure it is GNU make so that
29 ;; logical error messages can be provided.
33 (declare-function inversion-check-version
"inversion")
35 (if (fboundp 'locate-file
)
36 (defsubst ede--find-executable
(exec)
37 "Return an expanded file name for a program EXEC on the exec path."
38 (locate-file exec exec-path
))
40 ;; Else, older version of Emacs.
42 (defsubst ede--find-executable
(exec)
43 "Return an expanded file name for a program EXEC on the exec path."
46 (while (and p
(not found
))
47 (let ((f (expand-file-name exec
(car p
))))
54 (defvar ede-make-min-version
"3.0"
55 "Minimum version of GNU make required.")
57 (defcustom ede-make-command
(cond ((ede--find-executable "gmake")
59 (t "make")) ;; What to do?
60 "The MAKE command to use for EDE when compiling.
61 The makefile generated by EDE for C files uses syntax that depends on GNU Make,
62 so this should be set to something that can execute GNU Make files."
67 (defun ede-make-check-version (&optional noerror
)
68 "Check the version of GNU Make installed.
69 The check passes if the MAKE version is no high enough, or if it
71 If NOERROR is non-nil, return t for success, nil for failure.
72 If NOERROR is nil, then throw an error on failure. Return t otherwise."
74 (let ((b (get-buffer-create "*EDE Make Version*"))
75 (cd default-directory
)
79 (with-current-buffer b
80 ;; Setup, and execute make.
81 (setq default-directory cd
)
83 (call-process ede-make-command nil b nil
85 ;; Check the buffer for the string
86 (goto-char (point-min))
87 (when (looking-at "GNU Make\\(?: version\\)? \\([0-9][^,]+\\),")
88 (setq rev
(match-string 1))
90 (setq ans
(not (inversion-check-version rev nil ede-make-min-version
))))
93 (when (and (called-interactively-p 'interactive
) ans
)
94 (message "GNU Make version %s. Good enough for CEDET." rev
))
96 (when (and (not noerror
) (not ans
))
97 (error "EDE requires GNU Make version %s or later. Configure `ede-make-command' to fix"
98 ede-make-min-version
))
104 ;; generated-autoload-file: "loaddefs.el"
105 ;; generated-autoload-load-name: "ede/make"
108 ;;; ede/make.el ends here