Changes to make Makefile work

This commit is contained in:
Nathanaël Courant 2021-02-16 14:05:22 +01:00
parent bc417c81a3
commit 7969c70193
4 changed files with 28 additions and 11 deletions

View File

@ -9,18 +9,21 @@ $(OCAMLRUN): $(CONFIG)
.PHONY: configure-ocaml
configure-ocaml:
rm $(OCAMLSRC)/boot/ocamlc $(OCAMLSRC)/boot/ocamllex
rm -f $(OCAMLSRC)/boot/ocamlc $(OCAMLSRC)/boot/ocamllex
cd $(OCAMLSRC) && bash configure
make -C $(OCAMLSRC) ocamlyacc && cp $(OCAMLSRC)/yacc/ocamlyacc $(OCAMLSRC)/boot
make -C $(OCAMLSRC)/lex parser.ml
.PHONY: ocaml-generated-files
ocaml-generated-files: $(OCAMLRUN) lex make_opcodes
make -C $(OCAMLSRC) ocamlyacc && cp $(OCAMLSRC)/yacc/ocamlyacc $(OCAMLSRC)/boot
ocaml-generated-files: $(OCAMLRUN) lex make_opcodes cvt_emit
make -C $(OCAMLSRC)/stdlib sys.ml
make -C $(OCAMLSRC) utils/config.ml
make -C $(OCAMLSRC) parsing/parser.ml
miniml/interp/lex.sh $(OCAMLSRC)/parsing/lexer.mll -o $(OCAMLSRC)/parsing/lexer.ml
make -C $(OCAMLSRC) bytecomp/runtimedef.ml
miniml/interp/make_opcodes.sh -opcodes < $(OCAMLSRC)/byterun/caml/instruct.h > $(OCAMLSRC)/bytecomp/opcodes.ml
make -C $(OCAMLSRC) asmcomp/arch.ml asmcomp/proc.ml asmcomp/selection.ml asmcomp/CSE.ml asmcomp/reload.ml asmcomp/scheduling.ml
miniml/interp/cvt_emit.sh < $(OCAMLSRC)/asmcomp/amd64/emit.mlp > $(OCAMLSRC)/asmcomp/emit.ml
.PHONY: lex
lex: $(OCAMLRUN)
@ -30,6 +33,11 @@ lex: $(OCAMLRUN)
make_opcodes: $(OCAMLRUN)
make -C miniml/interp make_opcodes.byte
.PHONY: cvt_emit
cvt_emit: $(OCAMLRUN)
make -C miniml/interp cvt_emit.byte
.PHONY: clean-ocaml-config
clean-ocaml-config:
cd $(OCAMLSRC) && make distclean
@ -70,7 +78,7 @@ $(BOOT)/parsing: $(OCAMLSRC)/parsing $(CONFIG) $(GENERATED) patches/parsetree.pa
mkdir -p $(BOOT)
rm -rf $@
cp -r $< $@
patch $(BOOT)/parsing/parsetree.mli patches/parsetree.patch
#patch $(BOOT)/parsing/parsetree.mli patches/parsetree.patch
$(BOOT)/utils: $(OCAMLSRC)/utils $(CONFIG) $(GENERATED) patches/disable-profiling.patch
mkdir -p $(BOOT)
@ -102,11 +110,9 @@ copy: $(COPY_TARGETS)
.PHONY: ocamlrun
ocamlrun: $(OCAMLRUN)
$(OCAMLRUN): $(BOOT)/byterun
$(BOOT)/ocamlc: $(COPY_TARGETS)
make -C $(OCAMLSRC)/yacc all
make -C miniml/interp interp
make -C miniml/interp interp.byte
echo "stdlib compilation:" > timings
cd $(BOOT)/stdlib && /usr/bin/env time -a -o ../../timings ../../compile_stdlib.sh
mkdir -p $(BOOT)/compilerlibs

View File

@ -4,7 +4,7 @@ open Eval
open Envir
let parse filename =
let inc = open_in filename in
let inc = try open_in filename with e -> Format.eprintf "Error opening file: %s@." filename; raise e in
let lexbuf = Lexing.from_channel inc in
Location.init lexbuf filename;
let parsed = Parser.implementation Lexer.real_token lexbuf in

View File

@ -29,6 +29,12 @@ make_opcodes.ml: lex.byte ../../ocaml-src/tools/make_opcodes.mll
make_opcodes.byte: $(COMMONOBJS) make_opcodes.ml
$(MINIML) $(COMMONOBJS) make_opcodes.ml -o $@
cvt_emit.ml: lex.byte ../../ocaml-src/tools/cvt_emit.mll
$(OCAMLRUN) lex.byte ../../ocaml-src/tools/cvt_emit.mll -o cvt_emit.ml
cvt_emit.byte: $(COMMONOBJS) cvt_emit.ml
$(MINIML) $(COMMONOBJS) cvt_emit.ml -o $@
interp.byte: $(INTERPOBJS)
$(MINIML) $(INTERPOBJS) -o $@

View File

@ -110,6 +110,10 @@ let __atom0 = __mkatom0 ()
external int_of_string : string -> int = "caml_int_of_string"
external format_int : string -> int -> string = "caml_format_int"
let string_of_int n = format_int "%d" n
external unsafe_input : in_channel -> bytes -> int -> int -> unit = "caml_ml_input"
let input ic s ofs len =
@ -187,10 +191,14 @@ external pos_in : in_channel -> int = "caml_ml_pos_in"
let output_string oc s =
unsafe_output_string oc s 0 (string_length s)
let print_char c = output_char stdout c
let print_string s = output_string stdout s; flush stdout
let print_newline () = print_string "\n"
let print_endline s = print_string s; print_newline ()
let print_err s = output_string stderr s; flush stderr
let prerr_string s = print_err s
let prerr_int n = prerr_string (string_of_int n)
let prerr_newline () = prerr_string "\n"
external unsafe_input : in_channel -> bytes -> int -> int -> int
= "caml_ml_input"
@ -219,9 +227,6 @@ let really_input_string ic len =
bytes_unsafe_to_string s
external format_int : string -> int -> string = "caml_format_int"
let string_of_int n = format_int "%d" n
module Sys = struct
type backend_type =
| Native