From: Stefano Zacchiroli <zack@upsilon.cc>
Date: Thu, 8 Apr 2010 22:05:57 +0200
Subject: [PATCH] enable byte only build
split the build process among native and non native targets, introducing the
new opt target; it will be invoked only if /usr/bin/ocamlopt exists
---
Makefile | 5 +++++
OCamlMakefile | 13 ++++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 880d68f..a3c84ed 100644
--- a/Makefile
+++ b/Makefile
@@ -4,8 +4,13 @@ EXAMPLES = $(filter-out examples/OMakefile examples/CVS, $(wildcard examples/*))
.PHONY: all
all:
+ @cd lib && $(MAKE) byte-code-library
+
+.PHONY: opt
+opt:
@cd lib && $(MAKE) byte-code-library native-code-library
+
.PHONY: examples
examples:
@for dir in $(EXAMPLES); do (cd $$dir && $(MAKE)); done
diff --git a/OCamlMakefile b/OCamlMakefile
index b8898ad..2fbcb07 100644
--- a/OCamlMakefile
+++ b/OCamlMakefile
@@ -519,8 +519,14 @@ ifndef STATIC
endif
ifndef LIBINSTALL_FILES
- LIBINSTALL_FILES := $(RESULT).mli $(RESULT).cmi $(RESULT).cma \
- $(RESULT).cmxa $(RESULT).$(EXT_LIB) $(RES_CLIB)
+ ifdef NATIVE
+ LIBINSTALL_FILES := $(RESULT).mli $(RESULT).cmi $(RESULT).cma \
+ $(RESULT).cmxa $(RESULT).$(EXT_LIB) $(RES_CLIB)
+ else
+ LIBINSTALL_FILES := $(RESULT).mli $(RESULT).cmi $(RESULT).cma \
+ $(RES_CLIB)
+ endif
+
ifndef STATIC
ifneq ($(strip $(OBJ_LINK)),)
LIBINSTALL_FILES += $(DLLSONAME)
@@ -1211,7 +1217,8 @@ subprojs: $(SUBPROJS:%=subproj_%)
.PHONY: libinstall
libinstall: all
$(QUIET)printf "\nInstalling library with ocamlfind\n"
- $(OCAMLFIND) install $(OCAMLFIND_INSTFLAGS) $(RESULT) META $(LIBINSTALL_FILES)
+ mkdir -p $(DESTDIR)
+ $(OCAMLFIND) install -destdir $(DESTDIR) -ldconf /dev/null $(OCAMLFIND_INSTFLAGS) $(RESULT) META $(LIBINSTALL_FILES)
$(QUIET)printf "\nInstallation successful.\n"
.PHONY: libinstall-byte-code
--