2

I would like to use functions of module List of Ocaml Batteries. I have installed Batteries, and a trivial code from Getting started works with ocamlfind ocamlc -package batteries -linkpkg euler001.ml -o euler001.

Now coming back to my project, I have a makefile as follows:

CMO=sib_lexer.cmo sib_parser.cmo sib_pp.cmo lattices.cmo abstract_interpreter.cmo main.cmo
GENERATED = sib_lexer.ml sib_parser.ml sib_parser.mli
BIN=Simpler-Basic
FLAGS= -g -annot

all: $(BIN)
    export OCAMLRUNPARAM=b
    ./$(BIN) test.sib -a zone

$(BIN):$(CMO)
    ocamlc $(FLAGS) -o $(BIN) graphics.cma $(CMO)

.SUFFIXES: .mli .ml .cmi .cmo .mll .mly

.mli.cmi:
    ocamlc $(FLAGS) -c $<

.ml.cmo:
    ocamlc $(FLAGS) -c $<

.mll.ml:
    ocamllex $<

.mly.ml:
    menhir -v $<

.mly.mli:
    ocamlyacc -v $<

clean:
    rm -f *.cm[io] *.o *~ $(BIN) $(GENERATED) sib_parser.output

.depend depend:$(GENERATED)
    rm -f .depend #3
    ocamldep *.ml *.mli > .depend #4

include .depend

I tried to replace all ocamlc $(FLAGS) with ocamlfind ocamlc -package batteries -linkpkg $(FLAGS), but it did not work...

Could anyone tell me how to modify the makefile so that it complies with batteries?

SoftTimur
  • 5,630
  • 38
  • 140
  • 292
  • 1
    What do you mean exactly by "did not work"? Did you get an error message? – Stéphane Glondu Dec 04 '11 at 16:44
  • You will not get any useful answer unless some telepaths pop up or you provide exact commands that you run and error message you get (`didn't work` is not an error message). Also minimize your problem until it disappears or can be repeated in reasonable amount of code. – ygrek Dec 05 '11 at 10:26
  • Good questions are phrased in the form "This is what I did, this is what happened, this is what I expected", with clean and complete descriptions of each. You are missing the "This is what happened" part. – Victor Nicollet Dec 06 '11 at 11:19

1 Answers1

1

Changing the compilation command is not enough. You need to add e.g. open Batteries_uni at the beginning of the files where you want to use Batteries' List.

Stéphane Glondu
  • 670
  • 3
  • 11