#    This file is part of cqual.
#    Copyright (C) 2000-2001 The Regents of the University of California.
# 
# cqual is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# 
# cqual is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with cqual; see the file COPYING.  If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

DISTRIB_DIR="cqual-`cat VERSION`"

all: cqual iquals personal
	cp src/cqual src/iquals bin

.PHONY: all cqual iquals doc clean distrib personal

cqual:
	(cd src; make cqual)

iquals:
	(cd src; make iquals)

personal:
	perl setup-pam

doc:
	(cd doc; make)

clean:
	rm -rf $(DISTRIB_DIR)
	rm -f $(DISTRIB_DIR).tar.gz
	(cd src; make clean)

INFO=Makefile COPYING COPYRIGHT README VERSION setup-pam
BIN=bin/remblanks bin/remquals
EXAMPLES=examples/*.c
DOC=doc/user-guide.ps
CONFIG=config/lattice config/prelude.i
SRC=src/Makefile src/*.c src/*.h src/*.l src/*.y src/*.gperf src/*.def	\
	src/*.el
REGIONLIB=src/libcompat/*.c src/libcompat/*.h src/libcompat/Makefile	\
	src/libcompat/COPYRIGHT

distrib: all doc
	(cd src; make)
	rm -rf $(DISTRIB_DIR)
	mkdir $(DISTRIB_DIR)
	mkdir $(DISTRIB_DIR)/doc $(DISTRIB_DIR)/src $(DISTRIB_DIR)/src/libcompat $(DISTRIB_DIR)/bin $(DISTRIB_DIR)/config $(DISTRIB_DIR)/examples
	cp -p $(INFO) $(DISTRIB_DIR)
	cp -p $(BIN) $(DISTRIB_DIR)/bin
	cp -p $(DOC) $(DISTRIB_DIR)/doc
	cp -p $(EXAMPLES) $(DISTRIB_DIR)/examples
	cp -p $(CONFIG) $(DISTRIB_DIR)/config
	cp -p $(SRC) $(DISTRIB_DIR)/src
	cp -p $(REGIONLIB) $(DISTRIB_DIR)/src/libcompat
	tar -czf $(DISTRIB_DIR).tar.gz $(DISTRIB_DIR)
