INCLUDE = $(shell pg_config --includedir) LINK = -L$(shell pg_config --libdir) -lpq PG_OCAML_MAJOR_VERSION = $(shell pg_config --version | sed -e "s/^.* \([0-9]\+\).*/\1/g") PG_OCAML_MINOR_VERSION = $(shell pg_config --version | sed -e "s/^.* [^.]*\.\([0-9]\+\).*/\1/g") CFLAGS += -DPG_OCAML_MAJOR_VERSION=$(PG_OCAML_MAJOR_VERSION) CFLAGS += -DPG_OCAML_MINOR_VERSION=$(PG_OCAML_MINOR_VERSION) FILES[] = postgresql # Force to use ocamlc as driver for .c: postgresql_stubs.o: postgresql_stubs.c $(OCAMLC) -I $(INCLUDE) -ccopt "$(CFLAGS)" -c postgresql_stubs.c .SCANNER: postgresql_stubs.o: postgresql_stubs.c $(OCAMLC) -I $(INCLUDE) -c -ccopt -MM -ccopt "$(CFLAGS)" postgresql_stubs.c postgresql.cma: $(addsuffix .cmo, $(FILES)) postgresql_stubs.o ocamlmklib -o postgresql $(OCamlLinkSort $(addsuffix .cmo, $(FILES))) postgresql_stubs.o $(LINK) postgresql.cmxa postgresql.a: $(addsuffix .cmx, $(FILES)) $(addsuffix .o, $(FILES)) postgresql_stubs.o ocamlmklib -o postgresql $(OCamlLinkSort $(addsuffix .cmx, $(FILES))) postgresql_stubs.o $(LINK) .DEFAULT: postgresql.cma postgresql.cmxa clean: rm -f *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so