WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-devel] [PATCH 3 of 7] ocaml: install built modules

To: xen-devel@xxxxxxxxxxxxxxxxxxx, xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 3 of 7] ocaml: install built modules
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Thu, 18 Nov 2010 10:50:35 +0000
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Thu, 18 Nov 2010 03:20:00 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1290077432@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1290077432@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.5.2
# HG changeset patch
# User root@xxxxxxxxxxxxxxxxxxxxx
# Date 1290077186 18000
# Node ID 11cc3e6d573937508df213c0127c1dbbbd61af30
# Parent  3de336d9c113359203885ca6cf6360e5250dfe82
ocaml: install built modules

Previously the install target was having no effect because it ended up
calling the default target in the subdir Makefile instead of the
install target.

Resolve this by tying the tools/ocaml Makefiles into the generic
handling done by tools/Rules.mk.

Other changes arising in one way or another from this:
- Add libs/xl/META.in
- Update .hgignore for META files
- Create leading directories
- Remove existing module before installation in install targer
  (worksaround what appears to be a quirk of "ocamlfind install")
- Use the globally defined $(DESTDIR)
- Move "ocamlfind printfconf destdir" to a common variable,
  repurposing exising unused OCAMLDESTDIR, incorporating $(DESTDIR) at
  the same time.
- Drop a few unused variable definitions (mainly to avoid deciding if
  $(DESTDIR) made sense for them or not.
- Pass -destdir to ocamlfind in uninstall target for symmetry with
  install target.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 3de336d9c113 -r 11cc3e6d5739 .hgignore
--- a/.hgignore Thu Nov 18 05:46:26 2010 -0500
+++ b/.hgignore Thu Nov 18 05:46:26 2010 -0500
@@ -292,6 +292,7 @@
 ^tools/ioemu-dir$
 ^tools/ocaml/.*/.*\.annot$
 ^tools/ocaml/.*/.*\.cmx?a$
+^tools/ocaml/.*/META$
 ^tools/ocaml/.*/\.ocamldep\.make$
 ^tools/ocaml/xenstored/oxenstored$
 ^xen/\.banner.*$
diff -r 3de336d9c113 -r 11cc3e6d5739 tools/ocaml/Makefile
--- a/tools/ocaml/Makefile      Thu Nov 18 05:46:26 2010 -0500
+++ b/tools/ocaml/Makefile      Thu Nov 18 05:46:26 2010 -0500
@@ -1,43 +1,19 @@
 XEN_ROOT = ../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-SUBDIRS_LIBS = \
-       libs/uuid libs/mmap \
-       libs/log libs/xc libs/eventchn \
-       libs/xb libs/xs libs/xl
-
 SUBDIRS_PROGRAMS = xenstored
 
-SUBDIRS = $(SUBDIRS_LIBS) $(SUBDIRS_PROGRAMS)
+SUBDIRS = libs $(SUBDIRS_PROGRAMS)
 
 .NOTPARALLEL:
 # targets here must be run in order, otherwise we can try
 # to build programs before the libraries are done
 
 .PHONY: all
-all: build
+all: subdirs-all
 
-.PHONY: build
-build: SUBDIRS
-
-.PHONY: SUBDIRS SUBDIRS_PROGRAMS SUBDIRS_LIBS
-SUBDIRS SUBDIRS_PROGRAMS SUBDIRS_LIBS:
-       @set -e; for d in $($@); do                     \
-               echo " === building $$d";               \
-               $(MAKE) --no-print-directory -C $$d;    \
-       done
-
-.PHONY: install install-libs install-program
-install: install-libs install-program
-
-install-program: SUBDIRS_PROGRAMS
-       $(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
-       $(INSTALL_PROG) xenstored/oxenstored $(DESTDIR)$(SBINDIR)
-
-install-libs: SUBDIRS_LIBS
+.PHONY: install
+install: subdirs-install
 
 .PHONY: clean
-clean:
-       @for dir in $(SUBDIRS); do \
-               $(MAKE) --no-print-directory -C $$dir clean; \
-       done
+clean: subdirs-clean
diff -r 3de336d9c113 -r 11cc3e6d5739 tools/ocaml/common.make
--- a/tools/ocaml/common.make   Thu Nov 18 05:46:26 2010 -0500
+++ b/tools/ocaml/common.make   Thu Nov 18 05:46:26 2010 -0500
@@ -17,13 +17,8 @@ OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h
 OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) 
-cc $(CC) -w F -warn-error F
 OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 
-#LDFLAGS = -cclib -L./
-
-DESTDIR ?= /
 VERSION := 4.1
 
-OCAMLABI = $(shell $(OCAMLC) -version)
-OCAMLLIBDIR = $(shell $(OCAMLC) -where)
-OCAMLDESTDIR ?= $(OCAMLLIBDIR)
+OCAMLDESTDIR ?= $(DESTDIR)$(shell ocamlfind printconf destdir)
 
 o= >$@.new && mv -f $@.new $@
diff -r 3de336d9c113 -r 11cc3e6d5739 tools/ocaml/libs/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/Makefile Thu Nov 18 05:46:26 2010 -0500
@@ -0,0 +1,16 @@
+XEN_ROOT = ../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+SUBDIRS= \
+       uuid mmap \
+       log xc eventchn \
+       xb xs xl
+
+.PHONY: all
+all: subdirs-all
+
+.PHONY: install
+install: subdirs-install
+
+.PHONY: clean
+clean: subdirs-clean
diff -r 3de336d9c113 -r 11cc3e6d5739 tools/ocaml/libs/eventchn/Makefile
--- a/tools/ocaml/libs/eventchn/Makefile        Thu Nov 18 05:46:26 2010 -0500
+++ b/tools/ocaml/libs/eventchn/Makefile        Thu Nov 18 05:46:26 2010 -0500
@@ -19,11 +19,13 @@ OCAML_LIBRARY = eventchn
 
 .PHONY: install
 install: $(LIBS) META
-       ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf 
destdir) -ldconf ignore eventchn META $(INTF) $(LIBS) *.a *.so *.cmx
+       mkdir -p $(OCAMLDESTDIR)
+       ocamlfind remove -destdir $(OCAMLDESTDIR) eventchn
+       ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore eventchn META 
$(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-       ocamlfind remove eventchn
+       ocamlfind remove -destdir $(OCAMLDESTDIR) eventchn
 
 include $(TOPLEVEL)/Makefile.rules
 
diff -r 3de336d9c113 -r 11cc3e6d5739 tools/ocaml/libs/log/Makefile
--- a/tools/ocaml/libs/log/Makefile     Thu Nov 18 05:46:26 2010 -0500
+++ b/tools/ocaml/libs/log/Makefile     Thu Nov 18 05:46:26 2010 -0500
@@ -32,11 +32,13 @@ syslog.mli : syslog.ml
 
 .PHONY: install
 install: $(LIBS) META
-       ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf 
destdir) -ldconf ignore log META $(INTF) $(LIBS) *.a *.so *.cmx
+       mkdir -p $(OCAMLDESTDIR)
+       ocamlfind remove -destdir $(OCAMLDESTDIR) log
+       ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore log META 
$(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-       ocamlfind remove log
+       ocamlfind remove -destdir $(OCAMLDESTDIR) log
 
 include $(TOPLEVEL)/Makefile.rules
 
diff -r 3de336d9c113 -r 11cc3e6d5739 tools/ocaml/libs/mmap/Makefile
--- a/tools/ocaml/libs/mmap/Makefile    Thu Nov 18 05:46:26 2010 -0500
+++ b/tools/ocaml/libs/mmap/Makefile    Thu Nov 18 05:46:26 2010 -0500
@@ -18,11 +18,13 @@ OCAML_LIBRARY = mmap
 
 .PHONY: install
 install: $(LIBS) META
-       ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf 
destdir) -ldconf ignore mmap META $(INTF) $(LIBS) *.a *.so *.cmx
+       mkdir -p $(OCAMLDESTDIR)
+       ocamlfind remove -destdir $(OCAMLDESTDIR) mmap
+       ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore mmap META 
$(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-       ocamlfind remove mmap
+       ocamlfind remove -destdir $(OCAMLDESTDIR) mmap
 
 include $(TOPLEVEL)/Makefile.rules
 
diff -r 3de336d9c113 -r 11cc3e6d5739 tools/ocaml/libs/uuid/Makefile
--- a/tools/ocaml/libs/uuid/Makefile    Thu Nov 18 05:46:26 2010 -0500
+++ b/tools/ocaml/libs/uuid/Makefile    Thu Nov 18 05:46:26 2010 -0500
@@ -17,11 +17,13 @@ OCAML_NOC_LIBRARY = uuid
 
 .PHONY: install
 install: $(LIBS) META
-       ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf 
destdir) -ldconf ignore uuid META $(INTF) $(LIBS) *.a *.cmx
+       mkdir -p $(OCAMLDESTDIR)
+       ocamlfind remove -destdir $(OCAMLDESTDIR) uuid
+       ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore uuid META 
$(INTF) $(LIBS) *.a *.cmx
 
 .PHONY: uninstall
 uninstall:
-       ocamlfind remove uuid
+       ocamlfind remove -destdir $(OCAMLDESTDIR) uuid
 
 include $(TOPLEVEL)/Makefile.rules
 
diff -r 3de336d9c113 -r 11cc3e6d5739 tools/ocaml/libs/xb/Makefile
--- a/tools/ocaml/libs/xb/Makefile      Thu Nov 18 05:46:26 2010 -0500
+++ b/tools/ocaml/libs/xb/Makefile      Thu Nov 18 05:46:26 2010 -0500
@@ -33,10 +33,12 @@ OCAML_LIBRARY = xb
 
 .PHONY: install
 install: $(LIBS) META
-       ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf 
destdir) -ldconf ignore xb META $(INTF) $(LIBS) *.a *.so *.cmx
+       mkdir -p $(OCAMLDESTDIR)
+       ocamlfind remove -destdir $(OCAMLDESTDIR) xb
+       ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xb META 
$(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-       ocamlfind remove xb
+       ocamlfind remove -destdir $(OCAMLDESTDIR) xb
 
 include $(TOPLEVEL)/Makefile.rules
diff -r 3de336d9c113 -r 11cc3e6d5739 tools/ocaml/libs/xc/Makefile
--- a/tools/ocaml/libs/xc/Makefile      Thu Nov 18 05:46:26 2010 -0500
+++ b/tools/ocaml/libs/xc/Makefile      Thu Nov 18 05:46:26 2010 -0500
@@ -20,10 +20,12 @@ libs: $(LIBS)
 
 .PHONY: install
 install: $(LIBS) META
-       ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf 
destdir) -ldconf ignore xc META $(INTF) $(LIBS) *.a *.so *.cmx
+       mkdir -p $(OCAMLDESTDIR)
+       ocamlfind remove -destdir $(OCAMLDESTDIR) xc
+       ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xc META 
$(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-       ocamlfind remove xc
+       ocamlfind remove -destdir $(OCAMLDESTDIR) xc
 
 include $(TOPLEVEL)/Makefile.rules
diff -r 3de336d9c113 -r 11cc3e6d5739 tools/ocaml/libs/xl/META.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/xl/META.in       Thu Nov 18 05:46:26 2010 -0500
@@ -0,0 +1,4 @@
+version = "@VERSION@"
+description = "Xen Toolstack Library"
+archive(byte) = "xl.cma"
+archive(native) = "xl.cmxa"
diff -r 3de336d9c113 -r 11cc3e6d5739 tools/ocaml/libs/xl/Makefile
--- a/tools/ocaml/libs/xl/Makefile      Thu Nov 18 05:46:26 2010 -0500
+++ b/tools/ocaml/libs/xl/Makefile      Thu Nov 18 05:46:26 2010 -0500
@@ -17,10 +17,12 @@ libs: $(LIBS)
 
 .PHONY: install
 install: $(LIBS) META
-       ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf 
destdir) -ldconf ignore xl META $(INTF) $(LIBS) *.a *.so *.cmx
+       mkdir -p $(OCAMLDESTDIR)
+       ocamlfind remove -destdir $(OCAMLDESTDIR) xl
+       ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xl META 
$(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-       ocamlfind remove xl
+       ocamlfind remove -destdir $(OCAMLDESTDIR) xl
 
 include $(TOPLEVEL)/Makefile.rules
diff -r 3de336d9c113 -r 11cc3e6d5739 tools/ocaml/libs/xs/Makefile
--- a/tools/ocaml/libs/xs/Makefile      Thu Nov 18 05:46:26 2010 -0500
+++ b/tools/ocaml/libs/xs/Makefile      Thu Nov 18 05:46:26 2010 -0500
@@ -33,11 +33,13 @@ OCAML_NOC_LIBRARY = xs
 
 .PHONY: install
 install: $(LIBS) META
-       ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf 
destdir) -ldconf ignore xs META $(INTF) xs.mli xst.mli xsraw.mli $(LIBS) *.a 
*.cmx
+       mkdir -p $(OCAMLDESTDIR)
+       ocamlfind remove -destdir $(OCAMLDESTDIR) xs
+       ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xs META 
$(INTF) xs.mli xst.mli xsraw.mli $(LIBS) *.a *.cmx
 
 .PHONY: uninstall
 uninstall:
-       ocamlfind remove xs
+       ocamlfind remove -destdir $(OCAMLDESTDIR) xs
 
 include $(TOPLEVEL)/Makefile.rules
 
diff -r 3de336d9c113 -r 11cc3e6d5739 tools/ocaml/xenstored/Makefile
--- a/tools/ocaml/xenstored/Makefile    Thu Nov 18 05:46:26 2010 -0500
+++ b/tools/ocaml/xenstored/Makefile    Thu Nov 18 05:46:26 2010 -0500
@@ -52,4 +52,8 @@ all: $(INTF) $(PROGRAMS)
 
 bins: $(PROGRAMS)
 
+install: all
+       $(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
+       $(INSTALL_PROG) oxenstored $(DESTDIR)$(SBINDIR)
+
 include $(OCAML_TOPLEVEL)/Makefile.rules

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>