[Pkg-ocaml-maint-commits] [SCM] ocaml-sha packaging branch, master, updated. debian/1.5-4-5-g6f7a8e9
Eric Cooper
ecc at cmu.edu
Fri Oct 9 19:30:53 UTC 2009
The following commit has been merged in the master branch:
commit 7d07d2caed3b90e103e4e28ea2f4c7256abf38e5
Author: Eric Cooper <ecc at cmu.edu>
Date: Fri Oct 9 14:58:03 2009 -0400
modify Makefile and debian/rules to handle bytecode-only architectures
add separate all-byte and install-byte targets
add targets for bytecode versions of tests
include Shacommon module in libraries
use internal $(ccopts) variable so that we still get correct settings
when CFLAGS is set by cdbs
diff --git a/Makefile b/Makefile
index 3224c59..3b0afb5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-CFLAGS = -Wall -O3 -funroll-loops -I/usr/include
+ccopts = $(CFLAGS) -Wall -O3 -funroll-loops -fPIC -DPIC
OCAMLC = ocamlc
OCAMLOPT = ocamlopt
OCAMLMKLIB = ocamlmklib
@@ -6,18 +6,20 @@ OCAMLMKLIB = ocamlmklib
OCAMLOPTFLAGS =
OCAML_TEST_INC = -I `ocamlfind query oUnit`
-OCAML_TEST_LIB = `ocamlfind query oUnit`/oUnit.cmxa
+OCAML_TEST_LIB = `ocamlfind query oUnit`/oUnit
PROGRAMS = sha1sum sha256sum sha512sum
-allshabytes = $(foreach n, 1 256 512, sha$(n).lib.o sha$(n)_stubs.o sha$(n).cmo)
-allshaopts = $(foreach n, 1 256 512, sha$(n).lib.o sha$(n)_stubs.o sha$(n).cmx)
+allshabytes = shacommon.cmo $(foreach n, 1 256 512, sha$(n).lib.o sha$(n)_stubs.o sha$(n).cmo)
+allshaopts = shacommon.cmx $(foreach n, 1 256 512, sha$(n).lib.o sha$(n)_stubs.o sha$(n).cmx)
-all: sha1.cmi sha1.cma sha1.cmxa sha256.cma sha256.cmxa sha512.cma sha512.cmxa sha.cma sha.cmxa
+all: all-byte all-opt
+all-byte: $(foreach n, 1 256 512, sha$(n).cma) sha.cma
+all-opt: $(foreach n, 1 256 512, sha$(n).cmxa) sha.cmxa
bins: $(PROGRAMS)
-sha1sum: shacommon.cmx sha1.cmxa sha256.cmxa sha512.cmxa shasum.cmx
+sha1sum: sha.cmxa shasum.cmx
$(OCAMLOPT) $(OCAMLOPTFLAGS) -o $@ -cclib -L. $+
sha256sum: sha1sum
@@ -26,43 +28,53 @@ sha256sum: sha1sum
sha512sum: sha1sum
cp $< $@
-sha.cma: shacommon.cmo $(allshabytes)
+cmi_files = $(foreach n, 1 256 512, sha$(n).cmi)
+
+sha.cma: $(cmi_files) $(allshabytes)
$(OCAMLMKLIB) -o sha $(allshabytes)
-sha.cmxa: shacommon.cmo $(allshaopts)
+sha.cmxa: $(cmi_files) $(allshaopts)
$(OCAMLMKLIB) -o sha $(allshaopts)
sha1.cma: shacommon.cmo sha1.cmi sha1.lib.o sha1_stubs.o sha1.cmo
- $(OCAMLMKLIB) -o sha1 sha1.lib.o sha1_stubs.o sha1.cmo
+ $(OCAMLMKLIB) -o sha1 shacommon.cmo sha1.lib.o sha1_stubs.o sha1.cmo
sha1.cmxa: shacommon.cmx sha1.cmi sha1.lib.o sha1_stubs.o sha1.cmx
- $(OCAMLMKLIB) -o sha1 sha1.lib.o sha1_stubs.o sha1.cmx
+ $(OCAMLMKLIB) -o sha1 shacommon.cmx sha1.lib.o sha1_stubs.o sha1.cmx
sha256.cma: shacommon.cmo sha256.cmi sha256.lib.o sha256_stubs.o sha256.cmo
- $(OCAMLMKLIB) -o sha256 sha256.lib.o sha256_stubs.o sha256.cmo
+ $(OCAMLMKLIB) -o sha256 shacommon.cmo sha256.lib.o sha256_stubs.o sha256.cmo
sha256.cmxa: shacommon.cmx sha256.cmi sha256.lib.o sha256_stubs.o sha256.cmx
- $(OCAMLMKLIB) -o sha256 sha256.lib.o sha256_stubs.o sha256.cmx
+ $(OCAMLMKLIB) -o sha256 shacommon.cmx sha256.lib.o sha256_stubs.o sha256.cmx
sha512.cma: shacommon.cmo sha512.cmi sha512.lib.o sha512_stubs.o sha512.cmo
- $(OCAMLMKLIB) -o sha512 sha512.lib.o sha512_stubs.o sha512.cmo
+ $(OCAMLMKLIB) -o sha512 shacommon.cmo sha512.lib.o sha512_stubs.o sha512.cmo
sha512.cmxa: shacommon.cmx sha512.cmi sha512.lib.o sha512_stubs.o sha512.cmx
- $(OCAMLMKLIB) -o sha512 sha512.lib.o sha512_stubs.o sha512.cmx
+ $(OCAMLMKLIB) -o sha512 shacommon.cmx sha512.lib.o sha512_stubs.o sha512.cmx
tests: sha.test
./sha.test
-sha.test: sha1.cmxa sha256.cmxa sha512.cmxa sha.test.cmx
+sha.test: sha.cmxa sha.test.cmx
%.test:
- $(OCAMLOPT) -o $@ $(OCAML_BFLAGS) unix.cmxa $(OCAML_TEST_INC) $(OCAML_TEST_LIB) $+
+ $(OCAMLOPT) -o $@ -cclib -L. $(OCAML_BFLAGS) unix.cmxa $(OCAML_TEST_INC) $(OCAML_TEST_LIB).cmxa $+
+
+bytetests: sha.bytetest
+ ./sha.bytetest
+
+sha.bytetest: sha.cma sha.test.cmo
+
+%.bytetest:
+ $(OCAMLC) -o $@ -cclib -L. $(OCAML_BFLAGS) unix.cma $(OCAML_TEST_INC) $(OCAML_TEST_LIB).cma $+
%.test.cmo: %.test.ml
- $(OCAMLC) -c -o $@ $(OCAML_BFLAGS) -custom $(OCAML_TEST_INC) $<
+ $(OCAMLC) -c -o $@ -w x $(OCAML_BFLAGS) $(OCAML_TEST_INC) $<
%.test.cmx: %.test.ml
- $(OCAMLOPT) -c -o $@ $(OCAML_BFLAGS) $(OCAML_TEST_INC) $<
+ $(OCAMLOPT) -c -o $@ -w x $(OCAML_BFLAGS) $(OCAML_TEST_INC) $<
%.cmo: %.ml
$(OCAMLC) -c -o $@ $<
@@ -74,7 +86,7 @@ sha.test: sha1.cmxa sha256.cmxa sha512.cmxa sha.test.cmx
$(OCAMLOPT) $(OCAMLOPTFLAGS) -c -o $@ $<
%.o: %.c
- $(OCAMLC) -ccopt "$(CFLAGS)" -c -o $@ $<
+ $(OCAMLC) -ccopt "$(ccopts)" -c -o $@ $<
%.lib.o: %.o
mv $< $@
@@ -85,10 +97,15 @@ doc:
ocamldoc -html -d html *.mli
clean:
- rm -f *.o *.a *.cmo *.cmi *.cma *.cmx *.cmxa sha.test $(PROGRAMS)
+ rm -f *.o *.a *.so *.cmo *.cmi *.cma *.cmx *.cmxa sha.test sha.bytetest $(PROGRAMS)
+
+interfaces = $(cmi_files) $(cmi_files:.cmi=.mli)
+
+install: all
+ ocamlfind install sha META $(interfaces) *.cma *.cmxa *.a *.so
-install: sha1.cma sha1.cmxa sha256.cma sha256.cmxa sha512.cma sha512.cmxa sha.cma sha.cmxa META
- ocamlfind install sha META *.cmx sha1.cmi sha1.cma sha1.cmxa sha256.cmi sha256.cma sha256.cmxa sha512.cmi sha512.cma sha512.cmxa sha.cma sha.cmxa *.a *.so
+install-byte: all-byte
+ ocamlfind install sha META $(interfaces) *.cma *.a *.so
uninstall:
ocamlfind remove sha
diff --git a/debian/rules b/debian/rules
index 15b6197..9003624 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,16 +5,16 @@ include /usr/share/cdbs/1/rules/ocaml.mk
include /usr/share/cdbs/1/class/makefile.mk
DESTDIR = $(CURDIR)/debian/tmp/$(OCAML_STDLIB_DIR)
-DEB_MAKE_INSTALL_TARGET = install OCAMLFIND_DESTDIR=$(DESTDIR) OCAMLFIND_LDCONF=ignore
-DEB_MAKE_BUILD_TARGET = byte-code-library
+installvars = OCAMLFIND_DESTDIR=$(DESTDIR) OCAMLFIND_LDCONF=ignore
+
ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
- DEB_MAKE_BUILD_TARGET += native-code-library
+ DEB_MAKE_BUILD_TARGET = all
+ DEB_MAKE_INSTALL_TARGET = install $(installvars)
+else
+ DEB_MAKE_BUILD_TARGET = all-byte
+ DEB_MAKE_INSTALL_TARGET = install-byte $(installvars)
endif
build/libsha-ocaml::
- cp debian/META .
mkdir -p $(DESTDIR)
-
-clean::
- rm -f META
--
ocaml-sha packaging
More information about the Pkg-ocaml-maint-commits
mailing list