#-------------------------------------------------------------------------
# Makefile for sedr2asc utility.
#
# Development History:
#    Begun: 1/4/93 - Kirk Ketefian
#          7/18/94 - Eva Fried : copied from ffextract Makefile
#
# Version:
#      %W%         (UCLA/IGPP)      %G%
#-------------------------------------------------------------------------
include $(DFSHOME)/Make.conf

# Default of DFSBIN (comment out) is $DFSHOME/bin
#DFSBIN = .

LIBS    = binary miscc parserc pipec

SOFTDIR = /software/spacenet/igpp/pds/
TARDIR	= /var/ftp/pds/SOFTWARE/PACKAGES
#TMPDIR	= /tmp/software/SEDR2ASC
#TMPINC	= /tmp/software/SEDR2ASC/include
#TMPLIB	= /tmp/software/SEDR2ASC/lib
TMPDIR	= /tmp/dda/SEDR2ASC
TMPINC	= /tmp/dda/SEDR2ASC/include
TMPLIB	= /tmp/dda/SEDR2ASC/lib

all :	$(LIBS) sedr2asc install

$(LIBS):
	-@if [ -f $(DFSLIB)/lib$@.a ] ; then  \
	    echo "" > /dev/null ; \
        -@if [ -f $(IGPPLIB)/lib$@.a] ;  then \
	    echo "" > /dev/null ; \
	else ; \
            echo "*** Making $@ library" ; \
            -@if [$@ = binary ]; \
echo "making" ; echo "$@"; \
#              cd $(IGPPSRC)/$@; make ; \
            else ; echo "making $@"; \
# cd $(DFSLIBSRC)/$@; make ; \
            fi \
	fi

sedr2asc:  sedr2asc.o
	$(LINK.c) -o sedr2asc sedr2asc.o \
	-lpipec -lbinary -lmiscc -lparserc ${CCLOCAL}

sedr2asc.o: sedr2asc.c sedr.h

install :
	mv sedr2asc $(DFSBIN)

clean :
	rm -f sedr2asc.o sedr2asc

tar :
	mkdir $(TMPDIR)
	@echo "*** Tar'ing SEDR2ASC ***"
	@ln -s $(TARDIR)/tmp/INSTALL.TXT $(TMPDIR)
	@ln -s $(DFSHOME)/../hpux/Make.conf $(TMPDIR)/MAKE_CONF.HPUX
	@ln -s $(DFSHOME)/../hpux/Make.libs $(TMPDIR)/MAKE_LIBS.HPUX
	@ln -s $(DFSHOME)/../dos/Make.conf $(TMPDIR)/MAKE_CONF.PC
	@ln -s $(DFSHOME)/../dos/Make.libs $(TMPDIR)/MAKE_LIBS.PC
	@ln -s $(DFSHOME)/../sun4.SOL2/Make.conf $(TMPDIR)/MAKE_CONF.SOL 
	@ln -s $(DFSHOME)/../sun4.SOL2/Make.libs $(TMPDIR)/MAKE_LIBS.SOL 
	@ln -s $(DFSHOME)/../sun4.x/Make.conf $(TMPDIR)/MAKE_CONF.SUN4X
	@ln -s $(DFSHOME)/../sun4.x/Make.libs $(TMPDIR)/MAKE_LIBS.SUN4X
	@cat $(TARDIR)/tmp/Makefile | sed s/PROG_NAME/sedr2asc/ > \
	    $(TMPDIR)/Makefile
	@cat $(SOFTDIR)/doc/sedr2asc.txt \
	     $(TARDIR)/tmp/INSTALL.TXT > $(TMPDIR)/SEDR2ASC.TXT
	@mkdir $(TMPDIR)/bin
	@mkdir $(TMPINC)
	@ln -s $(DFSINC)/BC.h $(TMPINC)
	@ln -s $(DFSINC)/abbrev.h $(TMPINC)
	@ln -s $(DFSINC)/blockc.h $(TMPINC)
	@ln -s $(DFSINC)/buf_list.h $(TMPINC)
	@ln -s $(DFSINC)/buffblkc.h $(TMPINC)
	@ln -s $(DFSINC)/bufferc.h $(TMPINC)
	@ln -s $(DFSINC)/cmdlinec.h $(TMPINC)
	@ln -s $(DFSINC)/cmdlineext.h $(TMPINC)
	@ln -s $(DFSINC)/dfs_buffer.h $(TMPINC)
	@ln -s $(DFSINC)/ffio.h $(TMPINC)
	@ln -s $(DFSINC)/filetype.h $(TMPINC)
	@ln -s $(DFSINC)/flagdefc.h $(TMPINC)
	@ln -s $(DFSINC)/funcdefc.h $(TMPINC)
	@ln -s $(DFSINC)/helpc.h $(TMPINC)
	@ln -s $(DFSINC)/highpipec.h $(TMPINC)
	@ln -s $(DFSINC)/list.h $(TMPINC)
	@ln -s $(DFSINC)/lowmask.h $(TMPINC)
	@ln -s $(DFSINC)/maxpipec.h $(TMPINC)
	@ln -s $(DFSINC)/message.h $(TMPINC)
	@ln -s $(DFSINC)/miscc.h $(TMPINC)
	@ln -s $(DFSINC)/overlayc.h $(TMPINC)
	@ln -s $(DFSINC)/parserc.h $(TMPINC)
	@ln -s $(DFSINC)/pattern.h $(TMPINC)
	@ln -s $(DFSINC)/pipec.h $(TMPINC)
	@ln -s $(DFSINC)/specialc.h $(TMPINC)
	@ln -s $(DFSINC)/sql.h $(TMPINC)
	@ln -s $(DFSINC)/stddescc.h $(TMPINC)
	@ln -s $(DFSINC)/stdpipec.h $(TMPINC)
	@ln -s $(DFSINC)/stdvarsc.h $(TMPINC)
	@ln -s $(DFSINC)/sysmax.h $(TMPINC)
	@ln -s $(DFSINC)/timec.h $(TMPINC)
	@ln -s $(DFSINC)/vars.h $(TMPINC)
	@mkdir $(TMPLIB)
	@mkdir $(TMPLIB)/obj
	@mkdir $(TMPLIB)/src
	@ln -s $(DFSLIBSRC)/binary $(TMPLIB)/src
	@ln -s $(DFSLIBSRC)/miscc $(TMPLIB)/src
	@ln -s $(DFSLIBSRC)/parserc $(TMPLIB)/src
	@ln -s $(DFSLIBSRC)/pipec $(TMPLIB)/src
	@mkdir $(TMPDIR)/programs
	@ln -s $(TARDIR)../SOLARIS/SOURCE/SEDR2ASC $(TMPDIR)/programs/sedr2asc

#	(cd $(TMPDIR)/.. ; \
#	tar cvFFhlf $(TARDIR)/SEDR2ASC.TAR SEDR2ASC ; \
#	compress $(TARDIR)/SEDR2ASC.TAR ; \
#	rm -fr SEDR2ASC)
