####################################################################
#   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 hpfsc
#

SHELL       = /bin/sh

VERSION     = @VERSION@

srcdir      = @srcdir@
top_srcdir  = @top_srcdir@

prefix      = @prefix@
exec_prefix = @exec_prefix@

bindir      = @bindir@
libdir      = @libdir@

INCLUDEDIR = ${top_srcdir}/src/include
config_dir = ../include

LIBDIR = ../basicop

ULIBS = -lbasic

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

CC = @CC@

VPATH=.:${srcdir}

PROGRAM = hpfsc

INTR_LIB = libhpf.sl

OBJS=   hpfsc.o \
	error.o	util.o intr_call.o \
	checksymb.o expr.o exec_stmt.o spec_stmt.o \
	multi.o writemod.o readmod.o\
        hpfsmtc.o ym.o independent.o\
	align.o distribute.o type.o checktype.o ymio.o \
	link.o preprocess.o

DEPENDENCES =   $(INCLUDEDIR)/defnodes.h \
                $(INCLUDEDIR)/tags.h \
                $(INCLUDEDIR)/bif.h  \
                $(INCLUDEDIR)/ll.h \
                $(INCLUDEDIR)/symb.h \
                $(INCLUDEDIR)/typedef.h \
                $(INCLUDEDIR)/makenodes.h \
		$(INCLUDEDIR)/dep_struct.h \
		check.h

.SUFFIXES:
.SUFFIXES: .c .o

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

all : Makefile $(PROGRAM)   $(INTR_LIB)

Makefile: ${srcdir}/Makefile.in
	@echo 
	@echo Please configure the package to generate new makefile ...
	@exit 1

$(PROGRAM):$(OBJS) $(LIBDIR)/libbasic.a
	$(CC) -g -o $@ $(OBJS) -L$(LIBDIR) $(ULIBS) 

$(INTR_LIB):  intrinsic.f  $(LIBDIR)/libbasic.a
	../hpf2dep/hpf2dep -i ${srcdir}/intrinsic.f
	@echo
	./hpfsc -i ${srcdir}/intrinsic.dep
	@echo "+++ Create intrinsic library ... "
	mv ${srcdir}/intrinsic.dep  $(INTR_LIB)
	@rm -f ${srcdir}/intrinsic.lst

clean:
	rm -f *.o core $(PROGRAM) $(INTR_LIB)
       
install: $(PROGRAM) $(INTR_LIB)
	if [ ! -d ${bindir} ] ; then mkdir ${bindir} ; fi
	cp $(PROGRAM)   ${bindir}
	if [ ! -d ${libdir} ] ; then mkdir ${libdir} ; fi
	cp $(INTR_LIB)  ${libdir}

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


####
hpfsc.o :  hpfsc.c global.h $(DEPENDENCES)

checksymb.o : checksymb.c exglobal.h $(DEPENDENCES)

checktype.o : checktype.c exglobal.h $(DEPENDENCES)

exec_stmt.o : exec_stmt.c exglobal.h $(DEPENDENCES)

spec_stmt.o : spec_stmt.c exglobal.h $(DEPENDENCES)

intr_call.o : intr_call.c exglobal.h $(DEPENDENCES)

error.o : error.c exglobal.h $(DEPENDENCES)

util.o : util.c exglobal.h  $(DEPENDENCES)

multi.o : multi.c exglobal.h  $(DEPENDENCES)

readmod.o : readmod.c exglobal.h  $(DEPENDENCES)

writemod.o : writemod.c exglobal.h  $(DEPENDENCES)

ym.o : ym.c exglobal.h $(DEPENDENCES)

distribute.o : distribute.c exglobal.h $(DEPENDENCES)

align.o : align.c exglobal.h $(DEPENDENCES)

type.o : type.c exglobal.h  $(DEPENDENCES)

ymio.o : ymio.c exglobal.h  $(DEPENDENCES)

link.o : link.c exglobal.h  $(DEPENDENCES)

preprocess.o : preprocess.c exglobal.h  $(DEPENDENCES)

expr.o : expr.c

hpfsmtc.o : hpfsmtc.c

independent.o : independent.c












