1 ;;; ede-proj-prog.el --- EDE Generic Project program support
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2005, 2008, 2009, 2010
4 ;; Free Software Foundation, Inc.
6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
7 ;; Keywords: project, make
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 ;; Handle building programs from object files in and EDE Project file.
28 (eval-when-compile (require 'cl
))
30 (require 'ede
/proj-obj
)
32 (declare-function ede-shell-run-something
"ede/shell")
35 (defclass ede-proj-target-makefile-program
36 (ede-proj-target-makefile-objectcode)
37 ((ldlibs :initarg
:ldlibs
40 :custom
(repeat (string :tag
"Library"))
42 "Libraries, such as \"m\" or \"Xt\" which this program depends on.
43 The linker flag \"-l\" is automatically prepended. Do not include a \"lib\"
44 prefix, or a \".so\" suffix.
46 Note: Currently only used for Automake projects."
48 (ldflags :initarg
:ldflags
51 :custom
(repeat (string :tag
"Link Flag"))
53 "Additional flags to add when linking this target.
54 Use ldlibs to add addition libraries. Use this to specify specific
55 options to the linker.
57 Note: Not currently used. This bug needs to be fixed.")
59 "This target is an executable program.")
61 (defmethod ede-proj-makefile-insert-automake-pre-variables
62 ((this ede-proj-target-makefile-program
))
63 "Insert bin_PROGRAMS variables needed by target THIS."
64 (ede-pmake-insert-variable-shared "bin_PROGRAMS"
65 (insert (ede-name this
)))
68 (defmethod ede-proj-makefile-insert-automake-post-variables
69 ((this ede-proj-target-makefile-program
))
70 "Insert bin_PROGRAMS variables needed by target THIS."
71 (ede-pmake-insert-variable-shared
72 (concat (ede-name this
) "_LDADD")
73 (mapc (lambda (c) (insert " -l" c
)) (oref this ldlibs
)))
74 ;; For other targets THIS depends on
78 ;;(ede-pmake-insert-variable-shared
79 ;; (concat (ede-name this) "_DEPENDENCIES")
80 ;; (mapcar (lambda (d) (insert d)) (oref this FOOOOOOOO)))
83 (defmethod ede-proj-makefile-insert-rules ((this ede-proj-target-makefile-program
))
84 "Insert rules needed by THIS target."
85 (let ((ede-proj-compiler-object-linkflags
86 (mapconcat 'identity
(oref this ldflags
) " ")))
87 (with-slots (ldlibs) this
89 (setq ede-proj-compiler-object-linkflags
90 (concat ede-proj-compiler-object-linkflags
92 (mapconcat 'identity ldlibs
" -l")))))
95 (defmethod project-debug-target ((obj ede-proj-target-makefile-program
))
96 "Debug a program target OBJ."
97 (let ((tb (get-buffer-create " *padt*"))
98 (dd (if (not (string= (oref obj path
) ""))
105 (setq default-directory dd
)
106 (setq cmd
(read-from-minibuffer
108 (concat (symbol-name ede-debug-program-function
)
109 " " (ede-target-name obj
))))
110 (funcall ede-debug-program-function cmd
))
113 (defmethod project-run-target ((obj ede-proj-target-makefile-program
) &optional command
)
114 "Run a program target OBJ.
115 Optional COMMAND is the command to run in place of asking the user."
117 (let ((tb (get-buffer-create " *padt*"))
118 (dd (if (not (string= (oref obj path
) ""))
125 (setq default-directory dd
)
126 (setq cmd
(or command
127 (read-from-minibuffer
129 (concat "./" (ede-target-name obj
)))))
130 (ede-shell-run-something obj cmd
)
134 (provide 'ede
/proj-prog
)
136 ;; arch-tag: 0bfa9364-f385-4745-a846-462146a79a25
137 ;;; ede/proj-prog.el ends here