
# $Header: /usr4/Geom_utilities/Poly2xy/RCS/Makefile,v 1.1 91/03/12 11:00:26 meuer Exp $
#
# Makefile for Poly2xy
# Mark Meuer
#
#
# The environment variable CPUTYPE must be set to iris4, sun3os3, sun3os4 or sun4


SUFFIXES=.c .C .o .h
.SUFFIXES: $(SUFFIXES)

NAME=poly2xy
MAKEFILE=Makefile
MAKEDIR=../Makefiles
DESTDIR = .
#Include machine specific things
include ${MAKEDIR}/mk.${CPUTYPE}

#CPLUSPLUS = g++
CPLUSPLUS = CC
AR=	/bin/ar

CONF=
IPATH= -I. -I../Matrix_util
LIBPATH = -L../Matrix_util
LIBS = -lmatrix
CFLAGS=	 ${MACHINE_CFLAGS} -g ${IPATH}
#CFLAGS=	 -g ${IPATH}

HDRS = 

# These files make up the stand alone version of poly2xy
PROG_OBJS = \
	euclid_area.o \
	parse_command.o \
	process_polygons.o \
	proj_to_plane.o \
	print_poly.o \
	main.o \
	read_poly.o

# These files make up the functional version of poly2xy
FUNC_OBJS = \
	euclid_area.o \
	poly2xy_func.o \
	print_poly.o \
	proj_to_plane.o

all:	${NAME} libpoly2xy.a func_test
	@echo "Using Makefile settings for machine ${CPUTYPE}."
	etags *.c *.h

${NAME}: ${PROG_OBJS} Makefile 
	@echo "Using Makefile settings for machine ${CPUTYPE}."
	${CC} ${CFLAGS} -o ${@} ${PROG_OBJS}  ${LIBPATH} ${LIBS} ${MACHINE_LIB} -lm

${PROG_OBJS} : *.h

${FUNC_OBJS} : *.h

func_test.o : *.h

libpoly2xy.a: ${FUNC_OBJS} Makefile
	@echo "Using Makefile settings for machine ${CPUTYPE}."
	ar ruv ${@} ${FUNC_OBJS}
	${RANLIB} ${@}

func_test : func_test.o libpoly2xy.a
	@echo "Using Makefile settings for machine ${CPUTYPE}."
	${CC} ${CFLAGS} -o ${@} func_test.o  -L. -lpoly2xy ${LIBPATH} ${LIBS} ${MACHINE_LIB} -lm

install: all
	@echo "Using Makefile settings for machine ${CPUTYPE}."
	cp poly2xy ${BIN_DIR}
	chmod a+rx ${BIN_DIR}/poly2xy
	cp libpoly2xy.a ${LIB_DIR}
	chmod a+r ${LIB_DIR}/libpoly2xy.a
	cp poly2xy.h ${INCLUDE_DIR}
	chmod a+r ${INCLUDE_DIR}/poly2xy.h
	(cd Document; ${MAKE} install)
	
clean: 
	@echo "Using Makefile settings for machine ${CPUTYPE}."
	-rm -f *.o *~ *.dvi *.aux *.ps core 

purge: clean
	@echo "Using Makefile settings for machine ${CPUTYPE}."
	-rm -f ${NAME} libpoly2xy.a func_test

.C.o: 
	${CPLUSPLUS} -c ${CFLAGS} $<

