# makefile for morph3d
# 
# morph3d version 2.0  1 Oct 1991             
# 3D image morphology 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.
#
# 
# In making morph3d, there are two options. One is to make the program "morph3d"
# which accepts command line input and works on sun raster files.
# the other is to make the library "libmorph3d.a" which includes only the
# subroutine Morph3DSub() and its dependent functions. (Making morph3d by 
# typing "make install" makes libmorph3d.a as well as morph3d.) If you do not
# intend to use morph3d as a program (because, perhaps you do not want to
# use raster files, simply execute "make library".
#
.KEEP_STATE:

BINDIR= ../bin
LIBDIR= ../lib
UTLDIR= ../utils
#CFLAGS= -g -I$(UTLDIR)
CFLAGS= -O -I$(UTLDIR)
SOURCES= morph3d.c morph3d_sub.c m3dsetup.c m3dmanip.c m3dse.c  \
         m3derode.c m3ddilate.c m3dthresh.c m3drank.c \
         m3dmaxmin.c m3dminmax.c m3dargs.c m3ddelay.c
OBJECTS= morph3d.o morph3d_sub.o m3dsetup.o m3dmanip.o m3dse.o  \
         m3derode.o m3ddilate.o m3dthresh.o m3drank.o \
         m3dmaxmin.o m3dminmax.o m3dargs.o m3ddelay.o
LIBOBJS= morph3d_sub.o m3dsetup.o m3dmanip.o m3dse.o  \
         m3derode.o m3ddilate.o m3dthresh.o m3drank.o \
         m3dmaxmin.o m3dminmax.o
INCLUDES= morph3d.h m3dse.h $(UTLDIR)/rasterio.h

morph3d: $(OBJECTS) $(SOURCES) $(INCLUDES) $(UTLOBJS)
	$(CC) $(CFLAGS) $(SUPOBJS) $(OBJECTS) -o morph3d -lm -lmutils -L$(LIBDIR)
	chmod 755 morph3d

library: $(LIBOBJS) 
	ar rcv libmorph3d.a $(LIBOBJS) ; ranlib libmorph3d.a
	chmod 644 libmorph3d.a

clean:
	rm -f *.o ; rm -f *.a  ; rm -f *% ; rm -f core 

spotless: clean
	rm -f morph3d $(LIBDIR)/libmorph3d.a $(BINDIR)/morph3d

install: morph3d library
	mv morph3d $(BINDIR)
	mv libmorph3d.a $(LIBDIR)




