# makefile for morph system
# 
# morph version 4.0   10 May 1993              
# 2D image morphology program 
#
# morph3d version 3.0 20 May 1993
# 3D image morphology program
#
# mclean version 4.0 15 May 1993
# 2D image morphological noise reduction program                        
#                                                  
# by Richard Alan Peters II                       
# Department of Electrical Engineering            
# Vanderbilt University School of Engineering      
# Nashville, TN 37235                             
# rap2@vuse.vanderbilt.edu                         
#                                                  
# This software is freely redistributable if       
# the author's name and affiliation are included.
#
# "make" or "make install" will create morph, morph3d, mclean, and all 
# associated rasterfile and arithmetic utilites as well as the libraries
# "2d/libmorph.a" and "3d/libmorph3d.a".
#
# To make only the 2D morph library, "2d/libmorph.a" and the 3D morph3d 
# library, "3d/libmorph3d.a" execute "make library".
#
.KEEP_STATE:
MORDIR= 2d
M3DDIR= 3d
ARTDIR= arith
MANDIR= man
MCLDIR= mclean
SCRDIR= scripts
SEQDIR= seq
UTLDIR= utils
#CFLAGS= -g -I$(UTLDIR)

install:
	rm -fr bin ; rm -fr lib
	mkdir bin ; chmod 755 bin ; chmod 755 $(SCRDIR) ; cp $(SCRDIR)/* bin ;
	mkdir lib ; chmod 755 lib ; 
	chmod 755 $(UTLDIR) ; cd $(UTLDIR); make install ; make clean ; cd .. ;
	chmod 755 $(MORDIR) ; cd $(MORDIR); make install ; make clean ; cd .. ;
	chmod 755 $(M3DDIR) ; cd $(M3DDIR); make install ; make clean ; cd .. ;
	chmod 755 $(ARTDIR) ; cd $(ARTDIR); make install ; make clean ; cd .. ;
	chmod 755 $(MCLDIR) ; cd $(MCLDIR); make install ; make clean ; cd .. ;
	chmod 755 $(SEQDIR) ; cd $(SEQDIR); make install ; make clean ; cd .. ;
	cd bin ; chmod 755 * ; cd .. ;
	chmod 755 $(MANDIR) ; chmod 755 $(MANDIR)/* ;
	@ echo "morph installation is complete."

libraries:
	rm -fr lib
	mkdir lib ; chmod 755 lib ; 
	cd $(UTLDIR); make library ; make clean ; cd .. ;
	mv $(UTLDIR)/libmutils.a lib 
	cd $(MORDIR); make library ; make clean ; cd .. ;
	mv $(MORDIR)/libmorph.a lib ; 
	cd $(M3DDIR); make library ; make clean ; cd .. ;
	mv $(M3DDIR)/libmorph3d.a lib ;
	@ echo "2d/libmorph.a 3d/libmorph3d.a installation is complete."


clean:
	rm -fr bin ; rm -fr lib

