From: Thomas Gazagnaire Date: Wed, 11 Nov 2009 17:41:47 +0000 (+0000) Subject: [packaging] separate the normal Makefile from the one used to build the components... X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a8933ac7265ca2c81b64ba25595501ed354aa2e2;p=xcp%2Fxen-api-libs.git [packaging] separate the normal Makefile from the one used to build the components and create a bins target which build and install binaries (as closeandexec). Signed-off-by: Thomas Gazagnaire --- diff --git a/Makefile b/Makefile index 78a75a3..40bf8c4 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,4 @@ -NO_DEFAULT_BUILD := yes -ifdef B_BASE -include $(B_BASE)/common.mk -else -MY_OUTPUT_DIR ?= $(CURDIR)/output -MY_OBJ_DIR ?= $(CURDIR)/obj - -%/.dirstamp: - @mkdir -p $* - @touch $@ -endif - +.PHONY: all all: $(MAKE) -C uuid $(MAKE) -C camldm @@ -25,7 +14,8 @@ all: $(MAKE) -C close-and-exec $(MAKE) -C sexpr -allxen: +.PHONY: allxen +allxen: all $(MAKE) -C mmap $(MAKE) -C xc $(MAKE) -C xb @@ -100,49 +90,6 @@ binuninstall: $(MAKE) -C stdext binuninstall $(MAKE) -C close-and-exec binuninstall -OUTPUT_API_PKG := $(MY_OUTPUT_DIR)/api-libs.tar.gz - -$(OUTPUT_API_PKG): DESTDIR=$(MY_OBJ_DIR)/staging/ -$(OUTPUT_API_PKG): PREFIX=$(shell ocamlfind printconf path) -$(OUTPUT_API_PKG): $(MY_OBJ_DIR)/.dirstamp $(MY_OUTPUT_DIR)/.dirstamp - rm -rf $(DESTDIR) - mkdir -p $(DESTDIR)$(PREFIX) - mkdir -p $(DESTDIR)$(LIBEXEC) - $(MAKE) clean - $(MAKE) all - $(MAKE) DESTDIR=$(MY_OBJ_DIR)/staging install - $(MAKE) bins - $(MAKE) DESTDIR=$(MY_OBJ_DIR)/staging bininstall - tar -C $(DESTDIR) -zcf $@ . - -OUTPUT_XAPI_PKG := $(MY_OUTPUT_DIR)/xapi-libs.tar.gz - -$(OUTPUT_XAPI_PKG): DESTDIR=$(MY_OBJ_DIR)/staging/ -$(OUTPUT_XAPI_PKG): PREFIX=$(shell ocamlfind printconf path) -$(OUTPUT_XAPI_PKG): $(MY_OBJ_DIR)/.dirstamp $(MY_OUTPUT_DIR)/.dirstamp - rm -rf $(DESTDIR) - mkdir -p $(DESTDIR)$(PREFIX) - $(MAKE) cleanxen - $(MAKE) allxen - $(MAKE) DESTDIR=$(MY_OBJ_DIR)/staging installxen - tar -C $(DESTDIR) -zcf $@ . - -OUTPUT_SRC := $(MY_OUTPUT_DIR)/xen-api-libs-src.tar.bz2 - -$(MY_SOURCES)/MANIFEST: $(MY_SOURCES_DIRSTAMP) $(OUTPUT_SRC) - echo api lgpl-with-linking-exception file $(OUTPUT_SRC) > $@ - -$(OUTPUT_SRC): - cd $(REPO) && hg archive -t tbz2 $(HG_EXCLUDE) $@ - -.PHONY: api-libs -api-libs: $(OUTPUT_API_PKG) $(MY_SOURCES)/MANIFEST - @ : - -.PHONY: xapi-libs -xapi-libs: $(OUTPUT_XAPI_PKG) $(MY_SOURCES)/MANIFEST - @ : - .PHONY: doc doc: $(MAKE) -C uuid doc @@ -180,7 +127,6 @@ clean: make -C close-and-exec clean make -C sexpr clean make -C doc clean - rm -f $(OUTPUT_API_PKG) cleanxen: $(MAKE) -C mmap clean @@ -189,4 +135,5 @@ cleanxen: $(MAKE) -C xs clean $(MAKE) -C xsrpc clean $(MAKE) -C eventchn clean - rm -f $(OUTPUT_XAPI_PKG) + + diff --git a/camldm/Makefile b/camldm/Makefile index c83d145..ce2c79f 100644 --- a/camldm/Makefile +++ b/camldm/Makefile @@ -1,4 +1,3 @@ - CC = gcc CFLAGS = -Wall -fPIC -O2 -I/opt/xensource/lib/ocaml OCAMLC = ocamlc -g @@ -6,7 +5,6 @@ OCAMLOPT = ocamlopt LDFLAGS = -cclib -L./ -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes @@ -55,8 +53,10 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore camldm META $(INTF) $(LIBS) *.a *.so *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore camldm META $(INTF) $(LIBS) *.a *.so *.cmx .PHONY: uninstall uninstall: diff --git a/cdrom/Makefile b/cdrom/Makefile index b84afd6..23c08c4 100644 --- a/cdrom/Makefile +++ b/cdrom/Makefile @@ -5,7 +5,6 @@ OCAMLOPT = ocamlopt LDFLAGS = -cclib -L./ -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes @@ -54,8 +53,10 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore cdrom META $(INTF) $(LIBS) *.a *.so *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore cdrom META $(INTF) $(LIBS) *.a *.so *.cmx .PHONY: uninstall uninstall: diff --git a/close-and-exec/Makefile b/close-and-exec/Makefile index 447b40f..0834d71 100644 --- a/close-and-exec/Makefile +++ b/close-and-exec/Makefile @@ -7,7 +7,6 @@ OCAMLOPT = ocamlopt LDFLAGS = -cclib -L./ LIBEXEC = "/opt/xensource/libexec" -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes @@ -29,8 +28,8 @@ bins: $(PROGRAMS) libs: $(LIBS) -closeandexec: closeandexec.cmxa all - $(OCAMLOPT) $(OCAMLOPTFLAGS) closeandexec.cmxa -o $@ $< +closeandexec: closeandexec.cmxa closeandexec_main.cmx all + $(OCAMLOPT) $(OCAMLOPTFLAGS) -thread -I ../stdext -I ../uuid uuid.cmxa unix.cmxa threads.cmxa stdext.cmxa closeandexec.cmxa closeandexec_main.cmx -o $@ closeandexec.cmxa: $(foreach obj,$(OBJS),$(obj).cmx) $(OCAMLOPT) $(OCAMLOPTFLAGS) -a -o $@ $(foreach obj,$(OBJS),$(obj).cmx) @@ -54,13 +53,16 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore close-and-exec META $(INTF) $(LIBS) *.a *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore close-and-exec META $(INTF) $(LIBS) *.a *.cmx .PHONY: bininstall -bininstall: - mkdir -p $(DESDIR)$(LIBEXEC) - $(IPROG) $(PROGRAMS) $(DESDIR)$(LIBEXEC) +bininstall: path = $(DESTDIR)$(LIBEXEC) +bininstall: all + mkdir -p $(path) + $(IPROG) $(PROGRAMS) $(path) .PHONY: uninstall uninstall: @@ -73,6 +75,6 @@ binuninstall: .PHONY: doc doc: $(INTF) python ../doc/doc.py $(DOCDIR) "close-and-exec" "library" "$(OBJS)" "." "stdext" "" - + clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/eventchn/Makefile b/eventchn/Makefile index 34359e4..29d5c52 100644 --- a/eventchn/Makefile +++ b/eventchn/Makefile @@ -5,7 +5,6 @@ OCAMLOPT = ocamlopt LDFLAGS = -cclib -L./ -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes @@ -54,8 +53,10 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore eventchn META $(INTF) $(LIBS) *.a *.so *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore eventchn META $(INTF) $(LIBS) *.a *.so *.cmx .PHONY: uninstall uninstall: diff --git a/http-svr/Makefile b/http-svr/Makefile index 6867aab..ec70af0 100644 --- a/http-svr/Makefile +++ b/http-svr/Makefile @@ -5,7 +5,6 @@ OCAMLOPT = ocamlopt LDFLAGS = -cclib -L./ -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes @@ -47,8 +46,10 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore http-svr META $(INTF) $(LIBS) *.a *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore http-svr META $(INTF) $(LIBS) *.a *.cmx .PHONY: uninstall uninstall: diff --git a/log/Makefile b/log/Makefile index 48eb7c8..7a9702b 100644 --- a/log/Makefile +++ b/log/Makefile @@ -5,7 +5,6 @@ OCAMLOPT = ocamlopt LDFLAGS = -cclib -L./ -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLCFLAGS = -g -dtypes -thread -I ../stdext OCAMLOPTFLAGS = -g -dtypes -thread -I ../stdext @@ -61,8 +60,10 @@ logs.cmi: log.cmi debug.cmi: logs.cmi .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore log META $(INTF) $(LIBS) *.a *.so *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore log META $(INTF) $(LIBS) *.a *.so *.cmx .PHONY: uninstall uninstall: diff --git a/mk/Makefile b/mk/Makefile index e0b9806..d7e37ed 100644 --- a/mk/Makefile +++ b/mk/Makefile @@ -1,32 +1,67 @@ +NO_DEFAULT_BUILD := yes ifdef B_BASE include $(B_BASE)/common.mk -include $(B_BASE)/rpmbuild.mk -REPO = $(call hg_loc,xen-api-libs) else -REPO ?= $(CURDIR) +MY_OUTPUT_DIR ?= $(CURDIR)/_build/output-devel +MY_MAIN_PACKAGES ?= $(CURDIR)/_build/output +MY_OBJ_DIR ?= $(CURDIR)/_build/obj +MY_SOURCES ?= $(CURDIR)/_build/output-src +MY_SOURCES_DIRSTAMP ?= $(MY_SOURCES)/.dirstamp + %/.dirstamp: @mkdir -p $* @touch $@ endif -RPM_BINDIR=$(RPM_RPMSDIR)/$(DOMAIN0_ARCH_OPTIMIZED) +REPO = $(call hg_loc,xen-api-libs) +STAGING ?= $(MY_OBJ_DIR)/staging +OUTPUT_API_DEVEL_PKG ?= $(MY_OUTPUT_DIR)/api-libs-devel.tar.gz +OUTPUT_XAPI_DEVEL_PKG ?= $(MY_OUTPUT_DIR)/xapi-libs-devel.tar.gz +OUTPUT_API_PKG ?= $(MY_MAIN_PACKAGES)/api-libs.tar.bz2 +OUTPUT_SRC ?= $(MY_SOURCES)/xen-api-libs-src.tar.bz2 + +$(OUTPUT_API_DEVEL_PKG): + rm -rf $(STAGING) + mkdir -p $(MY_OUTPUT_DIR) + $(MAKE) -C $(REPO) clean + $(MAKE) -C $(REPO) all + $(MAKE) -C $(REPO) DESTDIR=$(STAGING) install + tar -C $(STAGING) -zcf $@ . -.PHONY: build -build: srpm $(MY_SOURCES)/MANIFEST - $(RPMBUILD) --target $(DOMAIN0_ARCH_OPTIMIZED) -bb $(RPM_SPECSDIR)/xapi-libs.spec +$(OUTPUT_API_PKG): $(OUTPUT_API_DEVEL_PKG) + rm -rf $(STAGING) mkdir -p $(MY_MAIN_PACKAGES) - cp $(RPM_RPMSDIR)/$(DOMAIN0_ARCH_OPTIMIZED)/xapi-libs-fe-*.rpm $(MY_MAIN_PACKAGES) + $(MAKE) -C $(REPO) bins + $(MAKE) -C $(REPO) DESTDIR=$(STAGING) bininstall + tar -C $(STAGING) -jcf $@ . + +$(OUTPUT_XAPI_DEVEL_PKG): + rm -rf $(STAGING) + mkdir -p $(MY_OUTPUT_DIR) + $(MAKE) -C $(REPO) cleanxen + $(MAKE) -C $(REPO) allxen + $(MAKE) -C $(REPO) DESTDIR=$(STAGING) installxen + tar -C $(STAGING) -zcf $@ . + +$(MY_SOURCES)/MANIFEST: $(MY_SOURCES_DIRSTAMP) $(OUTPUT_SRC) + mkdir -p $(MY_SOURCES) + echo api lgpl-with-linking-exception file $(OUTPUT_SRC) > $@ + +$(OUTPUT_SRC): + mkdir -p $(MY_SOURCES) + cd $(REPO) && hg archive -t tbz2 $(HG_EXCLUDE) $@ -.PHONY: srpm -srpm: - mkdir -p $(RPM_SRPMSDIR) $(RPM_SPECSDIR) $(RPM_SOURCESDIR) $(RPM_RPMSDIR) - hg archive -p xapi-libs-0 -t tbz2 $(RPM_SOURCESDIR)/xapi-libs-0.tar.bz2 - install -o root -g root ../xapi-libs.spec $(RPM_SPECSDIR) - $(RPMBUILD) --target $(DOMAIN0_ARCH_OPTIMIZED) -bs $(RPM_SPECSDIR)/xapi-libs.spec +.PHONY: api-libs +api-libs: $(OUTPUT_API_DEVEL_PKG) $(OUTPUT_API_PKG) $(MY_SOURCES)/MANIFEST -$(MY_SOURCES)/MANIFEST: $(MY_SOURCES_DIRSTAMP) - rm -f $@ - /bin/sh ./srpms-to-manifest api-libs $(MY_OUTPUT_DIR)/SRPMS > $@ +.PHONY: xapi-libs +xapi-libs: $(OUTPUT_XAPI_DEVEL_PKG) $(MY_SOURCES)/MANIFEST .PHONY: clean - rm -f *.rpm + rm -f $(STAGING) + rm -f $(OUTPUT_API_DEVEL_PKG) + rm -f $(OUTPUT_API_PKG) + rm -f $(OUTPUT_XAPI_DEVEL_PKG) + rm -f $(OUTPUT_SRC) + $(MAKE) -C $(REPO) clean + $(MAKE) -C $(REPO) cleanxen diff --git a/mmap/Makefile b/mmap/Makefile index 8701f3f..076372d 100644 --- a/mmap/Makefile +++ b/mmap/Makefile @@ -5,7 +5,6 @@ OCAMLOPT = ocamlopt LDFLAGS = -cclib -L./ -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes @@ -54,8 +53,10 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore mmap META $(INTF) $(LIBS) *.a *.so *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore mmap META $(INTF) $(LIBS) *.a *.so *.cmx .PHONY: uninstall uninstall: diff --git a/pciutil/Makefile b/pciutil/Makefile index 1997625..f05b29e 100644 --- a/pciutil/Makefile +++ b/pciutil/Makefile @@ -7,7 +7,6 @@ OCAMLOPT = ocamlopt LDFLAGS = -cclib -L./ LIBEXEC = "/opt/xensource/libexec" -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes @@ -54,13 +53,16 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore pciutil META $(INTF) $(LIBS) *.a *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore pciutil META $(INTF) $(LIBS) *.a *.cmx .PHONY: bininstall -bininstall: - mkdir -p $(DESDIR)$(LIBEXEC) - $(IPROG) $(PROGRAMS) $(DESDIR)$(LIBEXEC) +bininstall: path = $(DESTDIR)$(LIBEXEC) +bininstall: all + mkdir -p $(path) + $(IPROG) $(PROGRAMS) $(path) .PHONY: uninstall uninstall: diff --git a/rpc-light/Makefile b/rpc-light/Makefile index 6e53f5f..f134a5f 100644 --- a/rpc-light/Makefile +++ b/rpc-light/Makefile @@ -56,13 +56,15 @@ jsonrpc.cmi: jsonrpc.mli rpc.ml .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: rpc.cmi pa_rpc.cma xmlrpc.cma xmlrpc.cmxa + mkdir -p $(path) cp META-xmlrpc META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) xmlrpc META xmlrpc.cma xmlrpc.cmxa xmlrpc.cmi rpc.cmi xmlrpc.cmx rpc.cmx xmlrpc.a xmlrpc.o + ocamlfind install -destdir $(path) xmlrpc META xmlrpc.cma xmlrpc.cmxa xmlrpc.cmi rpc.cmi xmlrpc.cmx rpc.cmx xmlrpc.a xmlrpc.o cp META-jsonrpc META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) jsonrpc META jsonrpc.cma jsonrpc.cmxa jsonrpc.cmi rpc.cmi jsonrpc.cmx rpc.cmx jsonrpc.a jsonrpc.o + ocamlfind install -destdir $(path) jsonrpc META jsonrpc.cma jsonrpc.cmxa jsonrpc.cmi rpc.cmi jsonrpc.cmx rpc.cmx jsonrpc.a jsonrpc.o cp META-rpc-light META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) rpc-light META pa_rpc.cma pa_rpc.cmi + ocamlfind install -destdir $(path) rpc-light META pa_rpc.cma pa_rpc.cmi rm META .PHONY: uninstall diff --git a/rss/Makefile b/rss/Makefile index 5260e74..e0c28a1 100644 --- a/rss/Makefile +++ b/rss/Makefile @@ -5,7 +5,6 @@ OCAMLOPT = ocamlopt LDFLAGS = -cclib -L./ -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes @@ -47,8 +46,10 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore rss META $(INTF) $(LIBS) *.a *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore rss META $(INTF) $(LIBS) *.a *.cmx .PHONY: uninstall uninstall: diff --git a/sexpr/Makefile b/sexpr/Makefile index 9cab04f..69db4ee 100644 --- a/sexpr/Makefile +++ b/sexpr/Makefile @@ -9,7 +9,6 @@ OCAMLYACC = ocamlyacc LDFLAGS = -cclib -L./ LIBEXEC = "/opt/xensource/libexec" -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes @@ -68,13 +67,16 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore sexpr META $(INTF) $(LIBS) *.a *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore sexpr META $(INTF) $(LIBS) *.a *.cmx .PHONY: bininstall -bininstall: - mkdir -p $(DESDIR)$(LIBEXEC) - $(IPROG) $(PROGRAMS) $(DESDIR)$(LIBEXEC) +bininstall: path = $(DESTDIR)$(LIBEXEC) +bininstall: all + mkdir -p $(path) + $(IPROG) $(PROGRAMS) $(path) .PHONY: uninstall uninstall: diff --git a/stdext/Makefile b/stdext/Makefile index fed4fd9..3aef421 100644 --- a/stdext/Makefile +++ b/stdext/Makefile @@ -8,7 +8,6 @@ OCAMLOPT = ocamlopt LDFLAGS = -cclib -L./ LIBEXEC = "/opt/xensource/libexec/" -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes @@ -29,7 +28,7 @@ LIBS = stdext.cma stdext.cmxa PROGRAMS = base64pp DOCDIR = /myrepos/xen-api-libs.hg/doc - + all: $(INTF) $(LIBS) bins: $(PROGRAMS) @@ -100,13 +99,16 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore stdext META $(INTF) $(LIBS) *.a *.so *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore stdext META $(INTF) $(LIBS) *.a *.so *.cmx .PHONY: bininstall -bininstall: - mkdir -p $(DESDIR)$(LIBEXEC) - $(IPROG) $(PROGRAMS) $(DESDIR)$(LIBEXEC) +bininstall: path = $(DESTDIR)$(LIBEXEC) +bininstall: all + mkdir -p $(path) + $(IPROG) $(PROGRAMS) $(path) .PHONY: uninstall uninstall: diff --git a/stunnel/Makefile b/stunnel/Makefile index 3dc049d..66665aa 100644 --- a/stunnel/Makefile +++ b/stunnel/Makefile @@ -5,7 +5,6 @@ OCAMLOPT = ocamlopt LDFLAGS = -cclib -L./ -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes @@ -47,8 +46,10 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore stunnel META $(INTF) $(LIBS) *.a *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore stunnel META $(INTF) $(LIBS) *.a *.cmx .PHONY: uninstall uninstall: diff --git a/uuid/Makefile b/uuid/Makefile index 0e273d0..d7eb4f9 100644 --- a/uuid/Makefile +++ b/uuid/Makefile @@ -5,7 +5,6 @@ OCAMLOPT = ocamlopt LDFLAGS = -cclib -L./ -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes @@ -47,8 +46,10 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore uuid META $(INTF) $(LIBS) *.a *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore uuid META $(INTF) $(LIBS) *.a *.cmx .PHONY: uninstall uninstall: diff --git a/xb/Makefile b/xb/Makefile index 3707e1b..f3888d1 100644 --- a/xb/Makefile +++ b/xb/Makefile @@ -6,7 +6,6 @@ OCAMLOPTFLAGS = -g -dtypes -I ../mmap LDFLAGS = -cclib -L./ -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLABI := $(shell ocamlc -version) @@ -60,8 +59,10 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore xb META $(INTF) $(LIBS) *.a *.so *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore xb META $(INTF) $(LIBS) *.a *.so *.cmx .PHONY: uninstall uninstall: diff --git a/xc/Makefile b/xc/Makefile index 24eba32..e95d51a 100644 --- a/xc/Makefile +++ b/xc/Makefile @@ -6,7 +6,6 @@ OCAMLOPTFLAGS = -g -dtypes -I ../mmap -I ../uuid LDFLAGS = -cclib -L./ -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLABI := $(shell ocamlc -version) @@ -54,8 +53,10 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore xc META $(INTF) $(LIBS) *.a *.so *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore xc META $(INTF) $(LIBS) *.a *.so *.cmx .PHONY: uninstall uninstall: diff --git a/xml-light2/Makefile b/xml-light2/Makefile index d45c8ae..ee44646 100644 --- a/xml-light2/Makefile +++ b/xml-light2/Makefile @@ -13,7 +13,6 @@ OCAMLOPT = $(OCAMLFIND) ocamlopt $(OCAMLFINDFLAGS) LDFLAGS = -cclib -L./ LIBEXEC = "/opt/xensource/libexec" -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes @@ -59,13 +58,16 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore xml-light2 META $(INTF) $(LIBS) *.a *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore xml-light2 META $(INTF) $(LIBS) *.a *.cmx .PHONY: bininstall -bininstall: - mkdir -p $(DESDIR)$(LIBEXEC) - $(IPROG) $(PROGRAMS) $(DESDIR)$(LIBEXEC) +bininstall: path = $(DESTDIR)$(LIBEXEC) +bininstall: all + mkdir -p $(path) + $(IPROG) $(PROGRAMS) $(path) .PHONY: uninstall uninstall: diff --git a/xs/Makefile b/xs/Makefile index 74086d0..5c7f623 100644 --- a/xs/Makefile +++ b/xs/Makefile @@ -5,7 +5,6 @@ OCAMLOPT = ocamlopt LDFLAGS = -cclib -L./ -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes -I ../xb/ @@ -50,8 +49,10 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) 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 $(path) + ocamlfind install -destdir $(path) -ldconf ignore xs META $(INTF) xs.mli xst.mli xsraw.mli $(LIBS) *.a *.cmx .PHONY: uninstall uninstall: diff --git a/xsrpc/Makefile b/xsrpc/Makefile index 0d9e9da..3800b82 100644 --- a/xsrpc/Makefile +++ b/xsrpc/Makefile @@ -5,7 +5,6 @@ OCAMLOPT = ocamlopt LDFLAGS = -cclib -L./ -DESTDIR ?= / VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0) OCAMLOPTFLAGS = -g -dtypes -I ../xb/ -I ../xs/ @@ -47,8 +46,10 @@ META: META.in sed 's/@VERSION@/$(VERSION)/g' < $< > $@ .PHONY: install +install: path = $(DESTDIR)$(shell ocamlfind printconf destdir) install: $(LIBS) META - ocamlfind install -destdir $(DESTDIR)$(shell ocamlfind printconf destdir) -ldconf ignore xsrpc META $(INTF) $(LIBS) *.a *.cmx + mkdir -p $(path) + ocamlfind install -destdir $(path) -ldconf ignore xsrpc META $(INTF) $(LIBS) *.a *.cmx .PHONY: uninstall uninstall: