Use a standard Makefile to load load.lisp and remove the installation part in load...
authorPhilippe Brochard <pbrochard@common-lisp.net>
Wed, 28 Nov 2012 23:27:57 +0000 (29 00:27 +0100)
committerPhilippe Brochard <pbrochard@common-lisp.net>
Wed, 28 Nov 2012 23:27:57 +0000 (29 00:27 +0100)
Makefile [new file with mode: 0644]
load.lisp
src/clfswm-util.lisp

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..a7f333e
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,52 @@
+DESTDIR=/usr/local/
+
+CLISP=$(shell which clisp)
+SBCL=$(shell which sbcl)
+CMUCL=$(shell which cmucl || which lisp)
+CCL=$(shell which ccl)
+ECL=$(shell which ecl)
+LOADTMP=load.tmp.lisp
+
+SRC=$(wildcard *.lisp src/*.lisp)
+
+all: clfswm
+
+clfswm: $(SRC)
+       @echo "Please, tweak the file load.lisp to fit your needs."
+       @if test -f "$(CLISP)"; then echo "Building with CLISP"; $(CLISP) -E iso-8859-1 $(LOADTMP); \
+       elif test -f "$(SBCL)"; then echo "Building with SBCL"; $(SBCL) --load $(LOADTMP); \
+       elif test -f "$(CMUCL)"; then echo "Building with CMUCL"; $(CMUCL) -load $(LOADTMP); \
+       elif test -f "$(CCL)"; then echo "Building with CCL"; $(CCL) --load $(LOADTMP); \
+       elif test -f "$(ECL)"; then echo "Building with ECL"; $(ECL) -load $(LOADTMP); \
+       else echo "No Lisp found. Please, install one of CLISP, SBCL, CMUCL, CCL or ECL"; \
+       fi
+
+
+
+install: clfswm
+       @echo "Installing CLFSWM in $(DESTDIR)"
+       mkdir -p $(DESTDIR)
+       mkdir -p $(DESTDIR)/bin
+       mkdir -p $(DESTDIR)/lib/clfswm
+       mkdir -p $(DESTDIR)/share/doc/clfswm
+       mkdir -p $(DESTDIR)/man/man.1
+       cp clfswm $(DESTDIR)/bin/
+       cp -R contrib/* $(DESTDIR)/lib/clfswm/
+       cp doc/* $(DESTDIR)/share/doc/clfswm/
+       cp README COPYING AUTHORS $(DESTDIR)/share/doc/clfswm/
+       cp clfswm.1 $(DESTDIR)/man/man.1/
+
+
+uninstall:
+       @echo "Uninstalling CLFSWM from $(DESTDIR)"
+       rm -f $(DESTDIR)/bin/clfswm
+       rm -rf $(DESTDIR)/lib/clfswm/*
+       rm -f $(DESTDIR)/share/doc/clfswm/*
+       rm -f $(DESTDIR)/man/man.1/clfswm.1
+       rmdir $(DESTDIR)/lib/clfswm
+       rmdir $(DESTDIR)/share/doc/clfswm
+
+
+clean:
+       rm -f clfswm
+
index 900601f..ce9fbfa 100644 (file)
--- a/load.lisp
+++ b/load.lisp
 
 (defparameter *binary-name* "clfswm")
 
-(defparameter *install-prefix* "/usr/local")
-
-(defun with-prefix (&rest place)
-  (apply #'concatenate 'string *install-prefix* place))
-
-(defparameter *install-bin*     (with-prefix "/bin/"))
-(defparameter *install-contrib* (with-prefix "/lib/clfswm/"))
-(defparameter *install-doc*     (with-prefix "/share/doc/clfswm/"))
-(defparameter *install-man*     (with-prefix "/share/man/man1/"))
-
-
 ;;;;; Uncomment the line below if you want to see all ignored X errors
 ;;(pushnew :xlib-debug *features*)
 
 (progn
   (cl-user::load-info "Building CLFSWM executable image")
    (build-lisp-image "clfswm"))
-
-;;;-----------------------
-;;; Installation part
-;;;-----------------------
-#+:clfswm-install
-(in-package :cl-user)
-
-#+:clfswm-install
-(defun check-directory (dir)
-  (format t "Checking ~A~%" dir)
-  (ensure-directories-exist dir :verbose t))
-
-
-#+:clfswm-install
-(defun move-file (file where)
-  (format t "cp -Rf ~A ~A~%" file where)
-  (tools:do-shell-output "cp -Rf ~A ~A" file where))
-
-
-
-#+:clfswm-install
-(progn
-  (load-info "Installing CLFSWM")
-  (check-directory *install-prefix*)
-  (check-directory *install-bin*)
-  (check-directory *install-contrib*)
-  (check-directory *install-doc*)
-  (check-directory *install-man*)
-  (move-file *binary-name* *install-bin*)
-  (move-file "contrib/*" *install-contrib*)
-  (move-file "doc/*" *install-doc*)
-  (move-file "clfswm.1" *install-man*)
-  (format t "Please, adjust *contrib-dir* variable to ~A in your configuration file.~%" *install-contrib*)
-  (format t "Something like: (setf *contrib-dir* ~S)~%" *install-contrib*)
-  (tools:do-shell-output "rm -f ~A/clfswm.1.gz && gzip ~A/clfswm.1" *install-man* *install-man*)
-  (tools:uquit))
-
index aa530f8..73834b8 100644 (file)
 
 
 
-(defun load-contrib (file)
-  "Load a file in the contrib directory"
-  (let ((truename (merge-pathnames file *contrib-dir*)))
-    (format t "Loading contribution file: ~A~%" truename)
-    (if (probe-file truename)
-        (load truename :verbose nil)
-        (format t "  File not found!~%"))))
+(let ((already-warn nil))
+  (defun load-contrib (file)
+    "Load a file in the contrib directory"
+    (let ((truename (merge-pathnames file *contrib-dir*)))
+      (format t "Loading contribution file: ~A~%" truename)
+      (if (probe-file truename)
+          (load truename :verbose nil)
+          (progn
+            (format t "  File not found!~%")
+            (unless already-warn
+              (setf already-warn t)
+              (format t "  ~&Please, adjust the *contrib-dir* variable to the place where CLFSWM can
+find its contrib module files. For example: /usr/local/lib/clfswm/.
+Write (defparameter *contrib-dir* \"/usr/local/lib/clfswm/\") in ~A.~%"
+                      (conf-file-name))))))))
 
 
 (defun reload-clfswm ()