####################################################################
#   Copyright (c) 1996 NPACT Working Group. You may copy,          #
#   distribute, and modify it freely as long as you preserve this  #
#   copyright and permission notice.                               #
#                                                                  #
#   NPACT Working Group is a joint force of                        #
#      NPAC at Syracuse University,                                #
#      PACT at Harbin Institute of Technology, and                 #
#      PACT at Peking University                                   #   
####################################################################

#
#  Makefile for Basic lib 
#

SHELL       = @CONFIGSHELL@

VERSION     = @VERSION@

srcdir      = @srcdir@
top_srcdir  = @top_srcdir@

config_dir  = ../include

prefix      = @prefix@

exec_prefix = ${prefix}
bindir      = ${exec_prefix}/bin

VPATH       = .:${srcdir}

INCLUDEDIR  = ${top_srcdir}/src/include
AnalysisToolDir = ${top_srcdir}/src/SageAnalysisTool

CFLAGS   = @CFLAGS@ @DEFS@ -I. -I${srcdir} -I$(config_dir) -I$(INCLUDEDIR)
CXXFLAGS = @CXXFLAGS@ @DEFS@ -I. -I${srcdir} -I$(config_dir) -I$(INCLUDEDIR) -I$(AnalysisToolDir)

CC  = @CC@
CXX = @CXX@

LIB=../xsageop/libxsage.a ../basicop/libbasic.a ../SageAnalysisTool/libDep.a
LIBS = -lDep -lxsage -lbasic 
LIBDIR = -L../xsageop -L../basicop -L../SageAnalysisTool

PROGRAM = trans0

OBJS = hf.o dad.o forall.o reference.o distarray.o disttarget.o definition.o \
       transforall.o frefop.o irregular.o transprocstmt.o assign.o   \
       proccall.o detect_comm.o ghost.o misc.o expr.o optimize.o func.o \
       preprocess.o foralloc.o prefetch.o port.o   \
       independent.o indep.o indepcom.o indepcall.o transindep.o  \
       io.o iooc.o ioC.o allocate.o task.o util.o 

.SUFFIXES:
.SUFFIXES: .o .c .cc

.c.o:
	$(CC) -c $(CFLAGS) $<

.cc.o:
	$(CXX) -c $(CXXFLAGS) $<


all: Makefile $(PROGRAM)

Makefile: Makefile.in
	@echo 
	@echo Please configure the package to generate new makefile ...
	@exit 1

clean:
	rm -f *.o core $(PROGRAM)

$(PROGRAM): $(LIB) $(OBJS)
	$(CXX) -g -o $@ $(OBJS) $(LIBDIR) $(LIBS)

install: $(PROGRAM)
	if [ ! -d ${bindir} ] ; then mkdir ${bindir} ; fi
	cp $(PROGRAM) ${bindir}

uninstall:
	rm -f ${bindir}/$(PROGRAM)


############
# file dependence information
############

hf.o: hf.cc anls_att.h ../include/fromsagexx.h ../include/strategy.h
dad.o: dad.cc anls_att.h  ../include/fromsagexx.h
forall.o: forall.cc anls_att.h  ../include/fromsagexx.h
reference.o: reference.cc anls_att.h ../include/fromsagexx.h ../include/strategy.h
disttarget.o: disttarget.cc anls_att.h ../include/fromsagexx.h
distarray.o: distarray.cc anls_att.h ../include/fromsagexx.h
definition.o: definition.cc anls_att.h ../include/fromsagexx.h ../include/strategy.h
transforall.o: transforall.cc anls_att.h ../include/fromsagexx.h ../include/strategy.h 
frefop.o: frefop.cc anls_att.h ../include/fromsagexx.h ../include/strategy.h
transprocstmt.o: transprocstmt.cc anls_att.h ../include/fromsagexx.h ../include/strategy.h
assign.o: assign.cc anls_att.h ../include/fromsagexx.h ../include/strategy.h 
proccall.o: proccall.cc anls_att.h ../include/fromsagexx.h  
ghost.o: ghost.cc anls_att.h ../include/fromsagexx.h  
misc.o: misc.cc anls_att.h ../include/fromsagexx.h   ../include/strategy.h
expr.o: expr.cc anls_att.h ../include/fromsagexx.h   ../include/strategy.h
util.o: util.cc anls_att.h ../include/fromsagexx.h   ../include/strategy.h
optimize.o: optimize.cc anls_att.h ../include/fromsagexx.h
port.o: port.cc anls_att.h ../include/fromsagexx.h
func.o: func.cc  func.h
irregular.o: irregular.cc anls_att.h ../include/fromsagexx.h
allocate.o: allocate.cc anls_att.h ../include/fromsagexx.h
task.o: task.cc anls_att.h ../include/fromsagexx.h

detect_comm.o: detect_comm.cc detect_comm.h
preprocess.o: preprocess.cc anls_att.h ../include/fromsagexx.h
foralloc.o: foralloc.cc anls_att.h  ../include/fromsagexx.h ../SageAnalysisTool/depInterfaceExt.h
prefetch.o: prefetch.cc anls_att.h  ../include/fromsagexx.h 

io.o: io.cc anls_att.h ../include/fromsagexx.h ../include/strategy.h
iooc.o: iooc.cc anls_att.h  ../include/fromsagexx.h ../include/strategy.h
ioC.o: ioC.cc anls_att.h ../include/fromsagexx.h ../include/strategy.h

independent.o: independent.cc anls_att.h ../include/fromsagexx.h
indep.o: indep.cc anls_att.h indep.h ../include/fromsagexx.h
indepcom.o: indepcom.cc anls_att.h indep.h ../include/fromsagexx.h
indepcall.o: indepcall.cc anls_att.h indep.h ../include/fromsagexx.h
transindep.o: transindep.cc anls_att.h indep.h ../include/fromsagexx.h

#############

location = ${prefix}/src
test:
	@echo ${target}
	${location}/hpf2dep/hpf2dep ${target}.f
	${location}/hpfsc/hpfsc -c ${target}.dep
	${location}/tools/dump/dumpdep ${target}.dep > ${target}.dep.lnk
	${location}/tools/unparse/unparse ${target}.dep > ${target}.dep.src










