Skip to content

Commit

Permalink
Support building with a bytecode-only compiler
Browse files Browse the repository at this point in the history
Fixes: #27
  • Loading branch information
xavierleroy committed Jul 3, 2023
1 parent aabe0b5 commit 236d59e
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions lib/Makefile
Expand Up @@ -13,24 +13,37 @@
#* $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
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)

$(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

Expand Down

0 comments on commit 236d59e

Please sign in to comment.