File ref/Makefile artifact 505704138e part of check-in c8d5f0d18b


LIB_SRCS = rasclDict.ml rasclParser.ml rasclLexer.ml rasclObject.ml rascl.ml
BYTE_OBJS = $(LIB_SRCS:.ml=.cmo)
NAT_OBJS = $(LIB_SRCS:.ml=.cmx)

.PHONY: all opt byte lib-opt lib-byte install uninstall doc clean

all : lib-byte lib-opt pa_rascl.cmo

byte : lib-byte pa_rascl.cmo

opt : lib-opt pa_rascl.cmo

lib-byte : $(BYTE_OBJS)
	ocamlc -a -o rascl.cma $(BYTE_OBJS)

lib-opt : $(NAT_OBJS)
	ocamlopt -a -o rascl.cmxa $(NAT_OBJS)


rasclDict.cmo : rasclDict.cmi rasclDict.ml
	ocamlc -c rasclDict.ml
rasclDict.cmx : rasclDict.cmi rasclDict.ml
	ocamlopt -c rasclDict.ml


rasclParser.cmo : rasclDict.cmo rasclParser.ml
	-rm rasclParser.mli
	ocamlc -c rasclDict.cmo rasclParser.ml
rasclParser.cmx : rasclDict.cmx rasclParser.ml
	-rm rasclParser.mli
	ocamlopt -c rasclDict.cmx rasclParser.ml

rasclParser.ml : rasclParser.mly
	ocamlyacc rasclParser.mly


rasclLexer.cmo : rasclDict.cmo rasclParser.cmo rasclLexer.ml
	ocamlc -c rasclParser.cmo rasclLexer.ml
rasclLexer.cmx : rasclDict.cmx rasclParser.cmx rasclLexer.ml
	ocamlopt -c rasclParser.cmx rasclLexer.ml

rasclLexer.ml : rasclLexer.mll
	ocamllex rasclLexer.mll


rasclObject.cmo : rasclDict.cmo rasclParser.cmo rasclLexer.cmo
	ocamlc -c rasclParser.cmo rasclLexer.cmo rasclObject.ml
rasclObject.cmx : rasclDict.cmx rasclParser.cmx rasclLexer.cmx
	ocamlopt -c rasclParser.cmx rasclLexer.cmx rasclObject.ml


rascl.cmo : rascl.ml rascl.cmi
rascl.cmx : rascl.ml rascl.cmi


%.cmo : %.ml
	ocamlc -c $<
%.cmx : %.ml
	ocamlopt -c $<
%.cmi : %.mli
	ocamlc -c $<


pa_rascl.cmo :
	ocamlc -c -I +camlp4 -pp 'camlp4o pa_extend.cmo q_MLast.cmo -loc loc' \
		pa_rascl.ml

install : uninstall
	files=$$( \
		for f in rascl.cma rascl.cmxa rascl.a rascl.cmi rascl.mli \
			  pa_rascl.cmo META; do \
			if [ -f "$$f" ]; then echo $$f; fi; \
		done; \
	) && \
	ocamlfind install rascl $$files

uninstall :
	ocamlfind remove rascl

doc :
	ocamldoc -html -css-style mcg.css -d doc/ocaml/api rascl.mli

clean:
	-rm -f *.cmo *.cmi *.o *.cmx rasclParser.ml rasclLexer.ml

realclean : clean
	-rm -f *.cma *.cmxa *.a