Commit | Line | Data |
---|---|---|
acc33231 CY |
1 | ;;; ede-proj-prog.el --- EDE Generic Project program support |
2 | ||
3 | ;;; Copyright (C) 1998, 1999, 2000, 2001, 2005, 2008 | |
4 | ;;; Free Software Foundation, Inc. | |
5 | ||
6 | ;; Author: Eric M. Ludlam <zappo@gnu.org> | |
7 | ;; Keywords: project, make | |
8 | ||
9 | ;; This file is part of GNU Emacs. | |
10 | ||
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. | |
15 | ||
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. | |
20 | ||
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/>. | |
23 | ||
24 | ;;; Commentary: | |
25 | ;; | |
26 | ;; Handle building programs from object files in and EDE Project file. | |
27 | ||
28 | (require 'ede/pmake) | |
29 | (require 'ede/proj-obj) | |
30 | ||
31 | ;;; Code: | |
32 | (defclass ede-proj-target-makefile-program | |
33 | (ede-proj-target-makefile-objectcode) | |
34 | ((ldlibs :initarg :ldlibs | |
35 | :initform nil | |
36 | :type list | |
37 | :custom (repeat (string :tag "Library")) | |
38 | :documentation | |
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. | |
42 | ||
43 | Note: Currently only used for Automake projects." | |
44 | ) | |
45 | (ldflags :initarg :ldflags | |
46 | :initform nil | |
47 | :type list | |
48 | :custom (repeat (string :tag "Link Flag")) | |
49 | :documentation | |
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. | |
53 | ||
54 | Note: Not currently used. This bug needs to be fixed.") | |
55 | ) | |
56 | "This target is an executable program.") | |
57 | ||
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))) | |
63 | (call-next-method)) | |
64 | ||
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 | |
72 | ;; | |
73 | ;; NOTE: FIX THIS | |
74 | ;; | |
75 | ;;(ede-pmake-insert-variable-shared | |
76 | ;; (concat (ede-name this) "_DEPENDENCIES") | |
77 | ;; (mapcar (lambda (d) (insert d)) (oref this FOOOOOOOO))) | |
78 | (call-next-method)) | |
79 | ||
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 | |
85 | (if ldlibs | |
86 | (setq ede-proj-compiler-object-linkflags | |
87 | (concat ede-proj-compiler-object-linkflags | |
88 | " -l" | |
89 | (mapconcat 'identity ldlibs " -l"))))) | |
90 | (call-next-method))) | |
91 | ||
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) "")) | |
96 | (oref obj path) | |
97 | default-directory)) | |
98 | (cmd nil)) | |
99 | (unwind-protect | |
100 | (progn | |
101 | (set-buffer tb) | |
102 | (setq default-directory dd) | |
103 | (setq cmd (read-from-minibuffer | |
104 | "Run (like this): " | |
105 | (concat (symbol-name ede-debug-program-function) | |
106 | " " (ede-target-name obj)))) | |
107 | (funcall ede-debug-program-function cmd)) | |
108 | (kill-buffer tb)))) | |
109 | ||
110 | ||
111 | (provide 'ede/proj-prog) | |
112 | ||
113 | ;;; ede/proj-prog.el ends here |