#
# Makefile for the ChessML distribution.
#
# Copyright: Oliver Sick, Bonn 2000
#
#


#VERSION of the ChessML distribution
VERSION=0.4


#HOME_DIR Should be modified to point to the local distribution directory
HOME_DIR=/usr/people/sick/public_html/chessml/download/ChessMLv$(VERSION)


# The BIN_DIR contains three scripts for processing and validation of a DTD
BIN_DIR=$(HOME_DIR)/bin

# The DTD_DIR contains the DTD and some exapmle XML files.
DTD_DIR=$(HOME_DIR)/dtd


# xml-parser is a short shell script for checking the syntax of an XML document (and its DTD !!)
PARSE=$(BIN_DIR)/parse

#dtddoc is  a short shell script for documenting a DTD with a set of HTML documents
DOC=$(BIN_DIR)/dtddoc

# The flaten script uses the spam utility of J.Clark to put together a DTD from sevaral modules
FLAT=$(BIN_DIR)/flaten



all :           allflat alldocs
		 

parse :      
		$(PARSE) $(DTD_DIR)/dummy.xml


parsecgml :  
		$(PARSE) $(DTD_DIR)/dummy-cgml.xml


parsecpml :  
		$(PARSE) $(DTD_DIR)/dummy-cpml.xml


parselite :	
		$(PARSE) $(DTD_DIR)/dummylite.xml


parseall :	parse parsecgml parsecpml parselite


docs:
		cd $(DTD_DIR); \
		$(DOC)  chessml.dtd chessml ;\
                cd ..

cgmldocs :
		cd $(DTD_DIR); \
		$(DOC)  cgml.dtd cgml ;\
		cd ..


cpmldocs :       
		cd $(DTD_DIR); \
		$(DOC)  cpml.dtd cpml ;\
		cd ..

litedocs :       
		cd $(DTD_DIR); \
		$(DOC)  chessmlite.dtd chessmlite ;\
		cd ..


alldocs :	docs cgmldocs cpmldocs litedocs 


flat :       
		$(FLAT) $(DTD_DIR)/chessml.dtd $(DTD_DIR)/chessml$(VERSION).dtd  $(DTD_DIR)/dummy.xml


flatcpml :   
		$(FLAT) $(DTD_DIR)/cpml.dtd $(DTD_DIR)/cpml$(VERSION).dtd $(DTD_DIR)/dummy-cpml.xml


flatcgml :   
		$(FLAT) $(DTD_DIR)/cgml.dtd $(DTD_DIR)/cgml$(VERSION).dtd $(DTD_DIR)/dummy-cgml.xml

flatlite :   
		$(FLAT) $(DTD_DIR)/chessmlite.dtd $(DTD_DIR)/chessmlite$(VERSION).dtd $(DTD_DIR)/dummylite.xml


allflat :       flat flatcgml flatcpml flatlite


clean :         
		cd htdocs; rm -f chessml/* cpml/*  cgml/* ;\
		rm $(DTD_DIR)/chessml$(VERSION).dtd $(DTD_DIR)/cpml$(VERSION).dtd \
		   $(DTD_DIR)/cgml$(VERSION).dtd $(DTD_DIR)/chessmlite$(VERSION).dtd ;
		rm -f *~ $(DTD_DIR)/*~
		cd ..

tar :
		cd $(HOME_DIR)
		if  ( -f chessml$(VERSION).tar ) rm  -f   chessml$(VERSION).tar 
		tar -cvf chessml$(VERSION).tar 	dtd htdocs bin Makefile README

gzip :		tar
		if  ( -f chessml$(VERSION).tar.gz ) rm   chessml$(VERSION).tar.gz
		gzip chessml$(VERSION).tar

touch :		
		touch $(DTD_DIR)/* $(HOME_DIR)/*

dist :		allflat alldocs touch gzip
		date | cat >  dist_date
		date | cat >> dist_list

cgmldist :	flatcgml cgmldocs
		cd  $(HOME_DIR)
		tar czvf cgml$(VERSION).tar.gz htdocs/cgml dtd/*.mod dtd/cgml.dtd dtd/dummy-cgml.xml \
		dtd/chessml.ent dtd/cgml$(VERSION).dtd dtd/catalog dtd/xml.* README

cpmldist :	flatcpml cpmldocs 
		cd  $(HOME_DIR)
		tar czvf cpml$(VERSION).tar.gz htdocs/cpml dtd/*.mod dtd/cpml.dtd dtd/dummy-cpml.xml \
		dtd/chessml.ent dtd/cpml$(VERSION).dtd dtd/catalog dtd/xml.* README

chessmldist :	flat docs 
		cd  $(HOME_DIR)
		tar czvf chessml$(VERSION).tar.gz htdocs/chessml dtd/*.mod dtd/chessml.dtd dtd/dummy.xml \
		dtd/chessml.ent dtd/chessml$(VERSION).dtd dtd/catalog dtd/xml.* README

litedist :	flatlite litedocs
		cd  $(HOME_DIR)
		tar czvf chessmlite$(VERSION).tar.gz htdocs/chessmlite dtd/*.mod dtd/chessmlite.dtd \
		dtd/dummylite.xml dtd/chessmlite.ent dtd/chessmlite$(VERSION).dtd \
		dtd/catalog dtd/xml.* README

alldist :	cgmldist cpmldist chessmldist litedist 

#
# END Makefile
#
