#
# Makefile for building library of contour/plot2D routines
#

# Your favorite compiler
CC      = gcc

# Compile flags; try -O to optimize
CFLAGS  = -Wall  -O2

# This isn't used
LIBS    = -lm

#
# The meat of the contour : read data, manipulate it
#
CONTOUR_SOURCES = \
                  annotate.c \
                  array.c \
                  bivar.c \
                  clip.c\
                  contlist.c \
                  contdata.c \
                  contour.c \
                  contstep.c \
                  grid.c \
                  griddata.c \
                  intersect.c \
                  intersect3D.c \
                  list1.c \
                  list2.c \
                  list3.c \
                  list4.c \
                  list5.c \
                  list6.c \
                  listutils.c \
                  matrix.c \
                  misc.c \
                  parser.c \
                  probe.c \
                  property.c \
                  pvector.c \
                  rdm_column.c \
                  rdm_contour.c \
                  rdm_curve.c \
                  rdm_data.c \
                  rdm_grid4D.c \
                  rdm_print.c \
                  rdm_util.c \
                  rdm_vector.c \
		  read_cont.c \
		  read_plot2D.c \
		  read_plot3D.c \
		  readdata.c \
                  round.c \
                  sort.c \
		  spline.c \
		  system.c \
                  time.c \
                  vector.c

CONTOUR_OBJECTS = \
                  annotate.o \
                  array.o \
                  bivar.o \
                  clip.o\
                  contlist.o \
                  contdata.o \
                  contour.o \
                  contstep.o \
                  grid.o \
                  griddata.o \
                  intersect.o \
                  intersect3D.o \
                  list1.o \
                  list2.o \
                  list3.o \
                  list4.o \
                  list5.o \
                  list6.o \
                  listutils.o \
                  matrix.o \
                  misc.o \
                  parser.o \
                  probe.o \
                  property.o \
                  pvector.o \
                  rdm_column.o \
                  rdm_contour.o \
                  rdm_curve.o \
                  rdm_data.o \
                  rdm_grid4D.o \
                  rdm_print.o \
                  rdm_util.o \
                  rdm_vector.o \
		  read_cont.o \
		  read_plot2D.o \
		  read_plot3D.o \
		  readdata.o \
                  round.o \
                  sort.o \
		  spline.o \
		  system.o \
                  time.o \
                  vector.o

CONTOUR_HEADER  = CNplot.h \
                  CNannotate.h \
                  CNcontlist.h \
                  CNdata.h \
                  CNdatatypes.h \
                  CNgrid.h \
                  CNintersect.h \
                  CNplot3D.h \
                  CNprobe.h \
                  CNproperty.h \
                  CNquant.h \
                  CNreadmtv.h \
                  CNround.h \
                  CNsort.h \
                  CNspline.h \
                  CNstring.h \
                  CNvector.h \
                  CNpvector.h \
                  CNxdr.h

CONTOUR_LIBRARY = contour.a

all: $(CONTOUR_LIBRARY) 

#
# Compile the contour-specific routines and put it in a library
#
$(CONTOUR_LIBRARY) : $(CONTOUR_OBJECTS)
#	time ar  cruvl $(CONTOUR_LIBRARY) $(CONTOUR_OBJECTS) 
# Option "s" added for Linux <mkl>
	ar crus $(CONTOUR_LIBRARY) $(CONTOUR_OBJECTS)
#	time /bin/true $(CONTOUR_LIBRARY)


array.o: array.c
	$(CC) -c array.c # no optimization possible <mkl>


$(CONTOUR_OBJECTS) : $(CONTOUR_HEADER)


# 
# Clean
#
cleanall : clean
	rm -f $(CONTOUR_LIBRARY)
clean : 
	rm -f $(CONTOUR_OBJECTS) $(TEST_OBJECTS) core


#
# Backup
#
BACKUP = Backup
backup :
	-if [ ! -d $(BACKUP) ]; then mkdir $(BACKUP); fi
	cp Makefile *.[ch] $(BACKUP)

