Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] ocamldsort 0.1 release
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dimitri Ara <dimitri@n...>
Subject: [Caml-list] ocamldsort 0.1 release
        Hi,

ocamldsort (dsort stands for dependency sorting) is a tiny command line 
tool to sort .ml files according to their dependencies in order
to link the corresponding .cmo files.

ocamldsort was thought to be used in makefiles. Here is a typical makefile:

OCAMLC=ocamlc
OCAMLDEP=ocamldep
OCAMLDSORT=ocamldsort
PPFLAGS=-pp camlp4o
SORTED_ML_FILES=$(shell cat .depsort >/dev/null || echo ERROR)
CMO_FILES=$(SORTED_ML_FILES:.ml=.cmo)

a.out: $(CMO_FILES)
	$(OCAMLC) ...	

ERROR:
	@echo Did you run \`make depend\'?
	@false

depend:
	$(OCAMLDEP) $(PPFLAGS) *.ml *.mli > .depend
	< .depend $(OCAMLDSORT) *.ml *.mli > .depsort

In fact, ocamldep doesn't need any .depend. It can be used this way:

$ ocamldsort -pp camlp4o *.ml *.mli > .depsort

Beware: if your program relies on linking order because of side effects,
ocamldsort can't help you.

You can download it at http://dimitri.mutu.net/ocaml.html

-- 
Dimitri Ara
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners