camlboot/Makefile

114 lines
3.3 KiB
Makefile
Raw Normal View History

2019-06-08 16:43:41 +02:00
BOOT=_boot
OCAMLSRC=ocaml-src
CONFIG=$(OCAMLSRC)/config/Makefile
OCAMLRUN=_boot/byterun/ocamlrun
2019-06-08 16:43:41 +02: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
.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)
mkdir -p $(BOOT)
rm -rf $@
cp -r $< $@
cp $(OCAMLSRC)/otherlibs/dynlink/dynlink.mli $@/compdynlink.mli
grep -v 'REMOVE_ME for ../../debugger/dynlink.ml' \
$(OCAMLSRC)/otherlibs/dynlink/dynlink.ml > $@/compdynlink.mlbyte
$(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 $< $@
$(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
$(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
$(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
$(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
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
.PHONY: ocamlrun
ocamlrun: $(OCAMLRUN)
$(OCAMLRUN): $(BOOT)/byterun
$(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
mkdir -p $(BOOT)/compilerlibs
2019-06-08 16:43:41 +02:00
cd $(BOOT) && ../compile_ocamlc.sh
.PHONY: test-compiler
test-compiler: $(OCAMLRUN)
make -C miniml/compiler/test all OCAMLRUN=../../../$(OCAMLRUN)
.PHONY: test-compiler-promote
test-compiler-promote: $(OCAMLRUN)
make -C miniml/compiler/test promote OCAMLRUN=../../../$(OCAMLRUN)