Version française
Home     About     Download     Resources     Contact us    
Browse thread
camltk with native code compiler ocamlopt?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Wolfram Kahl <kahl@d...>
Subject: Re: camltk with native code compiler ocamlopt?

Basile STARYNKEVITCH writes:

 > [[english]]
 > Hello?

 > Is there anywere a tiny patch (I expect only Makefile-s to change) to
 > use the camltk41 interface to the Tk toolkit in native code (not
 > bytecode) produced by the ocamlopt compiler (version 1.05, platform is
 > PentiumPro with Linux)

 > Thanks!

 > [[french]]

 > Je cherche un patch (probablement uniquement les Makefile-s à changer)
 > pour utiliser l'interface camltk41 à la bibliothèque Tk en code natif,
 > (pas le code octet) produit par le compilateur ocamlopt (version 1.05,
 > sur Linux / PentiumPro)?

 > Merci

I have a done this for 1.02 and it works perfectly;
for my application the speed doubles.
The only known problem is that I cannot compile lablbrowser
since it needs toplevel stuff.

For 1.04 a few things had to be changed
and I am not quite so sure of the results, although essentially it works;
also the patch is not so clean (probably a few absolute paths remain).
I haven't tried 1.5 yet.

Anyway, I include both patches below (take care to use only one of them!!!).
It would be brilliant if future releases of olabl supported this.

IMPORTANT: In order to compile tk.ml; at least on the SUN Sparc,
it is necessary to change all occurrences of 10000 in asmcomp/emit_*.mlp
for your machine to say 20000 before making the optimising compiler
(otherwise the assembler will fail). Perhaps that constant is somewhat
arbitrary and should therefore be given a name that simplifies changing
its value globally.

Another question in this vein:

Would it be possible to compile EVERYTHING, including the compilers,
to native code? Perhaps another Makefile target after ``make opt''
could be ``make optworld''?


[[short and bad french]]

Il y a deux patch pour les versions 1.02 et 1.04,
la pour 1.02 travail tres bien.

Importantement, il faut changer la constant ``10000'' a ``20000''
ens tous ses occurrence dans le fichier asmcomp/emit_*.mlp pour
l' ordinateur desire avant faire ``make opt''.

================

Many thanks to the makers of OCaml and OLabl!!!


Wolfram Kahl


==============================================================================
labltk41-1.04-opt.patch
==============================================================================
diff -r -c olabl-1.04/labltk41/Makefile ocaml-1.04/labltk41/Makefile
*** olabl-1.04/labltk41/Makefile	Sat Feb 15 11:06:56 1997
--- ocaml-1.04/labltk41/Makefile	Fri Mar 21 18:10:52 1997
***************
*** 8,13 ****
--- 8,19 ----
  	cd lib; $(MAKE) -f Makefile.gen; $(MAKE)
  	cd jpf; $(MAKE)
  
+ opt:
+ #	cd libsupport; $(MAKE) opt
+ 	cd lib; $(MAKE) opt
+ 	cd jpf; $(MAKE) opt
+ #	cd browser; $(MAKE) opt
+ 
  Makefile.config:
  	@echo "You must configure first. Read INSTALL."
  	exit 1
***************
*** 38,43 ****
--- 44,54 ----
  	cd compiler; $(MAKE) install
  	cd jpf; $(MAKE) install
  	cd browser; $(MAKE) install
+ 
+ installopt: 
+ 	cd lib; $(MAKE) installopt
+ 	cd jpf; $(MAKE) installopt
+ #	cd browser; $(MAKE) installopt
  
  clean : 
  	-rm -f config.cache
diff -r -c olabl-1.04/labltk41/Makefile.config ocaml-1.04/labltk41/Makefile.config
*** olabl-1.04/labltk41/Makefile.config	Fri Jun 13 10:05:03 1997
--- ocaml-1.04/labltk41/Makefile.config	Fri Mar 21 17:38:14 1997
***************
*** 0 ****
--- 1,42 ----
+ # Generated automatically from Makefile.config.in by configure.
+ ## Where you installed Objective Label
+ LIBDIR=/opt/ocaml-1.04/lib/olabl
+ 
+ ## Where are the sources (for LablBrowser).
+ OLABLDIR=../..
+ 
+ ## Where you want to install LablTk41 libraries and binaries
+ INSTALLDIR=/opt/ocaml-1.04/lib/olabl/labltk41
+ INSTALLBINDIR=/opt/ocaml-1.04/bin
+ 
+ ### What to use to link with X
+ X11_LIBS=-ccopt " -L/global/X11R5sol2.3/lib -R /global/X11R5sol2.3/lib" -cclib " -lX11  -lnsl -lsocket"
+ 
+ ### What to use to compile and link with Tcl/Tk
+ TKINCLUDES=-ccopt "-I/opt/ocaml-1.04/include  -I/global/X11R5sol2.3/include"
+ TKLIBS=-ccopt "-L/opt/ocaml-1.04/lib" -cclib "-ltk4.2 -ltcl7.6 -lsocket -lnsl -ldl -lm"
+ 
+ ### Making a library
+ RANLIB=:
+ 
+ ### Shouldn't need to change anything below
+ ## Tools from the Objective Label distribution
+ EXCRC=$(LIBDIR)/extract_crc
+ EXPUNGE=$(LIBDIR)/expunge
+ 
+ LABLC=olablc
+ LABLCOMP=$(LABLC) -c
+ CPP=/lib/cpp -P
+ LABLYACC=ocamlyacc -v
+ LABLLEX=ocamllex
+ LABLLIBR=$(LABLC) -a
+ LABLDEP=ocamldep
+ COMPFLAGS=
+ LINKFLAGS=
+ LABLOPTC=olablopt
+ LABLOPTCOMP=$(LABLOPTC) -c
+ LABLOPTLIBR=$(LABLOPTC) -a
+ #CAMLOPT=olablopt
+ #CAMLCOPT=olablopt -c
+ 
+ ## End of configuration section
diff -r -c olabl-1.04/labltk41/browser/Makefile ocaml-1.04/labltk41/browser/Makefile
*** olabl-1.04/labltk41/browser/Makefile	Fri Feb 21 10:05:04 1997
--- ocaml-1.04/labltk41/browser/Makefile	Fri Mar 21 18:10:20 1997
***************
*** 11,21 ****
--- 11,30 ----
  	fileselect.cmo	searchid.cmo	searchpos.cmo	shell.cmo	\
  	viewer.cmo	typecheck.cmo	editor.cmo	main.cmo
  
+ OBJX =	list2.cmx	useunix.cmx	setpath.cmx	lexical.cmx	\
+ 	fileselect.cmx	searchid.cmx	searchpos.cmx	shell.cmx	\
+ 	viewer.cmx	typecheck.cmx	editor.cmx	main.cmx
+ 
  JG =	jg_tk.cmo	jg_config.cmo	jg_bind.cmo	 jg_completion.cmo \
  	jg_box.cmo \
  	jg_button.cmo	jg_text.cmo	jg_toplevel.cmo	jg_message.cmo \
  	jg_menu.cmo	jg_entry.cmo	jg_multibox.cmo
  
+ JGX =	jg_tk.cmx	jg_config.cmx	jg_bind.cmx	 jg_completion.cmx \
+ 	jg_box.cmx \
+ 	jg_button.cmx	jg_text.cmx	jg_toplevel.cmx	jg_message.cmx \
+ 	jg_menu.cmx	jg_entry.cmx	jg_multibox.cmx
+ 
  # Default rules
  
  .SUFFIXES: .ml .mli .cmo .cmi .cmx
***************
*** 23,43 ****
--- 32,70 ----
  .ml.cmo:
  	$(COMPILER) $(INCLUDES) $<
  
+ .ml.cmx:
+ 	$(LABLOPTCOMP) $(INCLUDES) $<
+ 
  .mli.cmi:
  	$(COMPILER) $(INCLUDES) $<
  
  all: lablbrowser
  
+ opt: lablbrowse
+ 
  lablbrowser: jglib.cma $(OBJ)
  	$(LINKER) -o lablbrowser $(LABLTKLIB) toplevellib.cma \
  		unix.cma str.cma tk41.cma jglib.cma $(OBJ) \
  		-cclib -lstr -cclib -lunix $(SYSLIBS)
  
+ lablbrowse: jglib.cmxa $(OBJX)
+ 	labltkld -o lablbrowse \
+ #toplevellib.cmxa \
+ 		str.cmxa tk41.cmxa jglib.cmxa $(OBJX) \
+ 		-cclib -lstr
+ #-cclib -ltoplevel
+ 
  jglib.cma: $(JG)
  	$(COMPILER) -a -o jglib.cma $(JG) 
  
+ jglib.cmxa: $(JGX)
+ 	$(LABLOPTLIBR) -o jglib.cmxa $(JGX) 
+ 
  install:
  	if test -f lablbrowser; then : ; cp lablbrowser $(INSTALLBINDIR); fi
+ 
+ installopt:
+ 	if test -f lablbrowse; then : ; cp lablbrowse $(INSTALLBINDIR); fi
  
  clean:
  	rm -f *.cm? lablbrowser *~ *.orig
diff -r -c olabl-1.04/labltk41/configure ocaml-1.04/labltk41/configure
*** olabl-1.04/labltk41/configure	Fri Feb 14 19:04:20 1997
--- ocaml-1.04/labltk41/configure	Thu Mar 20 12:04:21 1997
***************
*** 1178,1183 ****
--- 1178,1184 ----
  else
    ac_save_LIBS="$LIBS"
  LIBS="-lnsl  $LIBS"
+ echo $ac_n "LIBS = '$LIBS'" 1>&6
  cat > conftest.$ac_ext <<EOF
  #line 1179 "configure"
  #include "confdefs.h"
***************
*** 1221,1226 ****
--- 1222,1228 ----
  else
    ac_save_LIBS="$LIBS"
  LIBS="-lsocket  $LIBS"
+ echo $ac_n "LIBS = '$LIBS'" 1>&6
  cat > conftest.$ac_ext <<EOF
  #line 1222 "configure"
  #include "confdefs.h"
***************
*** 1287,1292 ****
--- 1289,1295 ----
    echo "$ac_t""no" 1>&6
  fi
  
+ echo $ac_n "LIBS = '$LIBS'" 1>&6
  
  # Extract the first word of "cpp", so it can be a program name with args.
  set dummy cpp; ac_word=$2
***************
*** 1362,1367 ****
--- 1365,1371 ----
    echo "$ac_t""no" 1>&6
  fi
  
+ LIBS="-lsocket -lnsl -ldl -lm"
  
  ### Check for Tcl7.5(7.6) and Tk4.1(4.2)
  echo $ac_n "checking Tcl and Tk includes and libraries""... $ac_c" 1>&6
diff -r -c olabl-1.04/labltk41/example/Makefile ocaml-1.04/labltk41/example/Makefile
*** olabl-1.04/labltk41/example/Makefile	Fri Mar 14 09:56:35 1997
--- ocaml-1.04/labltk41/example/Makefile	Fri Mar 21 18:13:30 1997
***************
*** 11,16 ****
--- 11,18 ----
  
  all: hello demo eyes calc tetris
  
+ opt: hellox demox eyesx calcx tetrisx
+ 
  hello: hello.cmo
  	$(LABLC) -custom $(COMPFLAGS) -o hello tk41.cma hello.cmo $(TKLINKOPT)
  
diff -r -c olabl-1.04/labltk41/example/demo.ml ocaml-1.04/labltk41/example/demo.ml
*** olabl-1.04/labltk41/example/demo.ml	Fri Feb 14 19:04:24 1997
--- ocaml-1.04/labltk41/example/demo.ml	Fri Mar 21 18:32:10 1997
***************
*** 2,8 ****
  
  (* First, open these modules for convenience *)
  open Tk
! open Support
  
  (* Dummy let *)
  let _ =
--- 2,8 ----
  
  (* First, open these modules for convenience *)
  open Tk
! open Widget
  
  (* Dummy let *)
  let _ =
diff -r -c olabl-1.04/labltk41/jpf/Makefile ocaml-1.04/labltk41/jpf/Makefile
*** olabl-1.04/labltk41/jpf/Makefile	Fri Feb 14 19:04:21 1997
--- ocaml-1.04/labltk41/jpf/Makefile	Fri Mar 21 17:40:04 1997
***************
*** 3,8 ****
--- 3,9 ----
  COMPFLAGS=-I ../lib -I ../support
  
  OBJS= fileselect.cmo balloon.cmo
+ OBJSX= fileselect.cmx balloon.cmx
  
  TKLINKOPT=$(STATIC) \
  	  -ccopt -L../support -cclib -llabltk41 \
***************
*** 10,23 ****
  
  all: libjpf.cma
  
  test: balloontest
  
  libjpf.cma: $(OBJS)
! 	$(LABLLIBR) -a -o libjpf.cma $(OBJS)
  
  install: libjpf.cma
  	cp *.cmi *.mli libjpf.cma $(INSTALLDIR)
  
  clean:
  	rm -f *.cm* *~ *test
  
--- 11,32 ----
  
  all: libjpf.cma
  
+ opt: libjpf.cmxa
+ 
  test: balloontest
  
  libjpf.cma: $(OBJS)
! 	$(LABLLIBR) -o libjpf.cma $(OBJS)
! 
! libjpf.cmxa: $(OBJSX)
! 	$(LABLOPTLIBR) -o libjpf.cmxa $(OBJSX)
  
  install: libjpf.cma
  	cp *.cmi *.mli libjpf.cma $(INSTALLDIR)
  
+ installopt: libjpf.cmxa
+ 	cp *.cmi *.mli libjpf.a libjpf.cmxa $(LIBDIR)
+ 
  clean:
  	rm -f *.cm* *~ *test
  
***************
*** 29,42 ****
  
  balloontest.cmo : balloon.cmo libjpf.cma
  
  .SUFFIXES :
! .SUFFIXES : .mli .ml .cmi .cmo
  
  .mli.cmi:
  	$(LABLCOMP) $(COMPFLAGS) $<
  
  .ml.cmo:
  	$(LABLCOMP) $(COMPFLAGS) $<
  
  
  depend: 
--- 38,60 ----
  
  balloontest.cmo : balloon.cmo libjpf.cma
  
+ balloontestx: balloontest.cmx 
+ 	$(LABLOPTC) -o balloontestx -I ../support -I ../lib \
+ 	        -custom tk41.cmxa libjpf.cmxa balloontest.cmx $(TKLINKOPT)
+ 
+ balloontest.cmx : balloon.cmx libjpf.cmxa
+ 
  .SUFFIXES :
! .SUFFIXES : .mli .ml .cmi .cmo .cmx
  
  .mli.cmi:
  	$(LABLCOMP) $(COMPFLAGS) $<
  
  .ml.cmo:
  	$(LABLCOMP) $(COMPFLAGS) $<
+ 
+ .ml.cmx:
+ 	$(LABLOPTCOMP) $(COMPFLAGS) $<
  
  
  depend: 
diff -r -c olabl-1.04/labltk41/labltklink ocaml-1.04/labltk41/labltklink
*** olabl-1.04/labltk41/labltklink	Fri Jun 13 10:05:03 1997
--- ocaml-1.04/labltk41/labltklink	Thu Mar 20 12:04:55 1997
***************
*** 0 ****
--- 1,8 ----
+ #!/bin/sh
+ 
+ # links with the tcl, tk and X11 libraries
+ 
+ exec olablc -custom -I /opt/ocaml-1.04/lib/olabl/labltk41 tk41.cma $* \
+     -ccopt -L/opt/ocaml-1.04/lib/olabl/labltk41 -cclib -llabltk41 \
+     -ccopt "-L/opt/ocaml-1.04/lib" -cclib "-ltk4.2 -ltcl7.6 -lsocket -lnsl -ldl -lm" \
+     -ccopt " -L/global/X11R5sol2.3/lib -R /global/X11R5sol2.3/lib" -cclib " -lX11  -lnsl -lsocket"
diff -r -c olabl-1.04/labltk41/lib/Makefile ocaml-1.04/labltk41/lib/Makefile
*** olabl-1.04/labltk41/lib/Makefile	Fri Feb 14 19:04:21 1997
--- ocaml-1.04/labltk41/lib/Makefile	Fri Mar 21 18:14:53 1997
***************
*** 12,24 ****
--- 12,38 ----
          ../support/textvariable.cmo ../support/timer.cmo \
          ../support/fileevent.cmo
  
+ SUPPORTX=../support/hashtblc.cmx \
+         ../support/support.cmx ../support/widget.cmx ../support/protocol.cmx \
+         ../support/textvariable.cmx ../support/timer.cmx \
+         ../support/fileevent.cmx
+ 
  all : tk41.cma labltktop
  
+ opt : tk41.cmxa
+ 
  include ./modules
  
+ include ./modulesx
+ 
  tk41.cma : $(SUPPORT) $(WIDGETOBJS) tk.cmo 
  	$(LABLLIBR) -o tk41.cma $(SUPPORT) tk.cmo $(WIDGETOBJS)
  
+ widx: $(WIDGETOBJSX)
+ 
+ tk41.cmxa : $(SUPPORTX) $(WIDGETOBJSX) tk.cmx 
+ 	$(LABLOPTLIBR) -o tk41.cmxa $(SUPPORTX) tk.cmx $(WIDGETOBJSX)
+ 
  ## Until olabltktop is fixed (next release), we in-line it
  ## (otherwise our trick with -ccopt is broken)
  
***************
*** 38,50 ****
  	chmod 755 $(INSTALLBINDIR)/labltktop
  
  
  .SUFFIXES :
! .SUFFIXES : .mli .ml .cmi .cmo .mlp
  
  .mli.cmi:
  	$(LABLCOMP) $(COMPFLAGS) $<
  
  .ml.cmo:
  	$(LABLCOMP) $(COMPFLAGS) $<
  
  include .depend
--- 52,75 ----
  	chmod 755 $(INSTALLBINDIR)/labltktop
  
  
+ installopt: tk41.cmxa
+ 	cp *.cmi tk41.cmxa tk41.a $(INSTALLDIR)
+ 	cp labltkld $(INSTALLBINDIR)
+ 	chmod 755 $(INSTALLBINDIR)/labltkld
+ 	cd $(LIBDIR); ln -s tk41.a liboltk.a; ln -s tk41.a libtk41.a
+ #	chmod 644 $(INSTALLDIR)/*.cmi
+ 	chmod 644 $(INSTALLDIR)/tk41.cmxa tk41.a
+ 
  .SUFFIXES :
! .SUFFIXES : .mli .ml .cmi .cmo .cmx .mlp
  
  .mli.cmi:
  	$(LABLCOMP) $(COMPFLAGS) $<
  
  .ml.cmo:
  	$(LABLCOMP) $(COMPFLAGS) $<
+ 
+ .ml.cmx:
+ 	$(LABLOPTCOMP) $(COMPFLAGS) $<
  
  include .depend


==============================================================================
labltk4-1.02-opt.patch
==============================================================================
diff -c -N -r labltk4/Makefile labltk4-opt/Makefile
*** labltk4/Makefile	Thu May 23 10:42:45 1996
--- labltk4-opt/Makefile	Tue Oct 15 09:53:22 1996
***************
*** 6,11 ****
--- 6,16 ----
  	cd lib; $(MAKE)
  	cd jpf; $(MAKE)
  
+ opt:
+ #	cd libsupport; $(MAKE) opt
+ 	cd lib; $(MAKE) opt
+ 	cd jpf; $(MAKE) opt
+ 
  EXDIRS= example lablbrowser 
  
  browser:
***************
*** 28,35 ****
--- 33,46 ----
  	cd libsupport; $(MAKE) install
  # We don't want to install tkcompiler.
  #	cd compiler; $(MAKE) install
+ 	cd jpf; $(MAKE) install
  	cd lablbrowser; $(MAKE) install
  
+ installopt: 
+ 	cd lib; $(MAKE) installopt
+ 	cd jpf; $(MAKE) installopt
+ #	cd lablbrowser; $(MAKE) installopt
+ 
  SUBDIRS=compiler libsupport lib jpf $(EXDIRS)
  
  clean : 
diff -c -N -r labltk4/Makefile.config labltk4-opt/Makefile.config
*** labltk4/Makefile.config	Tue Oct  1 07:29:53 1996
--- labltk4-opt/Makefile.config	Tue Oct 15 09:55:06 1996
***************
*** 1,15 ****
  # This is from your Objective Label installation
  
  # Where you installed O'Labl
! LIBDIR=/usr/local/lib/olabl
  
  # Where you want to install labltklink, labltktop and browser
! BINDIR=/usr/local/bin/lang
  
  #Where is your compiled distribution
  #This is for lablbrowser: add ../ if relative to this directory
  OLABLDIR=../..
  
  ### Which C compiler to use for the native-code compiler.
  ### cc is better than gcc on the Mips and Alpha.
  #NATIVECC=cc
--- 1,19 ----
  # This is from your Objective Label installation
  
+ prefix=/opt/hops
  # Where you installed O'Labl
! LIBDIR=$(prefix)/lib/olabl
  
  # Where you want to install labltklink, labltktop and browser
! BINDIR=$(prefix)/bin
  
  #Where is your compiled distribution
  #This is for lablbrowser: add ../ if relative to this directory
  OLABLDIR=../..
  
+ CAMLOPT=olablopt
+ CAMLCOPT=olablopt -c
+ 
  ### Which C compiler to use for the native-code compiler.
  ### cc is better than gcc on the Mips and Alpha.
  #NATIVECC=cc
***************
*** 17,40 ****
  
  ### How to invoke ranlib
  # BSD-style:
! RANLIB=ranlib
  # System V-style:
  #RANLIB=ar -rs
  # If ranlib is not needed at all:
! #RANLIB=true
  
  ### X Windows, Tcl, Tk
! X11_INCLUDES=/usr/X11R6/include
! X11_LIB=/usr/X11R6/lib
! TCLINCLDIR=/usr/local/lib/tcl7.5/include
! TKINCLDIR=/usr/local/lib/tk4.1/include
! TCLLIBDIR=/usr/local/lib/tcl7.5/lib
! TKLIBDIR=/usr/local/lib/tk4.1/lib
! TKLIBS=-cclib -ltk -cclib -ltcl -cclib -lX11
  
  ### Which version of Tcl/Tk you are using
! #TKVER = -DTK40		# for Tcl7.4/Tk4.0
! TKVER = -DTK41		# for Tcl7.5/Tk4.1
  
  # Add this definition if needed
  #STATIC=-ccopt -static
--- 21,44 ----
  
  ### How to invoke ranlib
  # BSD-style:
! #RANLIB=ranlib
  # System V-style:
  #RANLIB=ar -rs
  # If ranlib is not needed at all:
! RANLIB=true
  
  ### X Windows, Tcl, Tk
! X11_INCLUDES=/usr/openwin/include
! X11_LIB=/usr/openwin/lib
! TCLINCLDIR=/opt/hops/include
! TKINCLDIR=/opt/hops/include
! TCLLIBDIR=/opt/hops/lib
! TKLIBDIR=/opt/hops/lib
! TKLIBS=-cclib -ltk4.0 -cclib -ltcl7.4 -cclib -lX11
  
  ### Which version of Tcl/Tk you are using
! TKVER = -DTK40		# for Tcl7.4/Tk4.0
! #TKVER = -DTK41		# for Tcl7.5/Tk4.1
  
  # Add this definition if needed
  #STATIC=-ccopt -static
diff -c -N -r labltk4/jpf/Makefile labltk4-opt/jpf/Makefile
*** labltk4/jpf/Makefile	Thu May 23 10:42:39 1996
--- labltk4-opt/jpf/Makefile	Tue Oct 15 09:54:08 1996
***************
*** 1,5 ****
! CAMLC=olablc
! CAMLCOMP=$(CAMLC) -c
  
  CAMLDEP=ocamldep
  
--- 1,4 ----
! include ../Makefile.config
  
  CAMLDEP=ocamldep
  
***************
*** 7,22 ****
  
  OBJS= fileselect.cmo
  
  all: libjpf.cma
  
  libjpf.cma: $(OBJS)
  	olablc -a -o libjpf.cma $(OBJS)
  
  clean:
  	rm -f *.cm* *~
  
  .SUFFIXES :
! .SUFFIXES : .mli .ml .cmi .cmo
  
  .mli.cmi:
  	$(CAMLCOMP) $(COMPFLAGS) $<
--- 6,34 ----
  
  OBJS= fileselect.cmo
  
+ OBJSX= fileselect.cmx
+ 
  all: libjpf.cma
  
+ opt: libjpf.cmxa
+ 
+ install: libjpf.cma
+ 	cp *.cmi libjpf.cma $(LIBDIR)
+ 
+ installopt: libjpf.cmxa
+ 	cp *.cmi libjpf.a libjpf.cmxa $(LIBDIR)
+ 
  libjpf.cma: $(OBJS)
  	olablc -a -o libjpf.cma $(OBJS)
  
+ libjpf.cmxa: $(OBJSX)
+ 	$(CAMLOPT) -a -o libjpf.cmxa $(OBJSX)
+ 
  clean:
  	rm -f *.cm* *~
  
  .SUFFIXES :
! .SUFFIXES : .mli .ml .cmi .cmx .cmo
  
  .mli.cmi:
  	$(CAMLCOMP) $(COMPFLAGS) $<
***************
*** 24,29 ****
--- 36,44 ----
  .ml.cmo:
  	$(CAMLCOMP) $(COMPFLAGS) $<
  
+ .ml.cmx:
+ 	$(CAMLCOPT) $(COMPFLAGS) $<
+ 
  
  depend: 
  	mv Makefile Makefile.bak
diff -c -N -r labltk4/lablbrowser/Makefile labltk4-opt/lablbrowser/Makefile
*** labltk4/lablbrowser/Makefile	Sun Sep 29 17:03:14 1996
--- labltk4-opt/lablbrowser/Makefile	Wed Oct  9 12:59:02 1996
***************
*** 10,19 ****
--- 10,27 ----
  	fileselect.cmo	searchid.cmo	searchpos.cmo	viewer.cmo  \
  	typecheck.cmo	editor.cmo	main.cmo
  
+ OBJX =	list2.cmx	useunix.cmx	setpath.cmx	lexical.cmx \
+ 	fileselect.cmx	searchid.cmx	searchpos.cmx	viewer.cmx  \
+ 	typecheck.cmx	editor.cmx	main.cmx
+ 
  JG =	jg_tk.cmo	jg_config.cmo	jg_bind.cmo	jg_box.cmo \
  	jg_button.cmo	jg_text.cmo	jg_toplevel.cmo	jg_message.cmo \
  	jg_menu.cmo	jg_entry.cmo
  
+ JGX =	jg_tk.cmx	jg_config.cmx	jg_bind.cmx	jg_box.cmx \
+ 	jg_button.cmx	jg_text.cmx	jg_toplevel.cmx	jg_message.cmx \
+ 	jg_menu.cmx	jg_entry.cmx
+ 
  # Default rules
  
  .SUFFIXES: .ml .mli .cmo .cmi .cmx
***************
*** 21,26 ****
--- 29,37 ----
  .ml.cmo:
  	$(COMPILER) $(INCLUDES) $<
  
+ .ml.cmx:
+ 	$(CAMLCOPT) $(INCLUDES) $<
+ 
  .mli.cmi:
  	$(COMPILER) $(INCLUDES) $<
  
***************
*** 31,42 ****
--- 42,66 ----
  		unix.cma str.cma tklib.cma jglib.cma $(OBJ) \
  		-cclib -lstr -cclib -lunix $(CAMLTKLIB)
  
+ lablbrowse: jglib.cmxa $(OBJX)
+ 	labltkld -o lablbrowse \
+ #toplevellib.cmxa \
+ 		str.cmxa tklib.cmxa jglib.cmxa $(OBJX) \
+ 		-cclib -lstr
+ #-cclib -ltoplevel
+ 
  jglib.cma: $(JG)
  	$(COMPILER) -a -o jglib.cma $(JG) 
  
+ jglib.cmxa: $(JGX)
+ 	$(CAMLOPT) -a -o jglib.cmxa $(JGX) 
+ 
  install:
  	if test -f lablbrowser; then : ; cp lablbrowser $(BINDIR); fi
  
+ installopt:
+ 	if test -f lablbrowse; then : ; cp lablbrowse $(BINDIR); fi
+ 
  clean:
  	rm -f *.cm? lablbrowser *~ *.orig
  
diff -c -N -r labltk4/lib/Makefile labltk4-opt/lib/Makefile
*** labltk4/lib/Makefile	Wed Sep 25 12:48:59 1996
--- labltk4-opt/lib/Makefile	Tue Oct 15 09:52:12 1996
***************
*** 22,33 ****
--- 22,46 ----
  EXTRAS=	../libsupport/optionmenu.cmo \
  	../libsupport/dialog.cmo
  
+ SUPPORTX=../libsupport/hashtblc.cmx \
+         ../libsupport/support.cmx ../libsupport/protocol.cmx \
+         ../libsupport/textvariable.cmx
+ 
+ EXTRASX=	../libsupport/optionmenu.cmx \
+ 	../libsupport/dialog.cmx
+ 
  all : tklib.cma toplevels
  
+ opt : tklib.cmxa toplevels
+ 
  toplevels: labltktop
  
  include ./modules
  
+ WIDGETOBJSX=place.cmx wm.cmx canvas.cmx button.cmx text.cmx scrollbar.cmx entry.cmx listbox.cmx pack.cmx clipboard.cmx radiobutton.cmx tkwait.cmx grab.cmx scale.cmx checkbutton.cmx bell.cmx resource.cmx imagephoto.cmx label.cmx palette.cmx message.cmx menu.cmx focus.cmx menubutton.cmx toplevel.cmx frame.cmx imagebitmap.cmx selection.cmx winfo.cmx
+ 
+ widx: $(WIDGETOBJSX)
+ 
  tkgen.ml tkigen.ml tkfgen.ml: ../Widgets.src
  	cd ..; compiler/tkcompiler
  
***************
*** 60,65 ****
--- 73,82 ----
  	$(CAMLC) -a -o tklib.cma $(SUPPORT) tk.cmo $(WIDGETOBJS)\
  		 $(EXTRAS)
  
+ tklib.cmxa : tk.cmx  $(SUPPORTX) $(WIDGETOBJSX) $(EXTRASX)
+ 	$(CAMLOPT) -a -o tklib.cmxa $(SUPPORTX) tk.cmx $(WIDGETOBJSX)\
+ 		 $(EXTRASX)
+ 
  labltktop : $(WIDGETOBJS) $(SUPPORT)
  	$(CAMLC) -linkall toplevellib.cma -o labltktop -I $(SUPPORTDIR) \
  		$(PROFILING) -custom $(SUPPORT) tk.cmo \
***************
*** 76,83 ****
  	#chmod 644 $(LIBDIR)/tklib.cma
  	#chmod 755 $(LIBDIR)/labltktop
  
  .SUFFIXES :
! .SUFFIXES : .mli .ml .cmi .cmo .mlp
  
  .mli.cmi:
  	$(CAMLCOMP) $(COMPFLAGS) $<
--- 93,109 ----
  	#chmod 644 $(LIBDIR)/tklib.cma
  	#chmod 755 $(LIBDIR)/labltktop
  
+ installopt: tklib.cmxa
+ 	if test -d $(LIBDIR); then : ; else mkdir $(LIBDIR); fi
+ 	cp *.cmi tklib.a tklib.cmxa $(LIBDIR)
+ 	cd $(LIBDIR); ln -s tklib.a liboltk.a; ln -s tklib.a libtk.a; ln -s tklib.cmxa tk.cmxa
+ 	#cp labltktop $(BINDIR)
+ 	#chmod 644 $(LIBDIR)/*.cmi
+ 	#chmod 644 $(LIBDIR)/tklib.cma
+ 	#chmod 755 $(LIBDIR)/labltktop
+ 
  .SUFFIXES :
! .SUFFIXES : .mli .ml .cmi .cmo .cmx .mlp
  
  .mli.cmi:
  	$(CAMLCOMP) $(COMPFLAGS) $<
***************
*** 85,90 ****
--- 111,119 ----
  .ml.cmo:
  	$(CAMLCOMP) $(COMPFLAGS) $<
  
+ .ml.cmx:
+ 	$(CAMLCOPT) $(COMPFLAGS) $<
+ 
  depend: tk.ml
  	$(CAMLDEP) *.mli *.ml > .depend
  
diff -c -N -r labltk4/lib/labltkld labltk4-opt/lib/labltkld
*** labltk4/lib/labltkld
--- labltk4-opt/lib/labltkld	Tue Oct 15 09:55:22 1996
***************
*** 0 ****
--- 1,7 ----
+ #!/bin/sh
+ 
+ # links native code with the tcl, tk and X11 libraries
+ # and also with the unix, str and fileselect libraries
+ 
+ exec olablopt str.cmxa unix.cmxa tklib.cmxa libjpf.cmxa $* -ccopt -L/opt/hops/lib -ccopt -L/usr/openwin/lib -cclib -lstr -cclib -lunix -cclib -llabltk4 -cclib -loltk -cclib -ljpf -cclib -ltk4.0 -cclib -ltcl7.4 -cclib -lX11
+