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

SHELL       = /bin/sh

VERSION     = @VERSION@

srcdir      = @srcdir@
top_srcdir  = @top_srcdir@

prefix      = @prefix@
exec_prefix = @exec_prefix@

bindir      = @bindir@

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=dumpdep

OBJS=dumpdep.o dumpnodes.o  

.SUFFIXES:
.SUFFIXES: .c .o

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

all: Makefile $(PROGRAM)

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)

tagname.def: $(INCLUDEDIR)/tags.h
	@echo "	generating tagname.def from tags.h"
	@(echo "/* GENERATED FILE FROM tags.h */" ;     \
	  sed < $(INCLUDEDIR)/tags.h                    \
	    '/#defin/s/\([^ ]*\) \([^ 	]*\)\(.*\)/  tag \[ \2 \] = \"\2\";/' \
	) > tagname.def

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

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

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

#       
# file dependence information
#
dumpdep.o : dumpdep.c  \
	    $(INCLUDEDIR)/dep.h $(INCLUDEDIR)/dep_struct.h 

dumpnodes.o : dumpnodes.c tagname.def \
	$(INCLUDEDIR)/tags.h $(INCLUDEDIR)/bif.h \
	$(INCLUDEDIR)/ll.h $(INCLUDEDIR)/symb.h $(INCLUDEDIR)/typedef.h \
	$(INCLUDEDIR)/dep.h $(INCLUDEDIR)/dep_struct.h










