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

all:  @MAKEALL@

.PHONY: install make_xcin make_inptab install_xcin install_inptab \
	install_doc install_filelist rm_filelist clean very_clean dist_clean

install: rm_filelist @INSTALLALL@ install_filelist


make_xcin:
	(cd src; make all)

make_inptab:
	(cd input_tab; make all)

install_xcin: make_xcin
	(cd src; make install)

install_inptab: make_inptab
	(cd input_tab; make install)

install_doc:
	(cd doc; 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);\
	    fi;\
	done
	rm -f filelist

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

distclean: veryclean
