1BIN_DIR = /usr/local/bin 2REQUIRES = gdome2 3PREDICATES = 4OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)" -p 5OCAMLC = ocamlfind ocamlc $(OCAMLOPTIONS) -g 6OCAMLOPT = ocamlfind ocamlopt $(OCAMLOPTIONS) 7OCAMLDEP = ocamldep 8 9LIBRARIES = $(shell ocamlfind query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(REQUIRES)) 10LIBRARIES_OPT = $(shell ocamlfind query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(REQUIRES)) 11 12all: $(TESTOBJS) test 13opt: $(TESTOBJS:.cmo=.cmx) test.opt 14 15DEPOBJS = test.ml 16 17TESTOBJS = test.cmo 18 19depend: 20 $(OCAMLDEP) $(DEPOBJS) > .depend 21 22test: $(TESTOBJS) $(LIBRARIES) 23 $(OCAMLC) -linkpkg -o test $(TESTOBJS) 24 25test.opt: $(TESTOBJS:.cmo=.cmx) $(LIBRARIES_OPT) 26 $(OCAMLOPT) -linkpkg -o test.opt $(TESTOBJS:.cmo=.cmx) 27 28.SUFFIXES: .ml .mli .cmo .cmi .cmx 29.ml.cmo: $(LIBRARIES) 30 $(OCAMLC) -c $< 31.mli.cmi: $(LIBRARIES) 32 $(OCAMLC) -c $< 33.ml.cmx: $(LIBRARIES_OPT) 34 $(OCAMLOPT) -c $< 35 36clean: 37 rm -f *.cm[iox] *.o test test.opt 38 39install: 40 cp test test.opt $(BIN_DIR) 41 42uninstall: 43 rm -f $(BIN_DIR)/test $(BIN_DIR)/test.opt 44 45.PHONY: install uninstall clean 46 47include .depend 48