####################################################################
#   Copyright (c)
#
#   You may copy, distribute, and modify it freely as long as you  #
#   preserve this copyright and permission notice.                 #
#                                                                  #
#
####################################################################

#
#  Makefile for Adlib/src/include  
#

SHELL       = /bin/sh

srcdir      = @srcdir@
top_src_dir = @top_srcdir@

prefix      = @prefix@
exec_prefix = @exec_prefix@

includedir  = @includedir@

INSTALL     = cp

VPATH       = .:${srcdir}

ADLIBH      = Procs.h Range.h DAD.h threads.h ProcTree.h schedule.h \
              TreeSchedule.h MessSchedule.h DataSchedule.h Remap.h \
              Reduce.h Gather.h io.h 	\
	      globals.h profile.h ${srcdir}/block.h ${srcdir}/oc_block.h

ADPPH       = Seq.h ${srcdir}/Array.h ${srcdir}/transformations.h  \
	      apgStack.h admacros.h

all: ad++.h

ad++.h : adlib.h ${ADPPH}
	touch ${srcdir}/ad++.h

adlib.h : ${ADLIBH}
	touch ${srcdir}/adlib.h


Range.h : RangeRep.h CollapsedRangeRep.h BlockRangeRep.h CyclicRangeRep.h StepRangeRep.h
	touch ${srcdir}/Range.h

${srcdir}/block.h: ${srcdir}/block.h.in
	${srcdir}/generate_block

${srcdir}/oc_block.h: ${srcdir}/oc_block.h.in
	${srcdir}/generate_oc_block

${srcdir}/Array.h: ${srcdir}/Array.h.in
	${srcdir}/generate_Array

${srcdir}/transformations.h: ${srcdir}/transformations.h.in
	${srcdir}/generate_transformations

clean:
	rm -f ${srcdir}/transformations.h ${srcdir}/Array.h ${srcdir}/block.h ${srcdir}/oc_block.h

distclean:
	rm -f generate_Array generate_block generate_transformations generate_oc_block
	rm -f ${srcdir}/transformations.h ${srcdir}/Array.h ${srcdir}/block.h ${srcdir}/oc_block.h
	rm -f Makefile config.h 

install: 
	if [ ! -d ${includedir} ] ; then mkdir ${includedir} ; fi
	for i in adlib.h ad++.h ${ADLIBH} ${ADPPH} ; \
	do ($(INSTALL) ${srcdir}/$$i ${includedir}); done

uninstall:
	for i in adlib.h ad++.h ${ADLIBH} ${ADPPH} ; \
	do (rm -f ${includedir}/$$i); done

