# ocaml-libvirt
-# Copyright (C) 2007 Red Hat Inc., Richard W.M. Jones
+# Copyright (C) 2007-2009 Red Hat Inc., Richard W.M. Jones
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
ifneq ($(OCAMLFIND),)
.depend: $(wildcard *.mli) $(wildcard *.ml)
- rm -f .depend
- $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) $(OCAMLDEPFLAGS) $^ > $@
+ rm -f $@ $@-t
+ $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) $(OCAMLDEPFLAGS) $^ | \
+ sed 's/ :/:/' | \
+ sed 's/ *$$//' | \
+ sed -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
+ sort > $@-t
+ mv $@-t $@
else
.depend: $(wildcard *.mli) $(wildcard *.ml)
- rm -f .depend
- $(OCAMLDEP) $(OCAMLCINCS) $(OCAMLDEPFLAGS) $^ > $@
+ rm -f $@ $@-t
+ $(OCAMLDEP) $(OCAMLCINCS) $(OCAMLDEPFLAGS) $^ | \
+ sed 's/ :/:/' | \
+ sed 's/ *$$//' | \
+ sed -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
+ sort > $@-t
+ mv $@-t $@
endif
ifeq ($(wildcard .depend),.depend)