From 236d59e1d11df5ebe25005360d2dfd3a6017586c Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 3 Jul 2023 14:09:01 +0200 Subject: [PATCH] Support building with a bytecode-only compiler Fixes: #27 --- lib/Makefile | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 5048be6..b5934e5 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -13,6 +13,7 @@ #* $Id: Makefile,v 1.4 2002-04-22 11:50:47 xleroy Exp $ include ../config/Makefile +include $(OCAMLLIB)/Makefile.config BYTEOBJS=com.cmo BYTELIB=com.cma @@ -20,7 +21,17 @@ NATIVEOBJS=$(BYTEOBJS:.cmo=.cmx) NATIVELIB=$(BYTELIB:.cma=.cmxa) INTERFACES=$(BYTEOBJS:.cmo=.cmi) -all: $(BYTELIB) $(NATIVELIB) +all:: allbyt +install:: installbyt +ifneq "${ARCH}" "none" +ifneq "${NATIVE_COMPILER}" "false" +all:: allopt +install:: installopt +endif +endif + +allbyt: $(BYTELIB) +allopt: $(NATIVELIB) $(BYTELIB): $(BYTEOBJS) $(OCAMLC) -a -o $(BYTELIB) -dllib -lcamlidl -cclib -lcamlidl $(BYTEOBJS) @@ -28,9 +39,11 @@ $(BYTELIB): $(BYTEOBJS) $(NATIVELIB): $(NATIVEOBJS) $(OCAMLOPT) -a -o $(NATIVELIB) -cclib -lcamlidl $(NATIVEOBJS) -install: - cp $(INTERFACES) $(BYTELIB) $(NATIVELIB) $(NATIVELIB:.cmxa=.$(LIBEXT)) $(OCAMLLIB) - cd $(OCAMLLIB); $(RANLIB) $(NATIVELIB:.cmxa=.$(LIBEXT)) +installbyt: + cp -p $(INTERFACES) $(BYTELIB) $(OCAMLLIB) + +installopt: + cp -p $(NATIVELIB) $(NATIVELIB:.cmxa=.$(LIBEXT)) $(OCAMLLIB) .SUFFIXES: .mli .ml .cmi .cmo .cmx