8 OCAMLLIB
:= $(shell echo
`ocamlc -where`)
9 FACILELIB
= $(OCAMLLIB
)/facile
12 # link to these libraries
13 LIBADD_CMX
= $(OCAMLLIB
)/facile
/facile.cmxa
#$(OCAMLLIB)/str.cmxa
14 LIBADD_CMO
= $(OCAMLLIB
)/facile
/facile.cma
#$(OCAMLLIB)/str.cma
17 SOURCES_CHEM
= chemset.ml parser.ml lexer.ml datastruct.ml chem.ml calc.ml
18 SOURCES_WRAP
= modwrap.c
21 CHEM_CMO
= $(SOURCES_CHEM
:.ml
=.cmo
)
22 CHEM_CMX
= $(SOURCES_CHEM
:.ml
=.cmx
)
23 CHEM_O
= $(SOURCES_WRAP
:.c
=.o
)
25 # default target : the object files for eqchem
28 # shows how to build a program that embeds the solver
29 # in compiled ocaml, bytecode ocaml and compiled program using compiled caml code
30 test: atestprog.opt btestprog.out testcprog
32 atestprog.opt
: $(CHEM_CMX
) main.cmx
33 $(OCAMLOPT
) -o
$@
$(LIBADD_CMX
) $(CHEM_CMX
) main.cmx
35 btestprog.out
: $(CHEM_CMO
) main.cmo
36 $(OCAMLMLI
) -o
$@
$(LIBADD_CMO
) $(CHEM_CMO
) main.cmo
38 solver.o
: $(CHEM_CMX
) $(CHEM_O
)
39 $(OCAMLOPT
) -output-obj
-o solver.o
$(LIBADD_CMX
) $(CHEM_CMX
)
40 cp
-f solver.o modwrap.o ..
/
42 testcprog
: $(CHEM_CMX
) $(CHEM_O
)
43 $(OCAMLOPT
) -output-obj
-o solver.o
$(LIBADD_CMX
) $(CHEM_CMX
) modwrap.o
44 gcc
-c
-o main.o main.c
-L
$(OCAMLLIB
)
45 gcc
-o
$@ main.o solver.o
-L
$(OCAMLLIB
) \
46 -L
$(OCAMLLIB
)/facile
-lasmrun
-lstr
-lnums
-lm
-ldl modwrap.o
49 .SUFFIXES
: .ml .mli .mly .mll .cmi .cmo .cmx .p.cmx .c
52 $(OCAMLC
) $(INCLUDES
) $(INCLUDES
) -c
$<
55 $(OCAMLMLI
) $(INCLUDES
) -c
$<
58 $(OCAMLOPT
) $(OPTOPT
) $(INCLUDES
) -c
$<
67 $(OCAMLOPT
) $(OPTOPT
) $(INCLUDES
) -c
$<
70 \rm
-f
*.cm
[iox
] *.o
*~ .depend
*testprog.
* testcprog
73 \rm
-f
*.cmxa
*.a
*.cma
78 ocamlc
-i datastruct.ml
> datastruct.mli
79 ocamlc
-I
+facile
-i chem.ml
> chem.mli
80 ocamlc
-I
+facile
-i calc.ml
> calc.mli
82 maintainer-clean
: clean
89 .depend
: parser.ml lexer.ml
90 $(OCAMLDEP
) $(INCLUDES
) *.mli
*.ml
> $@