Skip to content

Commit

Permalink
Merge pull request #319 from kit-ty-kate/ocaml-5.1
Browse files Browse the repository at this point in the history
Add support for OCaml 5.1
  • Loading branch information
gasche authored Sep 28, 2022
2 parents 47da7ee + 9adf720 commit 88784c8
Show file tree
Hide file tree
Showing 17 changed files with 774 additions and 256 deletions.
969 changes: 739 additions & 230 deletions .depend

Large diffs are not rendered by default.

38 changes: 22 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ OCAMLLEX ?= ocamllex
endif

CP ?= cp
COMPFLAGS ?= -w +L -w +R -w +Z -I src -I +unix -safe-string -bin-annot -strict-sequence
COMPFLAGS ?= -w +L -w +R -w +Z -I src -I plugin-lib -I bin -I +unix -safe-string -bin-annot -strict-sequence
LINKFLAGS ?= -I +unix -I src

PACK_CMO= $(addprefix src/,\
Expand Down Expand Up @@ -79,7 +79,7 @@ PACK_CMO= $(addprefix src/,\
main.cmo \
)

EXTRA_CMO=$(addprefix src/,\
EXTRA_CMO=$(addprefix plugin-lib/,\
ocamlbuild_plugin.cmo \
ocamlbuild_executor.cmo \
ocamlbuild_unix_plugin.cmo \
Expand All @@ -90,14 +90,14 @@ EXTRA_CMX=$(EXTRA_CMO:.cmo=.cmx)
EXTRA_CMI=$(EXTRA_CMO:.cmo=.cmi)

INSTALL_LIB=\
src/ocamlbuildlib.cma \
src/ocamlbuild.cmo \
plugin-lib/ocamlbuildlib.cma \
bin/ocamlbuild.cmo \
src/ocamlbuild_pack.cmi \
$(EXTRA_CMO:.cmo=.cmi)

INSTALL_LIB_OPT=\
src/ocamlbuildlib.cmxa src/ocamlbuildlib$(EXT_LIB) \
src/ocamlbuild.cmx src/ocamlbuild$(EXT_OBJ) \
plugin-lib/ocamlbuildlib.cmxa plugin-lib/ocamlbuildlib$(EXT_LIB) \
bin/ocamlbuild.cmx bin/ocamlbuild$(EXT_OBJ) \
src/ocamlbuild_pack.cmx \
$(EXTRA_CMO:.cmo=.cmx) $(EXTRA_CMO:.cmo=$(EXT_OBJ))

Expand All @@ -116,34 +116,34 @@ else
all: byte man
endif

byte: ocamlbuild.byte src/ocamlbuildlib.cma
byte: ocamlbuild.byte plugin-lib/ocamlbuildlib.cma
# ocamlbuildlight.byte ocamlbuildlightlib.cma
native: ocamlbuild.native src/ocamlbuildlib.cmxa
native: ocamlbuild.native plugin-lib/ocamlbuildlib.cmxa

allopt: all # compatibility alias

distclean:: clean

# The executables

ocamlbuild.byte: src/ocamlbuild_pack.cmo $(EXTRA_CMO) src/ocamlbuild.cmo
ocamlbuild.byte: src/ocamlbuild_pack.cmo $(EXTRA_CMO) bin/ocamlbuild.cmo
$(OCAMLC) $(LINKFLAGS) -o $@ unix.cma $^

ocamlbuildlight.byte: src/ocamlbuild_pack.cmo src/ocamlbuildlight.cmo
ocamlbuildlight.byte: src/ocamlbuild_pack.cmo bin/ocamlbuildlight.cmo
$(OCAMLC) $(LINKFLAGS) -o $@ $^

ocamlbuild.native: src/ocamlbuild_pack.cmx $(EXTRA_CMX) src/ocamlbuild.cmx
ocamlbuild.native: src/ocamlbuild_pack.cmx $(EXTRA_CMX) bin/ocamlbuild.cmx
$(OCAMLOPT) $(LINKFLAGS) -o $@ unix.cmxa $^

# The libraries

src/ocamlbuildlib.cma: src/ocamlbuild_pack.cmo $(EXTRA_CMO)
plugin-lib/ocamlbuildlib.cma: src/ocamlbuild_pack.cmo $(EXTRA_CMO)
$(OCAMLC) -a -o $@ $^

src/ocamlbuildlightlib.cma: src/ocamlbuild_pack.cmo src/ocamlbuildlight.cmo
bin/ocamlbuildlightlib.cma: src/ocamlbuild_pack.cmo bin/ocamlbuildlight.cmo
$(OCAMLC) -a -o $@ $^

src/ocamlbuildlib.cmxa: src/ocamlbuild_pack.cmx $(EXTRA_CMX)
plugin-lib/ocamlbuildlib.cmxa: src/ocamlbuild_pack.cmx $(EXTRA_CMX)
$(OCAMLOPT) -a -o $@ $^

# The packs
Expand Down Expand Up @@ -424,9 +424,15 @@ endif
%.cmi: %.mli
$(OCAMLC) $(COMPFLAGS) -c $<

%.cmx: %.ml
src/%.cmx: src/%.ml
$(OCAMLOPT) -for-pack Ocamlbuild_pack $(COMPFLAGS) -c $<

bin/%.cmx: bin/%.ml
$(OCAMLOPT) $(COMPFLAGS) -c $<

plugin-lib/%.cmx: plugin-lib/%.ml
$(OCAMLOPT) $(COMPFLAGS) -c $<

clean::
rm -rf tmp/
rm -f src/*.cm* *.cm*
Expand All @@ -445,7 +451,7 @@ distclean::
# The dependencies

depend: beforedepend
$(OCAMLDEP) -I src src/*.mli src/*.ml > .depend
$(OCAMLDEP) -I src -I plugin-lib src/*.mli src/*.ml plugin-lib/*.mli plugin-lib/*.ml bin/*.mli bin/*.ml > .depend

$(EXTRA_CMI): src/ocamlbuild_pack.cmi
$(EXTRA_CMO): src/ocamlbuild_pack.cmo src/ocamlbuild_pack.cmi
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 7 additions & 5 deletions bootstrap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ setup:
$(MAKE) -C .. clean
$(MAKE) -C .. src/ocamlbuild_config.ml
ln -sf ../src
mkdir -p bin
ln -sf ../bin
ln -sf ../plugin-lib
mkdir -p dest

stage1: setup
@echo "BOOTSTRAP (1): building local ocamlbuild from '$(OCAMLBUILD)'"
@$(OCAMLBUILD) -build-dir _build_stage1 bootstrap.otarget

stage2: stage1
@echo "BOOTSTRAP (2): building local ocamlbuild from local ocamlbuild"
@_build_stage1/src/ocamlbuild.native -build-dir _build_stage2 bootstrap.otarget
@_build_stage1/bin/ocamlbuild.native -build-dir _build_stage2 bootstrap.otarget

clean:
@$(OCAMLBUILD) -clean
@$(OCAMLBUILD) -build-dir _build_stage1 -clean
@$(OCAMLBUILD) -build-dir _build_stage2 -clean
@rm -f src
@rm -f bin/ocamlbuild_{stage1,stage2}.native
@rmdir bin
@rm -f src bin plugin-lib
@rm -f dest/ocamlbuild_{stage1,stage2}.native
@rmdir dest

5 changes: 3 additions & 2 deletions bootstrap/_tags
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
# OCamlbuild tags file
true: debug
"src": include
"bin": include
"plugin-lib": include
<**/*.ml> or <**/*.mli>: warn_L, warn_R, warn_Z, annot
"src/discard_printf.ml": rectypes
"ocamlbuildlib.cma" or "ocamlbuildlightlib.cma": linkall
<**/*.byte> or <**/*.native> or <**/*.top>: use_unix
"ocamlbuildlight.byte": -use_unix, nopervasives
<**/*.cmx>: for-pack(Ocamlbuild_pack)
<**/{ocamlbuild_{pack,unix_plugin,plugin,executor},ppcache}{,.p}.cmx>: -for-pack(Ocamlbuild_pack)
<src/*.cmx>: for-pack(Ocamlbuild_pack)

# we have several build stages using different build directories,
# so each build must ignore each other's build dir.
Expand Down
6 changes: 3 additions & 3 deletions bootstrap/bootstrap.itarget
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ ocamlbuildlightlib.cma
ocamlbuildlib.cma
ocamlbuild.top
ocamlbuild.docdir/index.html
src/ocamlbuildlight.byte
src/ocamlbuild.byte
src/ocamlbuild.native
bin/ocamlbuildlight.byte
bin/ocamlbuild.byte
bin/ocamlbuild.native
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 88784c8

Please sign in to comment.