Source

ocaml-lib / camljava / lib / Makefile

include ../Makefile.config

OCAMLC=ocamlc -g
OCAMLOPT=ocamlopt
OCAMLDEP=ocamldep
OCAMLLIB=`ocamlc -where`
CAMLJAVALIB=$(OCAMLLIB)/camljava

all: jni.cma jni.cmxa javaclasses camljava.jar
byte: jni.cma javaclasses camljava.jar

install:
	mkdir -p $(CAMLJAVALIB)
	cp jni.cma jni.cmi $(wildcard jni.cmxa jni.a) libcamljni.a jni.mli $(CAMLJAVALIB)
	jar cf $(CAMLJAVALIB)/camljava.jar fr/inria/caml/camljava/*.class

camljava.jar:
	jar cf camljava.jar fr/inria/caml/camljava/*.class

jni.cma: jni.cmo libcamljni.a
	$(OCAMLC) -linkall -a -o jni.cma -custom jni.cmo \
            -ccopt "$(JNILIBOPTS)" -cclib -lcamljni -cclib "$(JNILIBS)"

jni.cmxa: jni.cmx libcamljni.a
	$(OCAMLOPT) -linkall -a -o jni.cmxa jni.cmx \
            -ccopt "$(JNILIBOPTS)" -cclib -lcamljni -cclib "$(JNILIBS)"

libcamljni.a: jnistubs.o
	rm -f libcamljni.a
	ar rcs libcamljni.a jnistubs.o

clean::
	rm -f libcamljni.a

javaclasses:
	$(JAVAC) fr/inria/caml/camljava/*.java

clean::
	rm -f fr/inria/caml/camljava/*.class

clean::
	rm -f *.cm? *.[oa] *.cmxa

.SUFFIXES: .ml .mli .cmo .cmi .cmx

.c.o:
	$(CC) -c $(CFLAGS) $(JNIINCLUDES) -I$(OCAMLLIB) $*.c

.ml.cmo:
	$(OCAMLC) -c $*.ml

.ml.cmx:
	$(OCAMLOPT) -c $*.ml

.mli.cmi:
	$(OCAMLC) -c $*.mli

depend: beforedepend
	$(OCAMLDEP) *.mli *.ml > .depend

include .depend