The ocamldsort command scans a set of Objective Caml source files
(.ml and .mli files) and sort them according to their dependencies
in order to link their corresponding .cmo files.

ocamldsort was though to be used in makefiles. Here is a typical
Makefile:

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

a.out: $(CMO_FILES)
	$(OCAMLC) -o $@ $^

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

.SUFFIXES: .mli .ml .cmi .cmo

%.cmi:%.mli
	$(OCAMLC) $(OCAMLPP) $(COMPFLAGS) -c $<

%.cmo:%.ml
	$(OCAMLC) $(OCAMLPP) $(COMPFLAGS) -c $<
		
depend:
	$(OCAMLDEP) $(PPFLAGS) *.ml *.mli > .depend
	< .depend $(OCAMLDSORT) *.ml *.mli > .depsort