2019-06-08 16:43:41 +02:00
|
|
|
BOOT=_boot
|
|
|
|
OCAMLSRC=ocaml-src
|
2020-12-11 09:27:18 +01:00
|
|
|
CONFIG=$(OCAMLSRC)/config/Makefile
|
2020-12-11 09:14:13 +01:00
|
|
|
OCAMLRUN=_boot/byterun/ocamlrun
|
2019-06-08 16:43:41 +02:00
|
|
|
|
2020-12-11 09:27:18 +01:00
|
|
|
.PHONY: configure-ocaml
|
|
|
|
configure-ocaml:
|
2021-02-15 15:59:07 +01:00
|
|
|
rm $(OCAMLSRC)/boot/ocamlc $(OCAMLSRC)/boot/ocamllex
|
2019-06-08 16:43:41 +02:00
|
|
|
cd $(OCAMLSRC) && bash configure
|
|
|
|
make -C $(OCAMLSRC) ocamlyacc && cp $(OCAMLSRC)/yacc/ocamlyacc $(OCAMLSRC)/boot
|
|
|
|
make -C $(OCAMLSRC)/stdlib sys.ml
|
|
|
|
make -C $(OCAMLSRC) utils/config.ml
|
|
|
|
make -C $(OCAMLSRC) parsing/parser.ml
|
2021-02-15 15:59:07 +01:00
|
|
|
#make -C $(OCAMLSRC) CAMLLEX=ocamllex CAMLRUN=ocamlrun parsing/lexer.ml
|
2019-06-08 16:43:41 +02:00
|
|
|
make -C $(OCAMLSRC) bytecomp/runtimedef.ml
|
2021-02-15 15:59:07 +01:00
|
|
|
#make -C $(OCAMLSRC) CAMLLEX=ocamllex CAMLRUN=ocamlrun CAMLC=ocamlc bytecomp/opcodes.ml
|
|
|
|
|
|
|
|
.PHONY: lex
|
|
|
|
lex:
|
|
|
|
make -C miniml/interp lex.byte
|
|
|
|
|
|
|
|
.PHONY: make_opcodes
|
|
|
|
make_opcodes:
|
|
|
|
make -C miniml/interp make_opcodes.byte
|
2019-06-08 16:43:41 +02:00
|
|
|
|
2020-12-11 09:27:18 +01:00
|
|
|
.PHONY: clean-ocaml-config
|
|
|
|
clean-ocaml-config:
|
|
|
|
cd $(OCAMLSRC) && make distclean
|
|
|
|
|
|
|
|
# this dependency is fairly coarse-grained, so feel free to
|
|
|
|
# use clean-ocaml-config if make a small change to $(OCAMLSRC)
|
|
|
|
# that you believe does require re-configuring.
|
|
|
|
$(CONFIG): $(OCAMLSRC)/VERSION
|
|
|
|
make configure-ocaml
|
|
|
|
|
|
|
|
$(BOOT)/driver: $(OCAMLSRC)/driver $(OCAMLSRC)/otherlibs/dynlink $(CONFIG)
|
2019-06-08 22:13:35 +02:00
|
|
|
mkdir -p $(BOOT)
|
|
|
|
rm -rf $@
|
|
|
|
cp -r $< $@
|
2019-06-12 13:54:40 +02:00
|
|
|
cp $(OCAMLSRC)/otherlibs/dynlink/dynlink.mli $@/compdynlink.mli
|
2019-06-08 22:13:35 +02:00
|
|
|
grep -v 'REMOVE_ME for ../../debugger/dynlink.ml' \
|
|
|
|
$(OCAMLSRC)/otherlibs/dynlink/dynlink.ml > $@/compdynlink.mlbyte
|
|
|
|
|
2020-12-11 09:27:18 +01:00
|
|
|
$(BOOT)/byterun: $(OCAMLSRC)/byterun $(CONFIG)
|
2019-06-19 11:54:18 +02:00
|
|
|
make -C $(OCAMLSRC)/byterun all
|
2019-06-08 16:43:41 +02:00
|
|
|
mkdir -p $(BOOT)
|
|
|
|
rm -rf $@
|
|
|
|
cp -r $< $@
|
|
|
|
|
2020-12-11 09:27:18 +01:00
|
|
|
$(BOOT)/bytecomp: $(OCAMLSRC)/bytecomp $(CONFIG)
|
2019-06-08 16:43:41 +02:00
|
|
|
mkdir -p $(BOOT)
|
|
|
|
rm -rf $@
|
|
|
|
cp -r $< $@
|
2021-02-15 15:59:07 +01:00
|
|
|
miniml/interp/make_opcodes.sh -opcodes < $(OCAMLSRC)/byterun/caml/instruct.h > $(BOOT)/bytecomp/opcodes.ml
|
2019-06-08 16:43:41 +02:00
|
|
|
|
2020-12-11 09:27:18 +01:00
|
|
|
$(BOOT)/typing: $(OCAMLSRC)/typing $(CONFIG)
|
2019-06-08 16:43:41 +02:00
|
|
|
mkdir -p $(BOOT)
|
|
|
|
rm -rf $@
|
|
|
|
cp -r $< $@
|
|
|
|
|
2021-02-15 15:59:07 +01:00
|
|
|
$(BOOT)/parsing: $(OCAMLSRC)/parsing $(CONFIG) patches/parsetree.patch lex
|
2019-06-08 16:43:41 +02:00
|
|
|
mkdir -p $(BOOT)
|
|
|
|
rm -rf $@
|
|
|
|
cp -r $< $@
|
|
|
|
patch $(BOOT)/parsing/parsetree.mli patches/parsetree.patch
|
2021-02-15 15:59:07 +01:00
|
|
|
miniml/interp/lex.sh $(BOOT)/parsing/lexer.mll -o $(BOOT)/parsing/lexer.ml
|
2019-06-08 16:43:41 +02:00
|
|
|
|
2020-12-11 09:27:18 +01:00
|
|
|
$(BOOT)/utils: $(OCAMLSRC)/utils $(CONFIG) patches/disable-profiling.patch
|
2019-06-08 16:43:41 +02:00
|
|
|
mkdir -p $(BOOT)
|
|
|
|
rm -rf $@
|
|
|
|
cp -r $< $@
|
|
|
|
cp $(BOOT)/utils/profile.ml $(BOOT)/utils/profile.ml.noprof
|
|
|
|
patch $(BOOT)/utils/profile.ml.noprof patches/disable-profiling.patch
|
|
|
|
|
2020-12-11 09:27:18 +01:00
|
|
|
$(BOOT)/stdlib: $(OCAMLSRC)/stdlib $(CONFIG) patches/compflags.patch
|
2019-06-08 16:43:41 +02:00
|
|
|
mkdir -p $(BOOT)
|
|
|
|
rm -rf $@
|
|
|
|
cp -r $< $@
|
|
|
|
patch $(BOOT)/stdlib/Compflags patches/compflags.patch
|
|
|
|
awk -f $(BOOT)/stdlib/expand_module_aliases.awk < $(BOOT)/stdlib/stdlib.mli > $(BOOT)/stdlib/stdlib.pp.mli
|
|
|
|
awk -f $(BOOT)/stdlib/expand_module_aliases.awk < $(BOOT)/stdlib/stdlib.ml > $(BOOT)/stdlib/stdlib.pp.ml
|
|
|
|
|
2020-12-11 09:27:18 +01:00
|
|
|
COPY_TARGETS=\
|
|
|
|
$(BOOT)/bytecomp \
|
|
|
|
$(BOOT)/byterun \
|
|
|
|
$(BOOT)/driver \
|
|
|
|
$(BOOT)/parsing \
|
|
|
|
$(BOOT)/stdlib \
|
|
|
|
$(BOOT)/typing \
|
|
|
|
$(BOOT)/utils
|
|
|
|
|
|
|
|
.PHONY: copy
|
|
|
|
copy: $(COPY_TARGETS)
|
2019-06-08 16:43:41 +02:00
|
|
|
|
2020-12-11 09:14:13 +01:00
|
|
|
.PHONY: ocamlrun
|
|
|
|
ocamlrun: $(OCAMLRUN)
|
|
|
|
|
|
|
|
$(OCAMLRUN): $(BOOT)/byterun
|
|
|
|
|
2020-12-11 09:27:18 +01:00
|
|
|
$(BOOT)/ocamlc: $(COPY_TARGETS)
|
2019-06-12 14:03:42 +02:00
|
|
|
make -C $(OCAMLSRC)/yacc all
|
|
|
|
make -C miniml/interp interp
|
2019-06-08 16:43:41 +02:00
|
|
|
cd $(BOOT)/stdlib && ../../compile_stdlib.sh
|
2019-06-08 22:13:35 +02:00
|
|
|
mkdir -p $(BOOT)/compilerlibs
|
2019-06-08 16:43:41 +02:00
|
|
|
cd $(BOOT) && ../compile_ocamlc.sh
|
2020-12-11 09:14:13 +01:00
|
|
|
|
|
|
|
.PHONY: test-compiler
|
|
|
|
test-compiler: $(OCAMLRUN)
|
2020-12-11 21:14:43 +01:00
|
|
|
make -C miniml/compiler/test all OCAMLRUN=../../../$(OCAMLRUN)
|
2020-12-11 09:14:13 +01:00
|
|
|
|
|
|
|
.PHONY: test-compiler-promote
|
|
|
|
test-compiler-promote: $(OCAMLRUN)
|
|
|
|
make -C miniml/compiler/test promote OCAMLRUN=../../../$(OCAMLRUN)
|