Initial Commit
[packages] / xemacs-packages / ede / ede-proj-skel.el
1 ;;; ede-proj-%NAME%.el --- EDE Generic Project ...
2
3 ;;;  Copyright (C) 1999, 2000, 2001  Eric M. Ludlam
4
5 ;; Author: Eric M. Ludlam <zappo@gnu.org>
6 ;; Keywords: project, make
7 ;; RCS: $Id: ede-proj-skel.el,v 1.1 2007-11-26 15:22:10 michaels Exp $
8
9 ;; This software 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 2, or (at your option)
12 ;; any later version.
13
14 ;; This software 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.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
21 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
23
24 ;;; Commentary:
25 ;;
26 ;; Handles ...
27 ;; in an EDE Project file.
28
29 ;; To use this skeleton file, replace all occurances of words in %PERCENT%
30 ;; with the proper named you wish to use.
31 ;;
32 ;; If a function is commented out, then you probably don't need to
33 ;; override it.  If it is not commented out, you probably need it, but
34 ;; there is no requirement that you impelement it.
35
36 (require 'ede-proj)
37
38 ;;; Code:
39 ;; This defines the class you will use.  In general, you probably
40 ;; want to inherit from `ede-proj-target-makefile', which has built it
41 ;; support for the creation of Makefile rules.  If your type will
42 ;; never use a Makefile, inherit from `ede-proj-target'.
43 (defclass ede-proj-target-%NAME% (ede-proj-target-%PARENT%)
44   (;; Use these two items to modify the target specificy menu.
45    ;;(menu :initform nil)
46    ;;(keybindings :initform nil)
47    (sourcetype :initform (ede-source-%NAME%))   
48    ;;(availablecompilers :initform (ede-%NAME%-compiler))
49    ;; Add your specialized fields here
50    )
51   "Class for ....")
52
53 ;; Register you class with the ede target manager.  This enables
54 ;; the creation of targets of your type for users.
55 (ede-proj-register-target "%NAME%" ede-proj-target-%NAME%)
56
57 ;;; COMPILER SUPPORT
58 ;;
59 ;; Support for specialized compilers for your object.
60
61 ;; Create an instance of a source code type which knows how to
62 ;; recognize your sourcecode.  The symbol created is used to cross
63 ;; reference targets compilers, and source files.
64 (defvar ede-source-%NAME%
65   (ede-sourcecode "ede-%NAME%-source"
66                   :name "%LONGNAME%"
67                   :sourcepattern "\\.%EXT%$"
68                   :garbagepattern '("*.%EXT%"))
69   "Emacs Lisp source code definition.")
70
71 ;; It should be very rare to need to create a subclass of the `ede-compiler'
72 ;; object.  Do this if you need to override any of the base methods following
73 ;; this definition.
74 ;;(defclass ede-compiler-%NAME% (ede-compiler)
75 ;;  ()
76 ;;  "Specialized compiler for %NAME%")
77
78 ;; This variable is important to set if you are planning on supporting 
79 ;; a compiled form of your sources via a Makefile or Makefile.am
80 ;; If you do not create or use a compiler, remove the compiler init line
81 ;; from the class you create.
82 ;; You may create as many compiler elements as may be available for the
83 ;; type of source code you are starting with.
84 ;;
85 ;; If you have your own compiler class, then use the correct class initializer
86 ;; below.
87 (defvar ede-%NAME%-compiler
88   (ede-compiler 
89    "ede-%NAME%-compiler"
90    :name "%NAME%"
91    :variables '(("%NAME-COMPILER%" . "%compiler-and-flags%"))
92    :commands
93    (list "$(%NAME-COMPILER%) -o $@ $^"
94          )
95    :autoconf '("AC_%COMPILER-MACRO-FOR-AUTONAME-OR-nil%"))
96   "Compiler that can be used with `ede-proj-target-%NAME%'.")
97
98 ;;(defmethod ede-proj-tweak-autoconf ((this ede-compiler-%NAME%))
99 ;;  "Tweak the configure file (current buffer) to accomodate THIS."
100 ;;  (%do-stuff%)
101 ;;  (call-next-method)
102 ;;  (%do-other-stuff%))
103 ;;
104 ;;(defmethod ede-proj-flush-autoconf ((this ede-compiler-%NAME%))
105 ;;  "Flush the configure file (current buffer) to accomodate THIS."
106 ;;  (%do-stuff%)
107 ;;  (call-next-method)
108 ;;  (%do-other-stuff%))
109 ;;
110 ;;(defmethod ede-proj-makefile-insert-variables ((this ede-compiler-%NAME%))
111 ;;  "Insert variables needed by the compiler THIS."
112 ;;  (call-next-method)
113 ;;  (ede-compiler-only-once
114 ;;     (%do-stuff%)))
115 ;;
116 ;;(defmethod ede-proj-makefile-insert-rules ((this ede-compiler-%NAME%))
117 ;;  "Insert rules needed for THIS compiler object."
118 ;;  (call-next-method)
119 ;;  (ede-compiler-only-once
120 ;;     (%do-stuff%)))
121 ;;
122 ;; This is the method you are most likely to need to override if
123 ;; you need to create your own compiler class.
124 ;;(defmethod ede-proj-makefile-insert-commands ((this ede-compiler-%NAME%))
125 ;;  "Insert the commands needed to use compiler THIS."
126 ;;  (%do-stuff%)
127 ;;  (call-next-method)
128 ;;  (%do-other-stuff%))
129
130 ;;; EIEIO maintenance methods
131 ;;
132
133 ;; The chances of needing to implement this are near zero, but if
134 ;; you need to perform some action when the user hits "apply", this
135 ;; is the way to do it.
136 ;;(defmethod eieio-done-customizing ((target ede-proj-target-%NAME%))
137 ;;  "Called when a user finishes customizing this target."
138 ;;  (call-next-method)
139 ;;  (%do-my-stuff%))
140
141 ;;; EDE target smarts methods
142 ;;
143
144 ;; NOTE: This method is not generally necessary because the work can be
145 ;;       accomplished with the :sourcetype class property.
146 ;; This function lets you define what types of files you want to claim.
147 ;; Defining this provides a convenience for uses by not offering your
148 ;; target type for files you don't care about.
149 ;; (defmethod ede-want-file-p ((obj ede-proj-target-%NAME%) file)
150 ;;  "Return t if OBJ wants to own FILE."
151 ;;  (string-match "\\.%MYEXTENSION%$" file))
152
153 ;; When a buffer is read in, EDE checks to see which target this
154 ;; buffer belongs to.  The default method for all targets checks
155 ;; the file name against the list of known source files.
156 ;; If your target has additional source files stored elsewhere,
157 ;; this is how you will check.
158 ;;(defmethod ede-buffer-mine ((this ede-proj-target-%NAME%) buffer)
159 ;;  "Return non-nil if object THIS lays claim to the file in BUFFER."
160 ;;  (or (call-next-method)
161 ;;      (%additional-checks-here%)
162 ;;      ))
163
164 ;; This function lets you take files being added to your target and
165 ;; stick them into different slots.  This is useful if you have
166 ;; compilable sources and auxiliary files related to compilation that
167 ;; do not directly get compiled.  (Although in that case, you probably
168 ;; want to extend `ede-proj-target-makefile-objectcode'
169 ;;(defmethod project-add-file ((this ede-proj-target-%NAME%) file)
170 ;;  "Add to target THIS the current buffer represented as FILE."
171 ;;  (if (not (%do-something-special%))
172 ;;      (call-next-method)
173 ;;    (%do-my-special-stuff%)))
174
175 ;; Reverse tactic as above.
176 ;;(defmethod project-remove-file  ((target ede-proj-target-makefile-objectcode)
177 ;;                                file)
178 ;;  "For TARGET, remove FILE."
179 ;;  (if (not (%do-something-special%))
180 ;;      (call-next-method)
181 ;;    (%do-my-special-stuff%)))
182
183 ;; Provides a simple hook to do cleanup work if this target is deleted
184 ;; from a project.
185 ;;(defmethod project-delete-target ((this ede-proj-target-%NAME%))
186 ;;  "Delete THIS target from its parent project."
187 ;;  (%cleanup%)
188 ;;  (call-next-method))
189
190 ;;; EDE target do user stuff methods
191 ;;
192
193 ;; This method lets you control what commands are run when a user
194 ;; wants to compile your target.  If you inherit from a makefile
195 ;; target, then you can use "call-next-method" with a new
196 ;; command if needed, or just comment this out.
197 ;;(defmethod project-compile-target ((obj ede-proj-target-%NAME%)
198 ;;                                   &optional command)
199 ;;  "Compile the current target OBJ.
200 ;;Argument COMMAND is the command to use for compiling the target
201 ;;if the user, or child class wishes to modify it."
202 ;;  (or (call-next-method %"new command string"%)
203 ;;      (project-compile-project (ede-current-project) %"some command"%)
204 ;;      (%do-stuff%)))
205
206 ;; This method lets you define how the target reacts to a debug
207 ;; command.  Comment this out if you do not support a debugger.
208 ;; If you don't support debugging, don't forget to also remove
209 ;; any specialized keybindings and menu items in the class definition.
210 (defmethod project-debug-target ((obj ede-proj-target-%NAME%))
211   "Run the current target OBJ in an debugger."
212   (%do-stuff%))
213
214 ;;; EDE project makefile code generation methods
215 ;;
216
217 ;; The name of the variable used in a Makefile for your main sources.
218 ;; Attempt to use automake conventions so that your target is easy to
219 ;; port when/if automake is supported by ede-proj.
220 (defmethod ede-proj-makefile-sourcevar ((this ede-proj-target-%NAME%))
221   "Return the variable name for THIS's sources."
222   (concat (ede-pmake-varname this) "_%AUTOMAKE-VARIABLE-CONVENTION%"))
223
224 ;; Your main target in the Makefile may depend on additional source
225 ;; dependencies.  Use this to add more stuff.
226 ;;(defmethod ede-proj-makefile-dependency-files ((this ede-proj-target-%NAME%))
227 ;;  "Return a list of source files to convert to dependencies.
228 ;;Argument THIS is the target to get sources from."
229 ;;  (append (call-next-method) (%get-more-dependencies%)))
230
231 ;; This is a clever way of packing more files into your main source
232 ;; variable.  Only works if your "next" method is ede-proj-target.
233 ;;(defmethod ede-proj-makefile-insert-source-variables
234 ;;           ((this ede-proj-target-%NAME%) &optional moresource)
235 ;;  "Insert variables needed by target THIS."
236 ;;  (call-next-method this (oref this %moresourceslotname%))
237
238 ;; This method lets you add more variables specific to your type of target.
239 ;;(defmethod ede-proj-makefile-insert-variables ((this ede-proj-target-%NAME%)
240 ;;                                                &optional moresource)
241 ;;  "Insert variables needed by target THIS."
242 ;;  (call-next-method)
243 ;;  (insert "other variable thing"))
244
245 ;; This returns a string for the dependencies as they 
246 (defmethod ede-proj-makefile-dependencies ((this ede-proj-target-%NAME%))
247   "Return a string representing the dependencies for THIS."
248   (or (call-next-method)
249       (%do-some-stuff%)))
250
251 ;; This is one of the most important methods which defines rules to
252 ;; place into a makefile for building.  If you inherit from
253 ;; `ede-proj-target-makefile', then this is the primary build
254 ;; mechanism.  If you can create a compiler object instead, then
255 ;; you probably don't have to do anything with this method.
256 ;; If you have an emacs-centric build method, then this
257 ;; is a secondary build method (for a distribution, for example.)
258 ;; It can also contain auxiliary make commands in addition to
259 ;; the main rules needed if not covered by the compiler object.
260 ;;(defmethod ede-proj-makefile-insert-rules ((this ede-proj-target-%NAME%))
261 ;;  "Insert rules needed by THIS target."
262 ;;  (insert ... ;; Create aux rules here
263 ;;        )
264 ;;  (call-next-method) ;; catch user-rules case and build main rules
265 ;;  (insert ... ;; Code to fill in the commands, or add more rules later.
266 ;;        ))
267
268 ;; This function allows modifictions to configure.in.
269 ;; Only useful when a user specifies automake mode in EDE project.
270 ;; This may not be necessary, but is needed if special programs,
271 ;; libraries, header files, or other configurable items are needed.
272 ;;
273 ;; See the autoconf editing routines, most of which are safe
274 ;; to call multiple times.
275 ;(defmethod ede-proj-tweak-autoconf ((this ede-proj-target-%NAME%))
276 ;  "Tweak the configure file (current buffer) to accomodate THIS."
277 ;  (autoconf-...)
278 ;  )
279
280 ;; This function allows the target to flush left overs.
281 ;; ie, if a previous configuration included some macro, then
282 ;;     you can remove it with this one.
283 ;; A subsequent call to `ede-proj-tweak-autoconf' will restore
284 ;; any changes if needed.
285 ;(defmethod ede-proj-flush-autoconf ((this ede-proj-%NAME%))
286 ;  "Flush the configure file (current buffer) to accomodate THIS."
287 ;  nil)
288
289 ;; This function is used to find a header file in which prototypes from
290 ;; BUFFER go.  This is used by advanced features for which this type
291 ;; of behavior is useful.  This feature is used mainly by tools
292 ;; using the SEMANTIC BOVINATOR http://cedet.sourceforge.net/semantic.shtml
293 ;; to perform advanced language specific actions.
294 ;;(defmethod ede-buffer-header-file((this ede-proj-target-%NAME%) buffer)
295 ;;  "Return the name of a file in which prototypes go."
296 ;;  (oref this ...))
297
298 ;; This function is used to return documentation files.  If this target
299 ;; contains documentation files, then return those files.  If this target
300 ;; does not provide documentation, delete this method.
301 ;;(defmethod ede-documentation ((this ede-target-%NAME%))
302 ;;  "Return a list of files that provides documentation.
303 ;;Documentation is not for object THIS, but is provided by THIS for other
304 ;;files in the project."
305 ;;  nil)
306
307 ;;; EDE speedbar browsing enhancements
308 ;;
309 ;; In general, none of these need to be defined unless your have slots
310 ;; for auxiliary source files.
311
312 ;; This lets you add buttons of things your target contains which may
313 ;; not be shown be default.
314 ;;
315 ;; You will need to tweak the functions used when clicking on the
316 ;; expand icon (maybe) and the item name (maybe). Leave those alone
317 ;; if they are simple source files.
318 ;;(defmethod eieio-speedbar-child-make-tag-lines ((this ede-proj-target-%NAME%))
319 ;;  "Create buttons for items belonging to THIS."
320 ;;  (call-next-method) ;; get the default buttons inserted.
321 ;;  (with-slots (%SOME-SLOTS%) this
322 ;;    (mapcar (lambda (car)
323 ;;              (speedbar-make-tag-line 'bracket ?+
324 ;;                                      'ede-tag-file
325 ;;                                      (concat (oref this :path) car)
326 ;;                                      car
327 ;;                                      'ede-file-find
328 ;;                                      (concat (oref this :path) car)
329 ;;                                      'speedbar-file-face depth))
330 ;;            %A-SLOT%)))
331
332 (provide 'ede-proj-%NAME%)
333
334 ;;; ede-proj-%NAME%.el ends here