##	Makefile for the RJ tools

SHELL = /bin/sh


# for each X, create
#     ../bin/X, which is used in Linux
#     ../bin/X.bat, which is used in Windows; it invokes perl on X

all: dependencies jstuff perlutils

# don't bother with specifying dependencies on what we're making here.
# simply remaking everything is quick enough.

# file to which to output dependencies
deps = Deps
# files to include at top of each .pl file
top = U_Header.pl U_Protos.pl

dependencies:
	icont -u Makedeps.icn
	./Makedeps j*.pl rj*.pl u_*.pl > $(deps)

jstuff:	  rj  rjt rjrun rjc  \
          rjgo  jgo  rjgot jgot rjgox  jgox  \
          jfindmain rjfindmain

rj rjt rjrun rjc rjgo jgo rjgot jgot rjgox jgox rjfindmain jfindmain :
	cat $(top) `grep ^$@.pl $(deps)` > ../bin/$@
	chmod +x ../bin/$@
	perl Genbat.pl $@ '%RJ_HOME%\tools\bin\' "" > ../bin/$@.bat

perlutils:
	cp cmp.pl cmpNoCR.pl grep.pl lst.pl sort.pl tail.pl which.pl ../bin
