#include "imake.defs"

VER=2.0
HV=HeNCE-$(VER)
SUBDIRS=htool master 
TARDIRS=READ-ME* Brain-Damage Imakefile Makefile.lib Compiling \
 $(SUBDIRS) imake.defs
RTL=pvm3/bin/$(PVM_ARCH)/proxyd pvm3/include/dlist.h pvm3/include/hence.h \
 pvm3/include/imalloc.h pvm3/include/std.h pvm3/include/htypes.h \
 pvm3/include/list.h pvm3/include/rb.h pvm3/lib/$(PVM_ARCH)/liballoc.a \
 pvm3/lib/$(PVM_ARCH)/libdl.a pvm3/lib/$(PVM_ARCH)/libhence3.a \
 pvm3/lib/$(PVM_ARCH)/librb.a pvm3/lib/$(PVM_ARCH)/libslave3.a
FULL=$(RTL) pvm3/bin/$(PVM_ARCH)/htool pvm3/bin/$(PVM_ARCH)/master
FILTERS=-e '/.*[-~]$$/d' \
        -e '/.*\.o$$/d' \
        -e '/^demos*\/.*\/[cf]w_.*\.[ch]$$/d' \
	-e '/^demos*\/.*\/fmain\.f$$/d' \
	-e '/^demos*\/.*\/*\.mat$$/d' \
	-e '/\.Z$$/d' \
	-e '/Makefile.bak$$/d' \
	-e '/Makefile$$/d' \
	-e '/core$$/d' \
	-e '/\.rej$$/d' \
	-e '/\/RCS\//d' \
	-e '/\/:Junque\//d' \
	-e '/\/lex.yy.c$$/d' \
	-e '/\/y.tab.c$$/d' \
	-e '/lex.out$$/d' \
	-e '/\.[oa]$$/d' \
	-e '/\/\.[^\/]*$$/d' \
	-e 's;^;hence2/;'

AllTarget($(SUBDIRS))

NamedTargetSubdirs($(SUBDIRS),$(SUBDIRS),"making" all, ,all)

CleanSubdirs($(SUBDIRS))

InstallSubdirs($(SUBDIRS))

MakefileSubdirs($(SUBDIRS))

DependSubdirs($(SUBDIRS))

src::
	echo 'did you "make clean" first?'
	sleep 5
	find $(TARDIRS) -type f -print | sort | sed $(FILTERS) > /tmp/$$$$ ;\
	( cd .. ; tar cvf - -I /tmp/$$$$ | compress ) > $(HV)-src.tar.Z
	uuencode < $(HV)-src.tar.Z $(HV)-src.tar.Z | sed -e '/^M/s/ /`/g' > $(HV)-src.tar.Z.uu
	rm -f /tmp/$$$$ HeNCE-$(VER)-src.tar.Z

full::
	chmod 644 "$(HOME)/pvm3/include/"*.h
	(cd $(HOME); tar cvf - $(FULL)) | \
		compress > $(HV)-full.$(PVM_ARCH).tar.Z
	uuencode < $(HV)-full.$(PVM_ARCH).tar.Z $(HV)-full.$(PVM_ARCH).tar.Z |\
 		sed -e '/^M/s/ /`/g' > $(HV)-full.$(PVM_ARCH).tar.Z.uu
	rm -f $(HV)-full.$(PVM_ARCH).tar.Z

rtl::
	chmod 644 "$(HOME)/pvm3/include/"*.h
	(cd $(HOME); tar cvf - $(RTL)) | compress > $(HV)-rtl.$(PVM_ARCH).tar.Z
	uuencode < $(HV)-rtl.$(PVM_ARCH).tar.Z $(HV)-rtl.$(PVM_ARCH).tar.Z |\
		sed -e '/^M/s/ /`/g' > $(HV)-rtl.$(PVM_ARCH).tar.Z.uu
	rm -f $(HV)-rtl.$(PVM_ARCH).tar.Z

examples::
	rm -f hence_examples
	ln -s examples hence_examples
	tar cfh hence_examples | compress > HeNCE-examples.tar.Z
	rm -f hence_examples
