1 ;;; ede-proj-prog.el --- EDE Generic Project program support
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2005, 2008, 2009
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.
29 (require 'ede/proj-obj)
32 (defclass ede-proj-target-makefile-program
33 (ede-proj-target-makefile-objectcode)
34 ((ldlibs :initarg :ldlibs
37 :custom (repeat (string :tag "Library"))
39 "Libraries, such as \"m\" or \"Xt\" which this program depends on.
40 The linker flag \"-l\" is automatically prepended. Do not include a \"lib\"
41 prefix, or a \".so\" suffix.
43 Note: Currently only used for Automake projects."
45 (ldflags :initarg :ldflags
48 :custom (repeat (string :tag "Link Flag"))
50 "Additional flags to add when linking this target.
51 Use ldlibs to add addition libraries. Use this to specify specific
52 options to the linker.
54 Note: Not currently used. This bug needs to be fixed.")
56 "This target is an executable program.")
58 (defmethod ede-proj-makefile-insert-automake-pre-variables
59 ((this ede-proj-target-makefile-program))
60 "Insert bin_PROGRAMS variables needed by target THIS."
61 (ede-pmake-insert-variable-shared "bin_PROGRAMS"
62 (insert (ede-name this)))
65 (defmethod ede-proj-makefile-insert-automake-post-variables
66 ((this ede-proj-target-makefile-program))
67 "Insert bin_PROGRAMS variables needed by target THIS."
68 (ede-pmake-insert-variable-shared
69 (concat (ede-name this) "_LDADD")
70 (mapc (lambda (c) (insert " -l" c)) (oref this ldlibs)))
71 ;; For other targets THIS depends on
75 ;;(ede-pmake-insert-variable-shared
76 ;; (concat (ede-name this) "_DEPENDENCIES")
77 ;; (mapcar (lambda (d) (insert d)) (oref this FOOOOOOOO)))
80 (defmethod ede-proj-makefile-insert-rules ((this ede-proj-target-makefile-program))
81 "Insert rules needed by THIS target."
82 (let ((ede-proj-compiler-object-linkflags
83 (mapconcat 'identity (oref this ldflags) " ")))
84 (with-slots (ldlibs) this
86 (setq ede-proj-compiler-object-linkflags
87 (concat ede-proj-compiler-object-linkflags
89 (mapconcat 'identity ldlibs " -l")))))
92 (defmethod project-debug-target ((obj ede-proj-target-makefile-program))
93 "Debug a program target OBJ."
94 (let ((tb (get-buffer-create " *padt*"))
95 (dd (if (not (string= (oref obj path) ""))
102 (setq default-directory dd)
103 (setq cmd (read-from-minibuffer
105 (concat (symbol-name ede-debug-program-function)
106 " " (ede-target-name obj))))
107 (funcall ede-debug-program-function cmd))
111 (provide 'ede/proj-prog)
113 ;;; ede/proj-prog.el ends here