From 49b287c2d3af757b3794fe45fb5b64dd9fa2c71d Mon Sep 17 00:00:00 2001 From: Philippe Brochard Date: Thu, 29 Nov 2012 00:27:57 +0100 Subject: [PATCH] Use a standard Makefile to load load.lisp and remove the installation part in load.lisp --- Makefile | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ load.lisp | 48 ------------------------------------------------ src/clfswm-util.lisp | 22 +++++++++++++++------- 3 files changed, 67 insertions(+), 55 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 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 + diff --git a/load.lisp b/load.lisp index 900601f..ce9fbfa 100644 --- a/load.lisp +++ b/load.lisp @@ -51,17 +51,6 @@ (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*) @@ -174,40 +163,3 @@ (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)) - diff --git a/src/clfswm-util.lisp b/src/clfswm-util.lisp index aa530f8..73834b8 100644 --- a/src/clfswm-util.lisp +++ b/src/clfswm-util.lisp @@ -48,13 +48,21 @@ -(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 () -- 2.11.4.GIT