Author: Ralf Treinen <treinen@debian.org>
Description: make Makefile selfcontaining so that it can be used to compile
  demos outside of the ocaml-gnuiplot source tree.

Index: ocaml-gnuplot/demos/Makefile
===================================================================
--- ocaml-gnuplot.orig/demos/Makefile	2012-02-06 19:33:45.000000000 +0100
+++ ocaml-gnuplot/demos/Makefile	2012-02-06 19:46:31.000000000 +0100
@@ -2,19 +2,23 @@
 # ocaml-gnuplot/demos
 # Copyright (C) Christophe TROESTLER
 
-include ../Makefile.conf
 
-OCAMLFLAGS 	= -I ../
-OCAMLOPTFLAGS	= -I ../
-WEBDIR		= ../../webpublishing
-WEBDIRDOC	= $(WEBDIR)/Gnuplot
+# OCAMLC, OCAMLOPT, OCAMLDEP, OCAMLDOC
+# The location of the OCaml compiler and tools. The defaults should be OK.
+#
+OCAMLC	 = ocamlc
+OCAMLOPT = ocamlopt
+OCAMLDEP = ocamldep
+OCAMLDOC = ocamldoc
+OCAMLFIND = ocamlfind
+
+OCAMLFLAGS 	= -I +gnuplot
+OCAMLOPTFLAGS	= -I +gnuplot
 
 DEMOS_LIBS 	= parse_args.ml
 DEMOS 		= $(wildcard ex*.ml)
 
-PKGS 	= $(shell grep "requires" ../META.in | \
-		sed -e "s/.*\"\([^\"]*\)\".*/\1/")
-PKGS 	+= gnuplot
+PKGS 	 = unix bigarray gnuplot
 PKGS_CMA = $(addsuffix .cma, $(PKGS))
 
 .PHONY: demos byte opt
@@ -23,15 +27,15 @@
 byte: $(DEMOS:.ml=.exe)
 opt: $(DEMOS:.ml=.com)
 
-ex%.exe: ex%.ml ../gnuplot.cma $(DEMOS_LIBS:.ml=.cmo)
+ex%.exe: ex%.ml $(DEMOS_LIBS:.ml=.cmo)
 	$(OCAMLC) -o $@ $(OCAMLFLAGS) $(PKGS_CMA) $(DEMOS_LIBS:.ml=.cmo) $<
-ex%.com: ex%.ml ../gnuplot.cmxa $(DEMOS_LIBS:.ml=.cmx)
+ex%.com: ex%.ml $(DEMOS_LIBS:.ml=.cmx)
 	$(OCAMLOPT) -o $@ $(OCAMLOPTFLAGS) $(PKGS_CMA:.cma=.cmxa) \
 	  $(DEMOS_LIBS:.ml=.cmx) $<
 
-parse_args.cmi: parse_args.mli ../gnuplot.cmi
-parse_args.cmo: parse_args.ml parse_args.cmi ../gnuplot.cma
-parse_args.cmx: parse_args.ml parse_args.cmi ../gnuplot.cmxa
+parse_args.cmi: parse_args.mli
+parse_args.cmo: parse_args.ml parse_args.cmi
+parse_args.cmx: parse_args.ml parse_args.cmi
 
 # Caml general dependencies
 .SUFFIXES: .ml .mli .cmo .cmi .cmx
