#!/bin/sh
#
#          The XCIN Makefile of xcin-2.0d.tar.gz
#
#          Written by Tung-Han Hsieh, 1997.
#
#          Email: thhsieh@twcpro.phys.ntu.edu.tw
#

all:  @MAKEALL@

make_xcin:
	(cd xcin; make all)

make_crxvt:
	(cd crxvt; make all)

make_inptabs:
	(cd input_tabs/source; make all)


install: rm_filelist @INSTALLALL@ install_filelist


install_xcin: make_xcin
	cd xcin; make install

install_crxvt: make_crxvt
	cd crxvt; make install

install_inptabs: make_inptabs
	cd input_tabs/source; make install

install_docs:
	cd docs; make install

install_filelist:
	rm -f filelist
	for f in `ls -d *`; do\
	    if [ -d $$f ] && [ -f $$f/filelist ]; then\
		echo "$$f:" >> filelist;\
		cat $$f/filelist >> filelist;\
		echo >> filelist;\
		rm -f $$f/filelist;\
	    fi;\
	done

rm_filelist:
	rm -f filelist
	for f in `ls -d *`; do\
	    if [ -d $$f ] && [ -f $$f/filelist ]; then rm -f $$f/filelist; fi;\
	done


clean:
	for f in `ls -d *`; do\
	    if [ -d $$f ] && [ -f $$f/Makefile ]; then\
		(cd $$f; make clean);\
	    elif [ -d $$f/source ] && [ -f $$f/source/Makefile ]; then\
		(cd $$f/source; make clean);\
	    fi;\
	done
	rm -f filelist

veryclean distclean:
	for f in `ls -d *`; do\
	    if [ -d $$f ] && [ -f $$f/Makefile ]; then\
		(cd $$f; make veryclean);\
	    elif [ -d $$f/source ] && [ -f $$f/source/Makefile ]; then\
		(cd $$f/source; make veryclean);\
	    fi;\
	done
	rm -f filelist config.status install.status Makefile
