OCaml Forge

Browse | Submit A New Snippet | Create A Package

Sample OCaml Makefile

Full Script
BSD License
Other Language
A sample Makefile for OCaml, showing how to handle automatic dependencies.

Versions Of This Snippet:

Snippet ID Download Version Date Posted Author Delete
712009-03-30 23:31Matías Giovannini

Download a raw-text version of this code by clicking on "Download Version"


Latest Snippet Version: 1

PP= -pp "camlp4o.opt" OCAMLC= ocamlc.opt -w Aelz -I +lablGL OCAMLOPT= ocamlopt.opt -w Aelz -I +lablGL -inline 10 OCAMLLEX= ocamllex.opt OCAMLYACC= ocamlyacc OCAMLDEP= ocamldep OCAMLMKLIB=ocamlmklib -custom -linkall CC= gcc CINCLUDES= -I$(OCAMLLIB) I$(INCLUDE) CFLAGS= $(CINCLUDES) -O2 -Wall LIBS=str.cma lablgl.cma lablglut.cma SOURCES=\ lattice.ml lattice.mli \ delaunay.ml delaunay.mli \ geom.ml geom.mli \ vector.mli vector.ml \ pred.ml pred.mli \ polyhedron.ml polyhedron.mli \ sphere.ml sphere.mli \ chull.ml chull.mli \ model.ml model.mli \ rgb.ml rgb.mli \ glDemo.ml glDemo.mli \ glGrid.ml glMesh.ml glSphere.ml glTest.ml OBJS=lattice.cmo delaunay.cmo geom.cmo vector.cmo pred.cmo \ polyhedron.cmo sphere.cmo chull.cmo model.cmo rgb.cmo \ glDemo.cmo PROGRAMS=glgrid glgrid.opt glmesh glmesh.opt glsphere glsphere.opt gltest gltest.opt simple simple.opt all: $(PROGRAMS) simple: simple.cmo $(OCAMLC) -o $@ $(LIBS) $^ simple.opt: simple.cmx $(OCAMLOPT) -o $@ $(LIBS:.cma=.cmxa) $^ glgrid: $(OBJS) glGrid.cmo $(OCAMLC) -o $@ $(LIBS) $^ glgrid.opt: $(OBJS:.cmo=.cmx) glGrid.cmx $(OCAMLOPT) -o $@ $(LIBS:.cma=.cmxa) $^ glmesh: $(OBJS) glMesh.cmo $(OCAMLC) -o $@ $(LIBS) $^ glmesh.opt: $(OBJS:.cmo=.cmx) glMesh.cmx $(OCAMLOPT) -o $@ $(LIBS:.cma=.cmxa) $^ glsphere: $(OBJS) glSphere.cmo $(OCAMLC) -o $@ $(LIBS) $^ glsphere.opt: $(OBJS:.cmo=.cmx) glSphere.cmx $(OCAMLOPT) -o $@ $(LIBS:.cma=.cmxa) $^ gltest: $(OBJS) glTest.cmo $(OCAMLC) -o $@ $(LIBS) $^ gltest.opt: $(OBJS:.cmo=.cmx) glTest.cmx $(OCAMLOPT) -o $@ $(LIBS:.cma=.cmxa) $^ clean: rm -f *.cm[iox] *.o *.a *~ distclean: clean rm -f $(PROGRAMS) .SUFFIXES: .cmo .cmi .cmx .ml .mli .mll .mly .mly.ml: .mly.mli: $(OCAMLYACC) $< .mll.ml: $(OCAMLLEX) $< .ml.cmo: $(OCAMLC) -c $< .mli.cmi: $(OCAMLC) -c $< .ml.cmx: $(OCAMLOPT) -c $< .depend: $(OCAMLDEP) $(SOURCES) > .depend include .depend

Submit a new version

You can submit a new version of this snippet if you have modified it and you feel it is appropriate to share with others..