# Makefile for "Jlisp"
# This version uses Watcom's "make" utility

CLASSES = Attribute_info.java AutoLoad.java BuiltinFunction.java &
	ByteArray.java ByteCodes.java ByteOpt.java Bytecode.java &
	CONSTANT_Class_info.java CONSTANT_Fieldref_info.java  &
	CONSTANT_Methodref_info.java CONSTANT_NameAndType_info.java &
	CONSTANT_Utf8_info.java CWin.java CallAs.java &
	ClassDescription.java Code_attribute.java Cons.java &
	Cp_info.java DoubleWriter.java EOFException.java &
	Exceptions_attribute.java &
	ExtensionFileFilter.java Fasl.java Field_info.java &
	FnWithEnv.java Fns.java Fns1.java Fns2.java Fns3.java &
	Fns4.java Gensym.java InputPane.java Interpreted.java &
	JavaFn.java Jlisp.java JlispClassLoader.java LispBigInteger.java &
	LispCounter.java LispDigester.java LispEqualHash.java &
	LispEqualObject.java LispException.java LispExploder.java &
	LispFloat.java LispFunction.java LispHash.java LispInteger.java &
	LispJavaFunction.java LispNumber.java LispObject.java &
	LispOutputStream.java LispOutputString.java LispSmallInteger.java &
	LispStream.java LispString.java LispStringReader.java &
	LispVector.java ListReader.java Lit.java Macro.java &
	Method_info.java MyMath.java PDS.java PDSEntry.java &
	PDSInputStream.java PDSOutputStream.java ProgEvent.java &
	SourceFile_attribute.java Specfn.java SpecialFunction.java &
	Spid.java StaticFns.java Symbol.java TracedFunction.java &
	Undefined.java UserJava.java WriterToLisp.java


all:	Jlisp.zip $(CLASSES)

clean:	.symbolic
	-del *.class
	-del *.bak
	-del *~
	-del Jlisp.zip

Jlisp.zip:	$(CLASSES)
	zip -q Jlisp.zip *.class

.EXTENSIONS:
.EXTENSIONS:	.class .java

.java.class:
	javac -deprecation $[.



STORE     = -k16000
SYMBOLIC  = .SYMBOLIC
WX        =
RM        = del
MKDIR     = mkdir
COPY      = copy
STRIP     = -echo

###########################################################################

C = ..\cslbase


jlisp.img:	jlisp.zip compat.lsp compiler.lsp &
			ccomp.lsp extras.lsp
	-$(RM) jlisp.img
	jlisp $(STORE) -v -z -o jlisp.img build0.lsp -- jlispimg.log


# "make rl" manufactures an image file that contains just an Rlisp parser

rl:	$(SYMBOLIC) rlisp.img

rlisp.img:	jlisp.zip compat.lsp compiler.lsp ccomp.lsp extras.lsp &
		mkrlisp.lsp
	jlisp $(STORE) -v -z -o rlisp.img mkrlisp.lsp -l rlisp.log


#
# slowr36 is a version of Reduce used just to compile the final version.
# It is larger and slower than the final release version, and will not have
# all the optional modules built into it.
#

slowr36.img:	jlisp.zip slowr36.lsp ..\src\boot.sl &
		..\src\cslprolo.red ..\src\module.red &
		..\src\rlisp.red ..\src\cslrend.red ..\src\poly.red &
		..\src\alg.red ..\src\arith.red ..\src\mathpr.red &
		..\src\entry.red
	jlisp $(STORE) -o slowr36.img -v -z &
		slowr36.lsp -l slowr36.log



# from here down is un-reconstructed...


# "r36.img" is an image file for the main parts of Reduce

r36.img:	fasl36.img r36.zip
	$(WX) r36 $(STORE) -v -z -i fasl36.img -o- ..\cslsrc\r36.lsp -- r36.log
	-$(MKDIR) log

# "make patches" can be used after the "src/patches.red" file has changed

patches:	..\src\patches.red $(SYMBOLIC)
	$(WX) r36 $(STORE) -v ..\cslsrc\mkpatch.red -- mkpatch.log
	$(WX) r36 $(STORE) -v -i- -o fasl36.img ..\cslsrc\mkpatch1.red -- mkpatch1.log
	$(WX) r36 $(STORE) -v -z -i fasl36.img -o- ..\cslsrc\r36.lsp -- r36.log


#
# "make testall" tests the final production version of Reduce
#

testall:	log\algint.log log\applysym.log log\arnum.log log\assist.log log\avector.log &
		log\boolean.log log\cali.log log\camal.log log\changevr.log &
		log\compact.log log\complex.log log\crack.log log\cvit.log &
		log\decompos.log log\defint.log log\desir.log log\dfpart.log &
		log\dummy.log log\elem.log log\excalc.log log\factor.log &
		log\fide.log log\fps.log log\gcd.log log\gentran.log &
		log\groebner.log log\ideals.log log\ineq.log log\int.log &
		log\invbase.log log\laplace.log log\lie.log log\limits.log &
		log\linalg.log log\math.log log\matrix.log log\modsr.log &
		log\ncpoly.log log\normform.log log\numeric.log log\odesolve.log &
		log\orthovec.log log\pf.log log\physop.log log\pmrules.log &
		log\randpoly.log log\reacteqn.log log\reduce.log log\residue.log log\rlfi.log &
		log\rlisp88.log log\roots.log log\rounded.log log\rsolve.log &
		log\scope.log log\sets.log log\solve.log log\spde.log &
		log\specfn.log log\sum.log log\symmetry.log log\taylor.log &
		log\tps.log log\tri.log log\trigsimp.log log\wu.log log\xcolor.log log\xideal.log &
		log\zeilberg.log log\ztrans.log $(SYMBOLIC)
	-echo all tests done





# fasl36.img is a file needed during a re-build of Reduce. It contains
# compiled versions of all the Reduce modules.

fasl36.img:	jlisp.zip slowr36.img
	-$(RM) fasl36.img
	jlisp $(STORE) -v -i slowr36.img -o fasl36.img &
		..\cslsrc\fasl36.red -- fasl36.log

#
# r36.exe can only be built when all the user-generated C code has been
# built.
#

r36.exe:	bytes.obj $(OBJS) &
		$(UOBJS)
	$(LINK) $(LFLAGS) bytes.obj,$(COBJS),$(CUOBJS) $(LIBS) $(OUT) r36.exe $(TAIL)
	wrc -i..\cslsrc -i$(C) -bt=nt ..\cslsrc\r36.rc r36.exe
	$(STRIP) r36.exe

#
# A few targets here may help me tidy up my filespace from time to time
#

xcleansmall: $(SYMBOLIC)
	-$(RM) slowr36.img

xclean: $(SYMBOLIC)
	-$(RM) slowr36.img
	-$(RM) r36.exe
	-$(RM) fasl36.img
	-$(RM) r36.img



#
# "make lispfile"
#           recreates compiler.lsp, extras.lsp and ccomp.lsp from
#           the corresponding master sources which are held in RLISP
#           form.  Temporarily builds an RLISP parser on the way.

lispfile:	csl.exe csl.img $(C)\lispfile.lsp $(SYMBOLIC)
	$(WX) csl $(STORE) -v -z $(C)\lispfile.lsp &
		-D@cslbase="$(C)" -- lispfile.log

signature:	$(C)\version.hhh register.key $(SYMBOLIC)
	filesign -u $(C)\version.hhh $(C)\version.h Developer or tester


#
# "make ccode" re-manufactures u01.c to u12.c and u01.lsp to u12.lsp
# I do not put in dependencies that cause this to happen automatically
# since experience shows that if I did it would happen (at significant
# expense) much too often.  However when things alter in the Reduce
# source directory or when major changes are made to CSL this should be
# activated.
#

#
# N.B. the step here used $(XSTORE) rather than $(STORE) because this
# build step may take more memory than any other.
#

ccode:	slowcsl.exe slowr36.img $(SYMBOLIC)
	$(WX) slowcsl $(XSTORE) -i slowr36.img -v ..\cslsrc\select36.red -- select36.log

#
# Code to recreate the log files from the production version of the system.
#
# Note that for Windows benefit I use my own private output redirection with
# "--" rather than ">", since ">" seems incompatible with fully window
# applications, even when launched from the command line. Then to make this
# file consistent across platforms I use the same scheme all the time.
#

log\algint.log:	r36.exe r36.img ..\xmpl\algint.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=algint -Dloadup=algint -- log\algint.log

log\applysym.log:	r36.exe r36.img ..\xmpl\applysym.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=applysym -Dloadup=applysym -- log\applysym.log

log\arnum.log:	r36.exe r36.img ..\xmpl\arnum.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=arnum -Dloadup=arnum -- log\arnum.log

log\assist.log:	r36.exe r36.img ..\xmpl\assist.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=assist -Dloadup=assist -- log\assist.log

log\avector.log:	r36.exe r36.img ..\xmpl\avector.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=avector -Dloadup=avector -- log\avector.log

log\boolean.log:	r36.exe r36.img ..\xmpl\boolean.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=boolean -Dloadup=boolean -- log\boolean.log

log\cali.log:	r36.exe r36.img ..\xmpl\cali.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=cali -Dloadup=cali -- log\cali.log

log\camal.log:	r36.exe r36.img ..\xmpl\camal.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=camal -Dloadup=camal -- log\camal.log

log\changevr.log:	r36.exe r36.img ..\xmpl\changevr.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=changevr -Dloadup=changevr -- log\changevr.log

log\compact.log:	r36.exe r36.img ..\xmpl\compact.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=compact -Dloadup=compact -- log\compact.log

log\complex.log:	r36.exe r36.img ..\xmpl\complex.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=complex -- log\complex.log

log\crack.log:	r36.exe r36.img ..\xmpl\crack.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=crack -Dloadup=crack -- log\crack.log

log\cvit.log:	r36.exe r36.img ..\xmpl\cvit.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=cvit -Dloadup=cvit -- log\cvit.log

log\decompos.log:	r36.exe r36.img ..\xmpl\decompos.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=decompos -- log\decompos.log

log\defint.log:	r36.exe r36.img ..\xmpl\defint.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=defint -Dloadup=defint -- log\defint.log

log\desir.log:	r36.exe r36.img ..\xmpl\desir.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=desir -Dloadup=desir -- log\desir.log

log\dfpart.log:	r36.exe r36.img ..\xmpl\dfpart.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=dfpart -Dloadup=dfpart -- log\dfpart.log

log\dummy.log:	r36.exe r36.img ..\xmpl\dummy.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=dummy -Dloadup=dummy -- log\dummy.log

log\elem.log:	r36.exe r36.img ..\xmpl\elem.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=elem -- log\elem.log

log\excalc.log:	r36.exe r36.img ..\xmpl\excalc.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=excalc -Dloadup=excalc -- log\excalc.log

log\factor.log:	r36.exe r36.img ..\xmpl\factor.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=factor -- log\factor.log

log\fide.log:	r36.exe r36.img ..\xmpl\fide.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=fide -Dloadup=fide -- log\fide.log

log\fps.log:	r36.exe r36.img ..\xmpl\fps.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=fps -Dloadup=fps -- log\fps.log

log\gcd.log:	r36.exe r36.img ..\xmpl\gcd.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=gcd -- log\gcd.log

log\gentran.log:	r36.exe r36.img ..\xmpl\gentran.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=gentran -Dloadup=gentran -- log\gentran.log

log\groebner.log:	r36.exe r36.img ..\xmpl\groebner.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=groebner -Dloadup=groebner -- log\groebner.log

log\ideals.log:	r36.exe r36.img ..\xmpl\ideals.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=ideals -Dloadup=ideals -- log\ideals.log

log\ineq.log:	r36.exe r36.img ..\xmpl\ineq.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=ineq -Dloadup=ineq -- log\ineq.log

log\int.log:	r36.exe r36.img ..\xmpl\int.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=int -- log\int.log

log\invbase.log:	r36.exe r36.img ..\xmpl\invbase.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=invbase -Dloadup=invbase -- log\invbase.log

log\laplace.log:	r36.exe r36.img ..\xmpl\laplace.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=laplace -Dloadup=laplace -- log\laplace.log

log\lie.log:	r36.exe r36.img ..\xmpl\lie.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=lie -Dloadup=lie -- log\lie.log

log\limits.log:	r36.exe r36.img ..\xmpl\limits.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=limits -- log\limits.log

log\linalg.log:	r36.exe r36.img ..\xmpl\linalg.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=linalg -Dloadup=linalg -- log\linalg.log

log\math.log:	r36.exe r36.img ..\xmpl\math.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=math -- log\math.log

log\matrix.log:	r36.exe r36.img ..\xmpl\matrix.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=matrix -- log\matrix.log

log\modsr.log:	r36.exe r36.img ..\xmpl\modsr.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=modsr -Dloadup=modsr -- log\modsr.log

log\ncpoly.log:	r36.exe r36.img ..\xmpl\ncpoly.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=ncpoly -Dloadup=ncpoly -- log\ncpoly.log

log\normform.log:	r36.exe r36.img ..\xmpl\normform.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=normform -Dloadup=normform -- log\normform.log

log\numeric.log:	r36.exe r36.img ..\xmpl\numeric.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=numeric -Dloadup=numeric -- log\numeric.log

log\odesolve.log:	r36.exe r36.img ..\xmpl\odesolve.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=odesolve -Dloadup=odesolve -- log\odesolve.log

log\orthovec.log:	r36.exe r36.img ..\xmpl\orthovec.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=orthovec -Dloadup=orthovec -- log\orthovec.log

log\pf.log:	r36.exe r36.img ..\xmpl\pf.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=pf -- log\pf.log

log\physop.log:	r36.exe r36.img ..\xmpl\physop.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=physop -Dloadup=physop -- log\physop.log

log\pmrules.log:	r36.exe r36.img ..\xmpl\pmrules.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=pmrules -Dloadup=pmrules -- log\pmrules.log

log\randpoly.log:	r36.exe r36.img ..\xmpl\randpoly.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=randpoly -Dloadup=randpoly -- log\randpoly.log

log\reacteqn.log:	r36.exe r36.img ..\xmpl\reacteqn.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=reacteqn -Dloadup=reacteqn -- log\reacteqn.log

log\reduce.log:	r36.exe r36.img ..\xmpl\reduce.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=reduce -- log\reduce.log

log\residue.log:	r36.exe r36.img ..\xmpl\residue.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=residue -Dloadup=residue -- log\residue.log

log\rlfi.log:	r36.exe r36.img ..\xmpl\rlfi.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=rlfi -Dloadup=rlfi -- log\rlfi.log

log\rlisp88.log:	r36.exe r36.img ..\xmpl\rlisp88.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=rlisp88 -- log\rlisp88.log

log\roots.log:	r36.exe r36.img ..\xmpl\roots.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=roots -- log\roots.log

log\rounded.log:	r36.exe r36.img ..\xmpl\rounded.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=rounded -- log\rounded.log

log\rsolve.log:	r36.exe r36.img ..\xmpl\rsolve.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=rsolve -Dloadup=rsolve -- log\rsolve.log

log\scope.log:	r36.exe r36.img ..\xmpl\scope.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=scope -Dloadup=scope -- log\scope.log

log\sets.log:	r36.exe r36.img ..\xmpl\sets.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=sets -Dloadup=sets -- log\sets.log

log\solve.log:	r36.exe r36.img ..\xmpl\solve.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=solve -- log\solve.log

log\spde.log:	r36.exe r36.img ..\xmpl\spde.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=spde -Dloadup=spde -- log\spde.log

log\specfn.log:	r36.exe r36.img ..\xmpl\specfn.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=specfn -Dloadup=specfn -- log\specfn.log

log\sum.log:	r36.exe r36.img ..\xmpl\sum.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=sum -- log\sum.log

log\symmetry.log:	r36.exe r36.img ..\xmpl\symmetry.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=symmetry -Dloadup=symmetry -- log\symmetry.log

log\taylor.log:	r36.exe r36.img ..\xmpl\taylor.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=taylor -Dloadup=taylor -- log\taylor.log

log\tps.log:	r36.exe r36.img ..\xmpl\tps.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=tps -Dloadup=tps -- log\tps.log

log\tri.log:	r36.exe r36.img ..\xmpl\tri.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=tri -Dloadup=tri -- log\tri.log

log\trigsimp.log:	r36.exe r36.img ..\xmpl\trigsimp.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=trigsimp -Dloadup=trigsimp -- log\trigsimp.log

log\wu.log:	r36.exe r36.img ..\xmpl\wu.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=wu -Dloadup=wu -- log\wu.log

log\xcolor.log:	r36.exe r36.img ..\xmpl\xcolor.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=xcolor -Dloadup=xcolor -- log\xcolor.log

log\xideal.log:	r36.exe r36.img ..\xmpl\xideal.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=xideal -Dloadup=xideal -- log\xideal.log

log\zeilberg.log:	r36.exe r36.img ..\xmpl\zeilberg.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=zeilberg -Dloadup=zeilberg -- log\zeilberg.log

log\ztrans.log:	r36.exe r36.img ..\xmpl\ztrans.tst
	$(WX) r36 $(STORE) -b ..\cslsrc\ndotest.red -Dname=ztrans -Dloadup=ztrans -- log\ztrans.log

# end of makefile
