[Pkg-ocaml-maint-commits] [SCM] ocamlpam packaging branch, master, updated. b01dbbf626b0f8f589827a38066c3edbeef7c323

Stephane Glondu glondu at nickel.pps.jussieu.fr
Tue Jun 10 13:54:18 UTC 2008


The following commit has been merged in the master branch:
commit 85e8865a036ec90e5c5ca928f6acf73383f48c60
Author: Stephane Glondu <steph at glondu.net>
Date:   Tue Jun 10 14:32:26 2008 +0200

    Improve the Makefile
    
     * Provide a META file
     * Add install target
     * Use ocamlmklib so that a shared lib with the bindings is generated

diff --git a/META.in b/META.in
new file mode 100644
index 0000000..d1ecc58
--- /dev/null
+++ b/META.in
@@ -0,0 +1,4 @@
+description = "OCaml bindings for the PAM library"
+version = "_VERSION_"
+archive(byte) = "pam.cma"
+archive(native) = "pam.cmxa"
diff --git a/Makefile b/Makefile
index c8ab659..84b2de4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
-AR=ar
 OCAMLC=ocamlc
 OCAMLOPT=ocamlopt
+OCAMLMKLIB=ocamlmklib
+OCAMLMKLIB_OPTS=-oc pam_stubs -lpam
 
 VERSION=1.0
 DISTNAME=ocamlpam-$(VERSION)
@@ -9,23 +10,34 @@ SOURCES=pam.mli pam.ml
 BASENAME=pam_stubs
 LIBNAME=lib$(BASENAME).a
 
-.PHONY: all dist clean
+DESTDIR=$(shell ocamlc -where)
 
-all: byte opt
+.PHONY: all dist clean install
+
+all: META byte opt
+
+META: META.in
+	sed 's/_VERSION_/$(VERSION)/' META.in > META
 
 $(LIBNAME): pam_stubs.c
 	$(OCAMLC) -c pam_stubs.c
-	$(AR) rc $(LIBNAME) pam_stubs.o
+	$(OCAMLMKLIB) $(OCAMLMKLIB_OPTS) pam_stubs.o
 
 byte: $(LIBNAME) $(SOURCES)
 	$(OCAMLC) -c pam.mli
 	$(OCAMLC) -c pam.ml
-	$(OCAMLC) -a -o pam.cma -custom pam.cmo -cclib -lpam -cclib -l$(BASENAME)
+	$(OCAMLMKLIB) $(OCAMLMKLIB_OPTS) -o pam pam.cmo
 
 opt: $(LIBNAME) $(SOURCES)
 	$(OCAMLOPT) -c pam.mli
 	$(OCAMLOPT) -c pam.ml
-	$(OCAMLOPT) -a -o pam.cmxa pam.cmx -cclib -lpam -cclib -l$(BASENAME)
+	$(OCAMLMKLIB) $(OCAMLMKLIB_OPTS) -o pam pam.cmx
+
+install:
+	install -d $(DESTDIR)/pam
+	install -m 644 -t $(DESTDIR)/pam META *.mli *.cmi *.cmx *.cma *.cmxa *.a
+	install -d $(DESTDIR)/stublibs
+	install -m 644 -t $(DESTDIR)/stublibs dll$(BASENAME).so
 
 dist: clean
 	mkdir -p $(DISTNAME)
@@ -35,4 +47,4 @@ dist: clean
 	rm -fr $(DISTNAME)
 
 clean:
-	-rm -fr *.cm* *.a *.o $(DISTNAME).tar.gz $(DISTNAME).zip $(DISTNAME)
+	-rm -fr *.cm* *.a *.o *.so *~ $(DISTNAME).tar.gz $(DISTNAME).zip $(DISTNAME) META

-- 
ocamlpam packaging



More information about the Pkg-ocaml-maint-commits mailing list