;;; -*- Mode: lisp -*-
;;;
;;; This is a simple defsystem for compiling HOMPACK
;;;
;; Don't know why defsystem doesn't complain, but you need to load up
;; blas.system and build blas-hompack first.  Otherwise, it loads up
;; hompack-package before blas-hompack which causes an error since the
;; BLAS package isn't defined.

(mk:defsystem blas-hompack
  :source-pathname (maxima::maxima-load-pathname-directory)
  :binary-pathname (maxima::maxima-objdir "share" "hompack")
  :components
  ((:module "../lapack/blas"
    :source-extension "lisp"
    :components
    ((:file "blas-package")
     (:file "daxpy" :depends-on ("blas-package"))
     (:file "dcopy" :depends-on ("blas-package"))
     (:file "ddot" :depends-on ("blas-package"))
     (:file "dnrm2" :depends-on ("blas-package"))
     (:file "dscal" :depends-on ("blas-package"))
     (:file "idamax" :depends-on ("blas-package"))))))

  
(mk:defsystem hompack-package
  :source-pathname (maxima::maxima-load-pathname-directory)
  :binary-pathname (maxima::maxima-objdir "share" "hompack")
  :depends-on ("blas-hompack")
  :components
  ((:module "lisp"
    :source-extension "lisp"
    :binary-pathname "."
    :components
    ((:file "hompack-package")))))

(mk:defsystem hompack
  :source-pathname (maxima::maxima-load-pathname-directory)
  :binary-pathname (maxima::maxima-objdir "share" "hompack")
  :depends-on ("hompack-package" "blas-hompack")
  :components
  ((:module "lisp"
    :source-extension "lisp"
    :binary-pathname "."
    :components
    (
     ;; The following are :compile-only here because HOMPACK only
     ;; gives skeletons for them.  We make them :compile-only so that
     ;; f2cl will get the function definitions so it can generate
     ;; calls to them appropriately.
     ;;
     ;; The user is supposed to provide appropriate definitions for
     ;; them.  Also, rho and rhojac are supposed to be user-defined,
     ;; but the versions in HOMPACK are used for POLSYS.
     ;;(:file "f" :compile-only t)
     ;;(:file "fjac" :compile-only t)
     ;;(:file "fjacs" :compile-only t)
     ;;(:file "rhojs"  :compile-only t)
     ;;(:file "rhoa" :compile-only t)
     (:file "rho")
     (:file "rhojac" :depends-on ("hfunp"))

     (:file "dcpose")
     (:file "divp")
     (:file "ffunp" :depends-on ("mulp" "powp"))
     (:file "fixpdf" :depends-on (#+nil "rhoa" "steps" "sintrp" "root"))
     (:file "fixpds" :depends-on (#+nil "rhoa" "stepds" "sintrp" "root"))
     (:file "fixpnf" :depends-on ("stepnf" "rootnf"))
     (:file "fixpns" :depends-on ("stepns" "rootns"))
     (:file "fixpqf" :depends-on ("stepqf" "rootqf"))
     (:file "fixpqs" :depends-on ("stepqs" "rootqs"))
     (:file "fode" :depends-on ("rhojac" #+nil "fjac"))
     (:file "fodeds" :depends-on (#+nil "rhojs" "pcgds" #+nil "fjacs"))
     (:file "gfunp" :depends-on ("powp" "mulp"))
     (:file "gmfads")
     (:file "hfun1p" :depends-on ("gfunp" "ffunp"))
     (:file "hfunp" :depends-on ("hfun1p"))
     (:file "initp" :depends-on ("sclgnp"))
     (:file "mfacds" :depends-on ("gmfads"))
     (:file "mulp")
     (:file "multds")
     (:file "otputp")
     (:file "pcgds" :depends-on ("qimuds" "mfacds" "multds"))
     (:file "pcgns" :depends-on ("mfacds" "multds" "qimuds"))
     (:file "pcgqs" :depends-on ("solvds" "gmfads" "multds"))
     (:file "polsys" :depends-on ("polyp"))
     (:file "polyp" :depends-on ("initp" "strptp" "otputp" "fixpnf"))
     (:file "powp")
     (:file "qimuds" :depends-on ("solvds"))
     (:file "qrfaqf")
     (:file "qrslqf")
     (:file "root")
     (:file "rootnf" :depends-on ("tangnf"))
     (:file "rootns" :depends-on ("tangns"))
     (:file "rootqf" :depends-on ("upqrqf" "rho" "qrslqf" #+nil "fjac"))
     (:file "rootqs" :depends-on (#+nil "rhojs" "rho" "pcgqs" #+nil "fjacs"))
     (:file "sclgnp")
     (:file "sintrp")
     (:file "solvds")
     (:file "stepds")
     (:file "stepnf" :depends-on ("tangnf"))
     (:file "stepns" :depends-on ("tangns"))
     (:file "stepqf" :depends-on ("tangqf" "upqrqf" "rho" "rhojac" "qrslqf" #+nil "fjac"))
     (:file "stepqs" :depends-on ("tangqs" #+nil "rhojs" "pcgqs" #+nil "fjacs"))
     (:file "steps")
     (:file "strptp")
     (:file "otputp")
     (:file "r1upqf")
     (:file "tangnf" :depends-on ("rhojac" "rho" #+nil "fjac"))
     (:file "tangns" :depends-on ("rhojac" "rho" "pcgns" #+nil "rhojs" "pcgds" #+nil "fjac"))
     (:file "tangqf" :depends-on ("rhojac" "qrfaqf" "qrslqf" "r1upqf" #+nil "fjac"))
     (:file "tangqs" :depends-on (#+nil "rhojs" "pcgqs" #+nil "fjac"))
     (:file "upqrqf" :depends-on ("r1upqf"))
     ))))

(mk:defsystem hompack-interface
  :source-pathname (maxima::maxima-load-pathname-directory)
  :binary-pathname (maxima::maxima-objdir "share" "hompack")
  :source-extension "lisp"
  :depends-on ("hompack")
  :components
  ((:file "hompack-interface")))
