1 \input texinfo @c -*-texinfo-*-
3 @c $Id: ede.texi,v 1.1 2007-11-26 15:22:13 michaels Exp $
6 @settitle Emacs Development Environment
11 * ede: (ede). Objects for Emacs
18 @center @titlefont{ede}
19 @vskip 0pt plus 1 fill
20 Copyright @copyright{} 1998, 1999, 2000, 2001, 2004, 2005 Eric M. Ludlam
25 @node top, EDE Project Concepts, (dir), (dir)
26 @comment node-name, next, previous, up
28 EDE is a collection of definitions called the
29 @emph{Emacs Development Extensions}. EDE provides the gloss that
30 simplifies the learning curve for all the very useful functionality of
31 building and debugging under emacs. In doing so it attempts to emulate
32 a typical IDE (Integrated Development Environment). What this means is
33 that EDE will manage or create your makefiles and other building
34 environment duties so the developer can concentrate on code, and not
35 support files. In doing so, it will be much easier for new programmers
36 to learn and adopt the GNU ways of doing things.
40 * EDE Project Concepts:: EDE Project Concepts
41 * EDE Mode:: Turning on EDE mode.
42 * Creating a project:: Creating a project.
43 * Modifying your project:: Adding and removing files and targets.
44 * Building and Debugging:: Initiating a build or debug session.
45 * Miscellaneous commands:: Other project related commands.
46 * Project types:: There are different types of projects.
47 * Extending EDE:: Programming tips when extending.
54 --- The Detailed Node Listing ---
56 Modifying your project
60 * Customize Features::
61 * EDE Project Features::
65 * Changing Compilers and Flags::
70 * Make and Automake projects:: Project types of @samp{ede-project}
71 * Automake direct projects:: Project interface on hand-written automake files.
75 * User interface methods:: Methods associated with keybindings
76 * Base project methods:: The most basic methods on EDE objects.
77 * Sourcecode objects:: Defining new sourcecode classes.
78 * Compiler and Linker objects:: Defining new compilers and linkers.
82 * Project :: The different project types.
83 * Targets :: The different target types.
84 * Sourcecode :: Source Code management types.
85 * Compilers :: Compiler management types.
90 @node EDE Project Concepts, EDE Mode, top, top
91 @chapter EDE Project Concepts
93 EDE is a generic interface for managing projects. In other words,
94 there is one set of menus and keybindings specified by EDE, but there
95 are multiple ways a project can be expressed via a build system.
97 You can learn about multiple @ref{Project types}, or the specific
98 build or debug commands in other chapters.
100 In EDE, a project hierarchy matches a directory hierarchy. There
101 would be a project root, and subprojects in different subdirectories.
103 Within each project, there can be multiple targets. A target at the
104 simplest level is a named collection of files within a project. There
105 are two important reasons for specifying a target.
109 A collection of files to be added to a distribution.
111 A collection of files that can be built into something else.
114 If you intend to write code, and have it tarred up and distributed
115 under the GPL, all important files must be a part of some target so
116 that they will be added to the distribution file.
118 Targets that are lists of files that can be built into something else
119 will also be distributed, but the build process will also convert
120 those files into some specified built thing, such as a program or
121 compiled documentation.
123 Lastly, EDE provides a way for other tools to easilly learn file
124 associations. For example, a program might need to restrict some sort
125 of search to files in a single target, or need to discover the
126 location of documentation or interface files. EDE can provide this
129 @node EDE Mode, Creating a project, EDE Project Concepts, top
132 EDE is implemented as a minor-mode, which augments other modes such as C
133 mode, and Texinfo mode. You can turn EDE on for all buffers by running
134 the command @code{global-ede-mode}, or by putting this in your
135 @file{~/.emacs} file.
142 When EDE is active for a given buffer, the menu item ``Project''
143 appears. This menu contains several high-level functions to make
144 working on a code set easier. These items and keybindings never change
145 regardless of the type of project you are actually working on.
147 The @file{ede.el} file is a minimal set of loading routines. When
148 different types of projects are encountered, source code for those
149 projects are loaded at that time.
151 @node Creating a project, Modifying your project, EDE Mode, top
152 @chapter Creating a project
154 To create a new project, first load a file you would want in that
155 project into a buffer. If you have a hierarchy of directories, choose
156 a file in the topmost directory first. From this buffer, run
159 EDE can support several types of projects. When creating a new
160 project with the command @command{ede-new} you must choose the type of
161 project you would like to create. @xref{Project types}.
163 Each type has it's own benefits or language specific enhancements. You
164 will be prompted for the type of project you would like to create. The
165 simplest and most language agnostic project type is @emph{Make}. A
166 derivation of this is the @samp{Automake} type.
168 Not all project types can be created in this way. For example, there
169 are two ways to handle Automake based projects. One is by making an
170 @emph{Automake} project with @command{ede-new}. The other is to just write
171 some automake files which EDE with automatically detect this, and put
172 you into a different Automake mode. Any GNU project using Automake
173 will be detected in this way, and you can use EDE to modify those
176 @section Creating a subproject
178 A subproject is merely a project in a subdirectory of another project.
179 You can create a subproject by using the @command{ede-new} command (or
180 @samp{"Create Project"} from the menu) while a in a subdirectory below
181 an existing project. This new project will be automatically added to
182 the parent project, and will be automatically loaded when the parent
185 When using a project command that invovles a makefile, EDE uses
186 the top-most project's makefile as a starting place for the build. How
187 the toplevel project handles subprojects in the build process is
188 dependendent on that project's type.
190 @node Modifying your project, Building and Debugging, Creating a project, top
191 @chapter Modifying your project
193 Your project and targets are systems with lots of options. Generic
194 features are listed here. You will need to read sections on specific
195 project types for detailed information on the project you might be
199 * Add/Remove target::
201 * Customize Features::
202 * EDE Project Features::
205 @node Add/Remove target, Add/Remove files, Modifying your project, Modifying your project
206 @section Add/Remove target
208 A project with no targets isn't very useful, so you can use EDE to add
209 and remove targets from your project.
211 You can create a new target with the @command{ede-new-target} command
212 @kbd{C-c . t}. If appropriate you will be given the option to add the
213 current buffer into the newly created target.
215 When creating a target, you will be given an option list of target
216 types. Each target type will have its own build process and class of
217 files it will accept.
219 You can remove a target with the command @code{ede-delete-target}.
221 The add and remove commands are in the @samp{Project->Project Options}
224 @node Add/Remove files, Customize Features, Add/Remove target, Modifying your project
225 @section Add/Remove files
227 A target with no files isn't very useful, so you can use EDE to add
228 and remove files to targets. Sometimes files can belong to multiple
229 targets, and that is ok.
231 You can add files into targets with the command @command{ede-add-file}
232 bound to @kbd{C-c . a}. If there are no targets created that you
233 wish to use, you can type in @samp{new target} to create a new target
234 apropriate for the file you are adding.
236 You can remove files from a target with the @command{ede-remove-file}
237 bound to @kbd{C-c . d}. If the file is in multiple targets, it will
238 query for every target it could be removed from.
240 When you are working in a project, if you load a new file into a
241 buffer that is not a part of an active target, EDE will automatically
242 remind you to add it to a target of your choosing. If you do not wish
243 to add it to a target, you can choose @samp{none}. You can customize
244 the behavior with the variable @command{ede-auto-add-method}.
246 @node Customize Features, EDE Project Features, Add/Remove files, Modifying your project
247 @section Customize Features
249 A project, and it's targets, are objects using the @samp{EIEIO} object
250 system. @xref{(eieio)EIEIO}. These objects have data fields containing
251 important information related to your work.
253 If the high-level functions aren't enough, you can tweak all
254 user-customizable fields at any time by running the command
255 @command{customize-project} or @command{customize-target}. This will
256 load the current project or target into a @emph{customization buffer}
257 where you tweak individual slots. This is usually necessary for
258 project modes that are very complex.
260 Some project modes do not have a project file, but directly read a
261 Makefile, or existing file. Instead of letting you directly edit the
262 object, you can edit the file. Use the command
263 @command{ede-edit-file-target} bound to @kbd{C-c . e}.
265 @node EDE Project Features, , Customize Features, Modifying your project
266 @section EDE Project Features
268 This section details user facing features of an EDE @samp{Make} style
269 project. The specified options may be the same as in a
270 @samp{Automake} project, but are not the same as in an direct Automake
273 To modify any of the specific features mentioned here, you need to
274 customize the project or target with @command{customize-project} or
275 @command{customize-target}.
277 When you are customizing, you are directly manipulating slot values in
278 EIEIO objects. If you are interested in additional details, see
282 * Changing Compilers and Flags::
286 @node Changing Compilers and Flags, Configurations, EDE Project Features, EDE Project Features
287 @subsection Changing Compilers and Flags
289 Targets that build stuff need compilers. To change compilers, you
290 need to customize the desired target.
292 In the @samp{[Make]} section, you can then choose a new compiler or
293 linker from the list. If a linker you need is not available, you will
294 need to create a new one. @ref{Compiler and Linker objects}.
296 If an existing compiler or linker is close, but you need to modify
297 some flag set such as adding an include path you will need to add a
298 configuration variable.
300 To start, you should create the basic setup, and construct a makefile
301 with @command{ede-proj-regenerate}. Look in the @file{Makefile} to
302 see what commands are inserted. Once you have determined the variable
303 you need to modify, you can add a configuration for it.
304 @ref{Configurations}.
306 @node Configurations, , Changing Compilers and Flags, EDE Project Features
307 @subsection Configurations
309 Configurations specify different ways to build a project. For
310 example, you may configure a project to be in ``debug'' mode, or
311 perhaps in ``release'' mode.
313 The project, and each target type all have a slot named
314 @code{configuration-variables}. To add new variables to a
315 configuration find this slot in the custom buffer, and insert a new
316 configuration. Name it either ``debug'' or ``release'', then insert
317 some number of name/value pairs to it.
319 You can have any number of valid configurations too. To add a new
320 configuration, customize your project. Work in the @samp{[Settings]}
321 block for ``configurations''. Add a new named configuration here.
323 To switch between different active conifigurations, modify the
324 ``configuration default'' slot.
326 @node Building and Debugging, Miscellaneous commands, Modifying your project, top
327 @chapter Building and Debugging
329 EDE assumes you are writing some sort of program, so attempts to
330 facilitate this activity. EDE will associate the current buffer with a
331 target. The target then knows how to compile or debug the given source
334 The following commands enable compilation and debugging.
338 Compile the current target.
340 Compile the entire project.
342 Debug the current target.
344 Build a distribution file for your project.
347 These commands, plus project or target specific options are available
348 in the @samp{Project} menu.
350 @node Miscellaneous commands, Project types, Building and Debugging, top
351 @chapter Miscellaneous commands
355 If you opt to go in and edit EDE project files directly, perhaps with
356 the @command{ede-edit-file-target}, you will need to have Emacs rescan
357 the project files to update the internal data structures.
359 Use @command{ede-rescan-toplevel} bound to @kbd{C-c . g} to refresh
364 EDE also supports the speedbar package. While speedbar works great
365 against directories already, EDE provides a project display mode.
366 This lets you look at your source files as they are structured in your
367 project. Thus, where many files may be clumped together in one
368 directory, the Project view will provide a hierarchical view of your
369 files as grouped by target.
371 You can activate speedbar in this mode with the command
372 @command{ede-speedbar}. This is bound to @kbd{C-c . s}.
374 @node Project types, Extending EDE, Miscellaneous commands, top
375 @chapter Project types
377 There are two types of project modes currently. One is
378 @samp{ede-project}, and shows up as @samp{Make} and @samp{Automake}
379 when creating new projects.
381 The other is project type handles automake projects directly from the
382 automake files. EDE cannot make new projects of this type, assuming
383 the user will do it themselves. Use @samp{ede-project} in
384 @samp{Automake} mode to have EDE create @file{Makefile.am} file, and a
385 @file{configure.in} file.
389 * Make and Automake projects:: Project types of @samp{ede-project}
390 * Automake direct projects:: Project interface on hand-written automake files.
393 @node Make and Automake projects, Automake direct projects, Project types, Project types
394 @section Make and Automake projects
396 A project of @samp{ede-project} type creates a file called
397 @file{Project.ede} in every project directory. This is used to track
398 your configureation information. If you configure this project to be
399 in @samp{Makefile} mode, then this project will autogenerate a
400 @file{Makefile}. If you configure it in @samp{Automake} mode a
401 @file{Makefile.am} file will be created. The automake bootstrapping
402 routines will also improt and maintain a configure.am script and a
403 host of other files required by Automake.
405 @node Automake direct projects, , Make and Automake projects, Project types
406 @section Automake direct projects
408 The project type that reads @file{Makefile.am} directly is derived
409 from the sources of the original @file{project-am.el} mode that was
410 distributed independently. This mode eventually became EDE. The
411 @samp{project-am} project will read existing automake files, but will
412 not generate them automatically, or create new ones. As such, it is
413 useful as a browsing tool, or as maintenance in managing file lists.
415 @node Extending EDE, Project, Project types, top
416 @chapter Extending EDE
418 This chapter is intended for users who want to write new parts or fix
419 bugs in EDE. A knowledge of Emacs Lisp, and some EIEIO(CLOS) is
422 EDE's dependance on EIEIO, the CLOS package for Emacs lets EDE define
423 two object superclasses, specifically the PROJECT and TARGET. All
424 commands in EDE are usually meant to address the current project, or
427 All specific projects in EDE derive subclasses of the EDE superclasses.
428 In this way, specific behaviors such as how a project is saved, or how a
429 target is compiled can be customized by a project author in detail. EDE
430 communicates to these project objects via an API using methods. The
431 commands you use in EDE mode are high-level functional wrappers over
432 these methods. For details on different types of projects,
433 @ref{Project types}. @ref{(eieio)Top}. For details on using EIEIO to
434 extending classes, and writing methods.
436 If you intend to exted EDE, it is most likely that a new target type is
437 needed in one of the existing project types. The rest of this chapter
438 will discuss extending the @code{ede-project} class, and it's targets.
439 See @file{project-am.el} for basic details on adding targets to it.
441 For the @code{ede-project} type, the core target class is called
442 @code{ede-proj-target}. Inheriting from this will give you everything
443 you need to start, including adding your sources into the makefile. If
444 you also need additional rules in the makefile, you will want to inherit
445 from @code{ede-proj-target-makefile} instead. You may want to also add
446 new fields to track important information.
448 If you are building currently unsuported code into a program or shared
449 library, it is unlikely you need a new target at all. Instead you
450 would need to create a new compiler or linker object that compiles
451 source code of the desired type. @ref{Compiler and Linker objects}.
453 Once your new class exists, you will want to fill in some basic methods.
454 See the @file{ede-skel.el} file for examples of these. The files
455 @file{ede-proj-info.el} and @file{ede-proj-elisp.el} are two interesting
459 * User interface methods:: Methods associated with keybindings
460 * Base project methods:: The most basic methods on EDE objects.
461 * Sourcecode objects:: Defining new sourcecode classes.
462 * Compiler and Linker objects:: Defining new compilers and linkers.
465 @node User interface methods, Base project methods, Extending EDE, Extending EDE
466 @section User interface methods
468 These methods are core behaviors associated with user commands.
469 If you do not implement a method, there is a resonable default that
470 may do what you need.
473 @item project-add-file
474 Add a file to your project. Override this if you want to put new
475 sources into different fields depending on extension, or other details.
476 @item project-remove-file
477 Reverse of project-add-file.
478 @item project-compile-target
479 Override this if you want to do something special when the user
480 "compiles" this target.
481 @item project-debug-target
482 What to do when a user wants to debug your target.
483 @item project-update-version
484 Easily update the version number of your project.
485 @item project-edit-file-target
486 Edit the file the project's information is stored in.
487 @item project-new-target
488 Create a new target in a project.
489 @item project-delete-target
490 Delete a target from a project.
491 @item project-make-dist
492 Make a distribution (tar archive) of the project.
494 Rescan a project file, changing the data in the existing objects.
497 @node Base project methods, Sourcecode objects, User interface methods, Extending EDE
498 @section Base project methods
500 These methods are important for querying base information from project
505 Return a string that is the name of this target.
506 @item ede-target-name
507 Return a string that is the name of the target used by a Make system.
508 @item ede-description
509 A brief description of the project or target. This is currently used
510 by the @samp{ede-speedbar} interface.
511 @item ede-want-file-p
512 Return non-nil if a target will accept a given file.
513 It is generally unecessary to override this. See the section on source
515 @item ede-buffer-mine
516 Return non-nil if a buffer belongs to this target. Used during
517 association when a file is loaded. It is generally unecessary to
518 override this unless you keep auxilliary files.
521 These methods are used by the semantic package extentions @xref{(semantic)Top}.
524 @item ede-buffer-header-file
525 Return a header file belonging to a given buffer. Prototypes are place
526 there when appropriate
527 @item ede-buffer-documentation-files
528 Return the documentation file information about this file would be
530 @item ede-documentation
531 List all documentation a project or target is responsible for.
534 @node Sourcecode objects, Compiler and Linker objects, Base project methods, Extending EDE
535 @section Sourcecode objects
537 EDE projects track source file / target associates via source code
538 objects. The definitions for this is in @file{ede-source.el}. A source
539 code object contains methods that know how to identify a file as being
540 of that class, (ie, a C file ends with @file{.c}). Some targets can
541 handle many different types of sources which must all be compiled
542 together. For example, a mixed C and C++ program would have
543 instantiations of both sourcecode types.
545 When a target needs to know if it will accept a source file, it
546 references its list of source code objects. These objects then make
549 Source code objects are stored in the target objects as a list of
550 symbols, where the symbol's value is the object. This enables the
551 project save file mechanism to work.
553 Here is an example for an instantiation of an Emacs Lisp source code object:
556 (defvar ede-source-emacs
557 (ede-sourcecode "ede-emacs-source"
559 :sourcepattern "\\.el$"
560 :garbagepattern '("*.elc"))
561 "Emacs Lisp source code definition.")
564 If you want to recycle parts of an existing sourcecode object, you can
565 clone the original, and then just tweak the parts that are different.
569 (defvar ede-source-emacs-autoload
570 (clone ede-source-emacs "ede-source-emacs-autoload"
571 :name "Emacs Lisp Autoload"
572 :sourcepattern "-loaddefs\\.el")
573 "Emacs Lisp autoload source code.")
576 In this case, the garbage pattern is the same.
580 @node Compiler and Linker objects, , Sourcecode objects, Extending EDE
581 @section Compiler and Linker objects
583 In order for a target to create a @file{Makefile}, it must know how to
584 compile the sources into the program or desired data file, and
585 possibly link them together.
587 A compiler object instantiation is used to associate a given target
588 with a given source code type. Some targets can handle many types of
589 sources, and thus has many compilers available to it. Some targets
590 may have multiple compilers for a given type of source code.
592 EDE will examine the actual source files in a target, cross reference
593 that against the compiler list to come up with the final set of
594 compilers that will be inserted into the Makefile.
596 Compiler instantiations must also insert variables specifying the
597 compiler it plans to use, in addition to creating Automake settings for
598 @file{configure.in} when appropriate.
600 Compiler objects are stored in the target objects as a list of
601 symbols, where the symbols value is the object. This enables the
602 project output mechanism to work more efficiently.
604 Targets will also have a special "compiler" slot which lets a user
605 explicitly choose the compiler they want to use.
607 Here is an example for texinfo:
610 (defvar ede-makeinfo-compiler
612 "ede-makeinfo-compiler"
614 :variables '(("MAKEINFO" . "makeinfo"))
615 :commands '("makeinfo -o $@ $<")
616 :autoconf '(("AC_CHECK_PROG" . "MAKEINFO, makeinfo"))
617 :sourcetype '(ede-makeinfo-source)
619 "Compile texinfo files into info files.")
624 When creating compiler instatiations, it may be useful to @code{clone}
625 an existing compiler variable. Cloning allows you to only modify
626 parts of the original, while keeping the rest of the same.
627 Modification of the original will result in the clone also being
628 changed for shared value slots.
630 The second important object is the linker class. The linker is similar
631 to the compiler, except several compilers might be used to create some
632 object files, and only one linker is used to link those objects together.
634 See @file{ede-proj-obj.el} for examples of the combination.
636 @section Class hierarchies
639 * Project :: The different project types.
640 * Targets :: The different target types.
641 * Sourcecode :: Source Code management types.
642 * Compilers :: Compiler management types.
650 @node Project, Targets, Extending EDE, top
653 @include ede-projects.texi
655 @node Targets, Sourcecode, Project, top
658 @include ede-targets.texi
660 @node Sourcecode, Compilers, Targets, top
663 The source code type is an object designed to associated files with
666 @include ede-sourcecode.texi
668 @node Compilers, , Sourcecode, top
671 The compiler object is designed to associate source code with
672 compilers. The target then references the compilers it can use.
673 When the makefile is created, this object type knows how to create
676 @include ede-compilers.texi