2018-09-23 21:34:49 +02:00
|
|
|
|
|
|
|
OBJS=interp.cmo
|
2019-06-08 16:43:41 +02:00
|
|
|
FLAGS=-g -package compiler-libs.common -linkpkg
|
2018-09-23 21:16:04 +02:00
|
|
|
OCAML=ocamlfind ocamlc
|
2018-09-23 21:34:49 +02:00
|
|
|
OCAMLOPT=ocamlfind ocamlopt
|
2018-09-23 21:16:04 +02:00
|
|
|
|
|
|
|
.SUFFIXES: .mli .ml .cmi .cmo .cmx
|
|
|
|
|
|
|
|
.ml.cmx:
|
2018-09-23 21:34:49 +02:00
|
|
|
$(OCAMLOPT) $(FLAGS) -c $<
|
2018-09-23 21:16:04 +02:00
|
|
|
|
|
|
|
.ml.cmo:
|
|
|
|
$(OCAML) $(FLAGS) -c $<
|
|
|
|
|
|
|
|
interp: $(OBJS)
|
2019-06-01 15:27:25 +02:00
|
|
|
$(OCAML) $(FLAGS) -linkpkg -o $@ $+
|
2018-09-23 21:34:49 +02:00
|
|
|
|
|
|
|
interpopt: $(OBJS:.cmo=.cmx)
|
2019-06-01 15:27:25 +02:00
|
|
|
$(OCAMLOPT) $(FLAGS) -linkpkg -o $@ $+
|
2019-06-08 16:43:41 +02:00
|
|
|
|
|
|
|
BOOT=_boot
|
|
|
|
OCAMLSRC=ocaml-src
|
|
|
|
|
|
|
|
configure-ocaml: $(OCAMLSRC)
|
|
|
|
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
|
|
|
|
make -C $(OCAMLSRC) CAMLLEX=ocamllex CAMLRUN=ocamlrun parsing/lexer.ml
|
|
|
|
make -C $(OCAMLSRC) bytecomp/runtimedef.ml
|
|
|
|
make -C $(OCAMLSRC) CAMLLEX=ocamllex CAMLRUN=ocamlrun CAMLC=ocamlc bytecomp/opcodes.ml
|
|
|
|
|
2019-06-08 22:13:35 +02:00
|
|
|
$(BOOT)/driver: $(OCAMLSRC)/driver $(OCAMLSRC)/otherlibs/dynlink configure-ocaml
|
|
|
|
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
|
|
|
|
|
|
|
|
$(BOOT)/byterun: $(OCAMLSRC)/byterun configure-ocaml
|
2019-06-08 16:43:41 +02:00
|
|
|
mkdir -p $(BOOT)
|
|
|
|
rm -rf $@
|
|
|
|
cp -r $< $@
|
|
|
|
|
|
|
|
$(BOOT)/bytecomp: $(OCAMLSRC)/bytecomp configure-ocaml
|
|
|
|
mkdir -p $(BOOT)
|
|
|
|
rm -rf $@
|
|
|
|
cp -r $< $@
|
|
|
|
|
|
|
|
$(BOOT)/typing: $(OCAMLSRC)/typing configure-ocaml
|
|
|
|
mkdir -p $(BOOT)
|
|
|
|
rm -rf $@
|
|
|
|
cp -r $< $@
|
|
|
|
|
|
|
|
$(BOOT)/parsing: $(OCAMLSRC)/parsing configure-ocaml patches/parsetree.patch
|
|
|
|
mkdir -p $(BOOT)
|
|
|
|
rm -rf $@
|
|
|
|
cp -r $< $@
|
|
|
|
patch $(BOOT)/parsing/parsetree.mli patches/parsetree.patch
|
|
|
|
|
|
|
|
$(BOOT)/utils: $(OCAMLSRC)/utils configure-ocaml patches/disable-profiling.patch
|
|
|
|
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 configure-ocaml patches/compflags.patch
|
|
|
|
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: $(BOOT)/driver $(BOOT)/bytecomp $(BOOT)/typing $(BOOT)/parsing $(BOOT)/utils $(BOOT)/stdlib
|
|
|
|
|
|
|
|
$(BOOT)/ocamlc: copy
|
2019-06-12 14:03:42 +02:00
|
|
|
make -C $(OCAMLSRC)/yacc all
|
|
|
|
make -C $(OCAMLSRC)/byterun all
|
|
|
|
make -C miniml/compiler miniml
|
|
|
|
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
|