]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/ede/proj.el
Update copyright year to 2015
[gnu-emacs] / lisp / cedet / ede / proj.el
index 40e6165251cba761078cac6f7e965e9ed515399b..1ea165704673a9163b9b00a93ab130007d6d98d1 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ede/proj.el --- EDE Generic Project file driver
 
-;; Copyright (C) 1998-2003, 2007-201 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2003, 2007-2015 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
 (autoload 'ede-proj-target-makefile-info "ede/proj-info"
   "Target class for info files." nil nil)
 
+(eieio-defclass-autoload 'ede-proj-target-aux '(ede-proj-target)
+  "ede/proj-aux"
+  "Target class for a group of lisp files.")
+(eieio-defclass-autoload 'ede-proj-target-elisp '(ede-proj-target-makefile)
+  "ede/proj-elisp"
+  "Target class for a group of lisp files.")
+(eieio-defclass-autoload 'ede-proj-target-elisp-autoloads '(ede-proj-target-elisp)
+  "ede/proj-elisp"
+  "Target class for generating autoload files.")
+(eieio-defclass-autoload 'ede-proj-target-scheme '(ede-proj-target)
+  "ede/proj-scheme"
+  "Target class for a group of lisp files.")
+(eieio-defclass-autoload 'ede-proj-target-makefile-miscelaneous '(ede-proj-target-makefile)
+  "ede/proj-misc"
+  "Target class for a group of miscellaneous w/ a special makefile.")
+(eieio-defclass-autoload 'ede-proj-target-makefile-program '(ede-proj-target-makefile-objectcode)
+  "ede/proj-prog"
+  "Target class for building a program.")
+(eieio-defclass-autoload 'ede-proj-target-makefile-archive '(ede-proj-target-makefile-objectcode)
+  "ede/proj-archive"
+  "Target class for building an archive of object code.")
+(eieio-defclass-autoload 'ede-proj-target-makefile-shared-object '(ede-proj-target-makefile-program)
+  "ede/proj-shared"
+  "Target class for building a shared object.")
+(eieio-defclass-autoload 'ede-proj-target-makefile-info '(ede-proj-target-makefile)
+  "ede/proj-info"
+  "Target class for info files.")
+
+;; Not in ede/ , but part of semantic.
+(eieio-defclass-autoload 'semantic-ede-proj-target-grammar '(ede-proj-target-elisp)
+  "semantic/ede-grammar"
+  "Target classfor Semantic grammar files.")
+
 ;;; Class Definitions:
 (defclass ede-proj-target (ede-target)
   ((auxsource :initarg :auxsource
@@ -71,6 +104,7 @@ distributed, and each should have a corresponding rule to build it.")
             :initform nil
             :type (or null symbol)
             :custom (choice (const :tag "None" nil)
+                            (symbol :tag "Custom Compiler Symbol")
                             :slotofchoices availablecompilers)
             :label "Compiler for building sources"
             :group make
@@ -83,6 +117,7 @@ of these compiler resources, and global customization thereof.")
             :initform nil
             :type (or null symbol)
             :custom (choice (const :tag "None" nil)
+                            (symbol :tag "Custom Linker Symbol")
                             :slotofchoices availablelinkers)
             :label "Linker for combining intermediate object files."
             :group make
@@ -181,8 +216,10 @@ This enables the creation of your target type."
       (setq ede-proj-target-alist
            (cons (cons name class) ede-proj-target-alist)))))
 
-(defclass ede-proj-project (ede-project)
-  ((makefile-type :initarg :makefile-type
+(defclass ede-proj-project (eieio-persistent ede-project)
+  ((extension :initform ".ede")
+   (file-header-line :initform ";; EDE Project Files are auto generated: Do Not Edit")
+   (makefile-type :initarg :makefile-type
                  :initform Makefile
                  :type symbol
                  :custom (choice (const Makefile)
@@ -259,28 +296,21 @@ If optional ROOTPROJ is provided then ROOTPROJ is the root project
 for the tree being read in.  If ROOTPROJ is nil, then assume that
 the PROJECT being read in is the root project."
   (save-excursion
-    (let ((ret nil)
+    (let ((ret (eieio-persistent-read (concat project "Project.ede")
+                                     ede-proj-project))
          (subdirs (directory-files project nil "[^.].*" nil)))
-      (set-buffer (get-buffer-create " *tmp proj read*"))
-      (unwind-protect
-         (progn
-           (insert-file-contents (concat project "Project.ede")
-                                 nil nil nil t)
-           (goto-char (point-min))
-           (setq ret (read (current-buffer)))
-           (if (not (eq (car ret) 'ede-proj-project))
-               (error "Corrupt project file"))
-           (setq ret (eval ret))
-           (oset ret file (concat project "Project.ede"))
-           (oset ret directory project)
-           (oset ret rootproject rootproj)
-           )
-       (kill-buffer " *tmp proj read*"))
+      (if (not (object-of-class-p ret 'ede-proj-project))
+         (error "Corrupt project file"))
+      (oset ret directory project)
+      (oset ret rootproject rootproj)
+
+      ;; Load the project file of each subdirectory containing a
+      ;; loadable Project.ede.
       (while subdirs
        (let ((sd (file-name-as-directory
                   (expand-file-name (car subdirs) project))))
          (if (and (file-directory-p sd)
-                  (ede-directory-project-p sd))
+                  (file-exists-p (expand-file-name "Project.ede" sd)))
              (oset ret subproj
                    (cons (ede-proj-load sd (or rootproj ret))
                          (oref ret subproj))))
@@ -291,22 +321,13 @@ the PROJECT being read in is the root project."
   "Write out object PROJECT into its file."
   (save-excursion
     (if (not project) (setq project (ede-current-project)))
-    (let ((b (set-buffer (get-buffer-create " *tmp proj write*")))
-         (cfn (oref project file))
-         (cdir (oref project directory)))
+    (let ((cdir (oref project directory)))
       (unwind-protect
-         (save-excursion
-           (erase-buffer)
-           (let ((standard-output (current-buffer)))
-             (oset project file (file-name-nondirectory cfn))
-             (slot-makeunbound project :directory)
-             (object-write project ";; EDE project file."))
-           (write-file cfn nil)
-           )
-       ;; Restore the :file on exit.
-       (oset project file cfn)
-       (oset project directory cdir)
-       (kill-buffer b)))))
+         (progn
+           (slot-makeunbound project :directory)
+           (eieio-persistent-save project))
+       ;; Restore the directory slot
+       (oset project directory cdir))) ))
 
 (defmethod ede-commit-local-variables ((proj ede-proj-project))
   "Commit change to local variables in PROJ."
@@ -493,11 +514,11 @@ Optional argument COMMAND is the s the alternate command to use."
 
 (defmethod project-debug-target ((obj ede-proj-target))
   "Run the current project target OBJ in a debugger."
-  (error "Debug-target not supported by %s" (object-name obj)))
+  (error "Debug-target not supported by %s" (eieio-object-name obj)))
 
 (defmethod project-run-target ((obj ede-proj-target))
   "Run the current project target OBJ."
-  (error "Run-target not supported by %s" (object-name obj)))
+  (error "Run-target not supported by %s" (eieio-object-name obj)))
 
 (defmethod ede-proj-makefile-target-name ((this ede-proj-target))
   "Return the name of the main target for THIS target."
@@ -546,7 +567,7 @@ You may need to add support for this type of file."
                       (file-name-extension (car sources))
                     "")))
          ))
-      ;; Return the disovered compilers
+      ;; Return the discovered compilers.
       comp)))
 
 (defmethod ede-proj-linkers ((obj ede-proj-target))
@@ -580,11 +601,11 @@ Converts all symbols into the objects to be used."
            (while (and avail (not (eieio-instance-inheritor-slot-boundp (car avail) 'sourcetype)))
              (setq avail (cdr avail)))
            (setq link (cdr avail)))))
-      ;; Return the disovered linkers
+      ;; Return the discovered linkers.
       link)))
 
 \f
-;;; Target type specific autogenerating gobbldegook.
+;;; Target type specific autogenerating gobbledygook.
 ;;
 
 (defun ede-proj-makefile-type (&optional proj)
@@ -642,7 +663,7 @@ MFILENAME is the makefile to generate."
 (defmethod ede-proj-setup-buildenvironment ((this ede-proj-project)
                                            &optional force)
   "Setup the build environment for project THIS.
-Handles the Makefile, or a Makefile.am configure.in combination.
+Handles the Makefile, or a Makefile.am configure.ac combination.
 Optional argument FORCE will force items to be regenerated."
   (if (not force)
       (ede-proj-makefile-create-maybe this (ede-proj-dist-makefile this))
@@ -669,7 +690,12 @@ Optional argument FORCE will force items to be regenerated."
   "Rescan the EDE proj project THIS."
   (let ((root (or (ede-project-root this) this))
        )
-    (setq ede-projects (delq root ede-projects))
+    ;; @TODO - VERIFY THE BELOW WORKS
+    (ede-project-directory-remove-hash
+     (file-name-directory (ede-project-root-directory root)))
+    (ede-delete-project-from-global-list root)
+    ;; NOTE : parent function double-checks that this dir was
+    ;; already in memory once.
     (ede-load-project-file (ede-project-root-directory root))
     ))