# -*- makefile -*-
DESTDIR=+DESTDIR+
BUILD_PATH=+BUILD_PATH+

build:
	@echo "Building"
	chmod a+x $(BUILD_PATH)/clfswm
	@echo ""
	@echo "Type 'make install' to install clfswm in '$(DESTDIR)/bin/clfswm'"
	@echo ""

install:
	mkdir -p $(DESTDIR)/bin
	rm -rf $(DESTDIR)/lib/clfswm/
	mkdir -p $(DESTDIR)/lib/clfswm/src
	mkdir -p $(DESTDIR)/share/doc/clfswm
	cp $(BUILD_PATH)/clfswm $(DESTDIR)/bin
	cp $(BUILD_PATH)/clfswm.asd $(DESTDIR)/lib/clfswm/
	cp -R $(BUILD_PATH)/src/*.lisp $(DESTDIR)/lib/clfswm/src
	cp -R $(BUILD_PATH)/contrib $(DESTDIR)/lib/clfswm/
	cp -R $(BUILD_PATH)/doc/* $(DESTDIR)/share/doc/clfswm/
	cp -R $(BUILD_PATH)/AUTHORS $(DESTDIR)/share/doc/clfswm/
	cp -R $(BUILD_PATH)/COPYING $(DESTDIR)/share/doc/clfswm/
	cp -R $(BUILD_PATH)/README $(DESTDIR)/share/doc/clfswm/
	cp -R $(BUILD_PATH)/TODO $(DESTDIR)/share/doc/clfswm/
	cp -R $(BUILD_PATH)/ChangeLog $(DESTDIR)/share/doc/clfswm/
	@echo ""
	@echo "clfswm has been installed in '$(DESTDIR)/bin/clfswm'"
	@echo ""


uninstall:
	rm -rf $(DESTDIR)/bin/clfswm
	rm -rf $(DESTDIR)/lib/clfswm
	rm -rf $(DESTDIR)/share/doc/clfswm

clean:
	find . \( -name "*~" -o -name "*.fas" -o -name "*.fasl" -o -name "*.lib" -o -name "*.lx32fsl" -o -name "*.x86f" \) -print0 | xargs -0 rm -f

dist: clean
	cd .. && tar czvf clfswm-`date +%y%m%d`.tar.gz clfswm


distclean: clean
	rm -f clfswm Makefile
