# makefile for utils
#
# 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. 
.KEEP_STATE:

#CFLAGS= -g
CFLAGS= -O
OBJDIR= ../utils
BINDIR= ../bin
LIBDIR= ../lib
SOURCES= rasterio.c ras2raw.c raw2ras.c rasinfo.c rasremap.c
LIBOBJS= rasterio.o
INCLUDES= rasterio.h

all: library ras2raw raw2ras rasinfo rasremap support

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

rasterio.o: rasterio.c $(INCLUDES)
	$(CC) $(CFLAGS) -c rasterio.c

ras2raw: ras2raw.c $(INCLUDES)
	$(CC) $(CFLAGS) ras2raw.c -o ras2raw -lmutils -L. -L$(LIBDIR)
	chmod 755 ras2raw

raw2ras: raw2ras.c $(INCLUDES)
	$(CC) $(CFLAGS) raw2ras.c -o raw2ras -lmutils -L. -L$(LIBDIR)
	chmod 755 raw2ras

rasinfo: rasinfo.c  $(INCLUDES)
	$(CC) $(CFLAGS) rasinfo.c  -o rasinfo -lmutils -L. -L$(LIBDIR)
	chmod 755 rasinfo

rasremap: rasremap.c  $(INCLUDES)
	$(CC) $(CFLAGS) rasremap.c  -o rasremap -lmutils -L. -L$(LIBDIR)
	chmod 755 rasremap

support: support.c  $(INCLUDES)
	$(CC) $(CFLAGS) support.c  -o support -lm
	chmod 755 support

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

spotless: clean
	rm -f *.o ; rm -f *.a ; rm -f ras2raw raw2ras rasinfo rasremap

install: all
	mv raw2ras ras2raw rasinfo rasremap support $(BINDIR)
	mv libmutils.a $(LIBDIR)


