1 ;;; ede-simple.el --- Overlay an EDE structure on an existing project
3 ;; Copyright (C) 2007 Eric M. Ludlam
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
6 ;; X-RCS: $Id: ede-simple.el,v 1.1 2007-11-26 15:22:10 michaels Exp $
8 ;; This program is free software; you can redistribute it and/or
9 ;; modify it under the terms of the GNU General Public License as
10 ;; published by the Free Software Foundation; either version 2, or (at
11 ;; your option) any later version.
13 ;; This program is distributed in the hope that it will be useful, but
14 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ;; General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 ;; Boston, MA 02110-1301, USA.
25 ;; A vast majority of projects use non-EDE project techniques, such
26 ;; as hand written Makefiles, or other IDE's.
28 ;; The EDE-SIMPLE project type allows EDE to wrap an existing mechanism
29 ;; with minimal configuration, and then provides project-root
30 ;; information to Semantic or other tools, and also provides structure
31 ;; information for in-project include header discovery, or speedbar
34 ;; It will also support a the minimal EDE UI for compilation and
38 (require 'cedet-files)
41 (add-to-list 'ede-project-class-files
42 (ede-project-autoload "simple-overlay"
43 :name "Simple" :file 'ede-simple
44 :proj-file 'ede-simple-projectfile-for-dir
45 :load-type 'ede-simple-load
46 :class-sym 'ede-simple-project)
49 (defcustom ede-simple-save-directory "~/.ede"
50 "*Directory where simple EDE project overlays are saved."
54 (defcustom ede-simple-save-file-name "ProjSimple.ede"
55 "*File name used for simple project wrappers."
60 (defun ede-simple-projectfile-for-dir (&optional dir)
61 "Return a full file name to the project file stored in the current directory.
62 The directory has three parts:
63 <STORAGE ROOT>/<PROJ DIR AS FILE>/ProjSimple.ede"
64 (when (not (file-exists-p ede-simple-save-directory))
65 (if (y-or-n-p (concat ede-simple-save-directory
66 " Doesn't exist. Create? "))
67 (make-directory ede-simple-save-directory)
68 (error "No save directory for new project")))
69 (let ((d (or dir default-directory))
73 (file-name-as-directory (expand-file-name ede-simple-save-directory))
74 ;; Convert directory to filename
75 (cedet-directory-name-to-file-name d)
77 ede-simple-save-file-name)
81 (defun ede-simple-load (dir)
82 "Load a project of type `Simple' for the directory DIR.
83 Return nil if there isn't one."
84 (let ((pf (ede-simple-projectfile-for-dir dir)))
86 (eieio-persistent-read pf))
89 (defclass ede-simple-target (ede-target)
91 "EDE Simple project target.
92 All directories need at least one target.")
95 (defclass ede-simple-project (eieio-persistent ede-project)
96 ((extension :initform ".ede")
97 (file-header-line :initform ";; EDE Simple Project")
99 "EDE Simple project class.
100 Each directory needs a a project file to control it.")
102 (defmethod ede-commit-project ((proj ede-simple-project))
103 "Commit any change to PROJ to its file."
104 (eieio-persistent-save proj))
107 (provide 'ede-simple)
109 ;;; ede-simple.el ends here