Parallel compilation
This commit is contained in:
parent
92037d7271
commit
f8ed42b26d
6
Makefile
6
Makefile
@ -117,10 +117,12 @@ ocamlrun: $(OCAMLRUN)
|
|||||||
$(BOOT)/ocamlc: $(COPY_TARGETS)
|
$(BOOT)/ocamlc: $(COPY_TARGETS)
|
||||||
make -C $(OCAMLSRC)/yacc all
|
make -C $(OCAMLSRC)/yacc all
|
||||||
make -C miniml/interp interpopt.opt
|
make -C miniml/interp interpopt.opt
|
||||||
./timed.sh make -C _boot/stdlib all
|
touch _boot/stdlib/.depend && make -C _boot/stdlib depend
|
||||||
|
touch _boot/.depend && make -C _boot depend
|
||||||
|
./timed.sh make -C _boot/stdlib -j$(nproc) all
|
||||||
# cd $(BOOT)/stdlib && ../../timed.sh ../../compile_stdlib.sh
|
# cd $(BOOT)/stdlib && ../../timed.sh ../../compile_stdlib.sh
|
||||||
mkdir -p $(BOOT)/compilerlibs
|
mkdir -p $(BOOT)/compilerlibs
|
||||||
./timed.sh make -C _boot all
|
./timed.sh make -C _boot -j$(nproc) all
|
||||||
# cd $(BOOT) && ../timed.sh ../compile_ocamlc.sh
|
# cd $(BOOT) && ../timed.sh ../compile_ocamlc.sh
|
||||||
|
|
||||||
.PHONY: test-compiler
|
.PHONY: test-compiler
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
#* *
|
#* *
|
||||||
#**************************************************************************
|
#**************************************************************************
|
||||||
|
|
||||||
COMPILER=../miniml/interp/interp.opt -g -nostdlib -I stdlib
|
OPAQUE=-opaque
|
||||||
|
|
||||||
|
COMPILER=../miniml/interp/interp.opt $(OPAQUE) -nostdlib -I stdlib
|
||||||
INCLUDES=-I utils -I parsing -I typing -I bytecomp -I driver
|
INCLUDES=-I utils -I parsing -I typing -I bytecomp -I driver
|
||||||
|
|
||||||
COMPFLAGS=-strict-sequence -principal -absname -w +a-4-9-41-42-44-45-48 \
|
COMPFLAGS=-strict-sequence -principal -absname -w +a-4-9-41-42-44-45-48 \
|
||||||
@ -21,7 +23,7 @@ COMPFLAGS=-strict-sequence -principal -absname -w +a-4-9-41-42-44-45-48 \
|
|||||||
-bin-annot -safe-string -strict-formats $(INCLUDES)
|
-bin-annot -safe-string -strict-formats $(INCLUDES)
|
||||||
LINKFLAGS=
|
LINKFLAGS=
|
||||||
|
|
||||||
DEPEND=../miniml/interp/depend.sh
|
DEPEND=../miniml/interp/depend.sh $(OPAQUE)
|
||||||
DEPFLAGS=$(INCLUDES)
|
DEPFLAGS=$(INCLUDES)
|
||||||
|
|
||||||
UTILS=utils/config.cmx utils/misc.cmx \
|
UTILS=utils/config.cmx utils/misc.cmx \
|
||||||
@ -79,8 +81,6 @@ BYTECOMP=bytecomp/instruct.cmx bytecomp/bytegen.cmx \
|
|||||||
|
|
||||||
BYTESTART=driver/main.cmx
|
BYTESTART=driver/main.cmx
|
||||||
|
|
||||||
all: ocamlc
|
|
||||||
|
|
||||||
# Shared parts of the system compiled with the native-code compiler
|
# Shared parts of the system compiled with the native-code compiler
|
||||||
|
|
||||||
compilerlibs/ocamlcommon.cmxa: $(COMMON)
|
compilerlibs/ocamlcommon.cmxa: $(COMMON)
|
||||||
|
@ -13,14 +13,15 @@
|
|||||||
#* *
|
#* *
|
||||||
#**************************************************************************
|
#**************************************************************************
|
||||||
|
|
||||||
CAMLRUN = ../../ocaml-src/byterun/ocamlrun
|
|
||||||
TARGET_BINDIR ?= $(BINDIR)
|
|
||||||
|
|
||||||
COMPFLAGS=-strict-sequence -absname -w +a-4-9-41-42-44-45-48 \
|
COMPFLAGS=-strict-sequence -absname -w +a-4-9-41-42-44-45-48 \
|
||||||
-g -warn-error A -bin-annot -nostdlib \
|
-g -warn-error A -bin-annot -nostdlib \
|
||||||
-safe-string -strict-formats
|
-safe-string -strict-formats
|
||||||
COMPILER=../../miniml/interp/interp.opt
|
|
||||||
DEPEND=../../miniml/interp/depend.sh -native
|
# Set -opaque for faster compilation
|
||||||
|
OPAQUE=-opaque
|
||||||
|
|
||||||
|
COMPILER=../../miniml/interp/interp.opt $(OPAQUE)
|
||||||
|
DEPEND=../../miniml/interp/depend.sh $(OPAQUE) -native
|
||||||
|
|
||||||
# Object file prefix
|
# Object file prefix
|
||||||
P=stdlib__
|
P=stdlib__
|
||||||
@ -72,10 +73,17 @@ stdlib__%.cmx: %.ml
|
|||||||
$(COMPILER) $(COMPFLAGS) $(shell ./Compflags $@) -o $@ -c $<
|
$(COMPILER) $(COMPFLAGS) $(shell ./Compflags $@) -o $@ -c $<
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Dependencies on Stdlib (not tracked by ocamldep)
|
# Dependencies on Stdlib (not tracked by ocamldep)
|
||||||
|
|
||||||
$(OTHERS:.cmx=.cmi) std_exit.cmi: stdlib.cmi
|
$(OTHERS:.cmx=.cmi) std_exit.cmi: stdlib.cmi
|
||||||
$(OBJS) std_exit.cmx: stdlib.cmi
|
$(OBJS) std_exit.cmx: stdlib.cmi
|
||||||
|
ifeq "$(OPAQUE)" ""
|
||||||
|
CMIX=cmx
|
||||||
$(OTHERS) std_exit.cmx: stdlib.cmx
|
$(OTHERS) std_exit.cmx: stdlib.cmx
|
||||||
|
else
|
||||||
|
CMIX=cmi
|
||||||
|
endif
|
||||||
|
|
||||||
clean::
|
clean::
|
||||||
rm -f *.cm* *.o *.a
|
rm -f *.cm* *.o *.a
|
||||||
@ -86,12 +94,13 @@ include .depend
|
|||||||
EMPTY :=
|
EMPTY :=
|
||||||
SPACE := $(EMPTY) $(EMPTY)
|
SPACE := $(EMPTY) $(EMPTY)
|
||||||
|
|
||||||
|
|
||||||
.PHONY: depend
|
.PHONY: depend
|
||||||
depend:
|
depend:
|
||||||
$(DEPEND) $(filter-out stdlib.%,$(wildcard *.mli *.ml)) \
|
$(DEPEND) $(filter-out stdlib.%,$(wildcard *.mli *.ml)) \
|
||||||
> .depend.tmp
|
> .depend.tmp
|
||||||
echo "stdlib.cmi : camlinternalFormatBasics.cmi" >> .depend.tmp
|
echo "stdlib.cmi : camlinternalFormatBasics.cmi" >> .depend.tmp
|
||||||
echo "stdlib.cmx : camlinternalFormatBasics.cmx" >> .depend.tmp
|
echo "stdlib.cmx : camlinternalFormatBasics.$(CMIX)" >> .depend.tmp
|
||||||
sed -Ee \
|
sed -Ee \
|
||||||
's#(^| )(${subst ${SPACE},|,${PREFIXED_OBJS:stdlib__%.cmx=%}})[.]#\1stdlib__\2.#g' \
|
's#(^| )(${subst ${SPACE},|,${PREFIXED_OBJS:stdlib__%.cmx=%}})[.]#\1stdlib__\2.#g' \
|
||||||
.depend.tmp > .depend
|
.depend.tmp > .depend
|
||||||
|
@ -29,6 +29,7 @@ let load_path = ref ([] : (string * string array) list)
|
|||||||
let ml_synonyms = ref [".ml"]
|
let ml_synonyms = ref [".ml"]
|
||||||
let mli_synonyms = ref [".mli"]
|
let mli_synonyms = ref [".mli"]
|
||||||
let shared = ref false
|
let shared = ref false
|
||||||
|
let opaque = ref false
|
||||||
let native_only = ref false
|
let native_only = ref false
|
||||||
let bytecode_only = ref false
|
let bytecode_only = ref false
|
||||||
let error_occurred = ref false
|
let error_occurred = ref false
|
||||||
@ -117,7 +118,7 @@ let find_dependency target_kind modname (byt_deps, opt_deps) =
|
|||||||
let basename = Filename.chop_extension filename in
|
let basename = Filename.chop_extension filename in
|
||||||
let cmi_file = basename ^ ".cmi" in
|
let cmi_file = basename ^ ".cmi" in
|
||||||
let cmx_file = basename ^ ".cmx" in
|
let cmx_file = basename ^ ".cmx" in
|
||||||
let ml_exists =
|
let ml_exists = not !opaque &&
|
||||||
List.exists (fun ext -> Sys.file_exists (basename ^ ext)) !ml_synonyms in
|
List.exists (fun ext -> Sys.file_exists (basename ^ ext)) !ml_synonyms in
|
||||||
let new_opt_dep =
|
let new_opt_dep =
|
||||||
if !all_dependencies then
|
if !all_dependencies then
|
||||||
@ -401,6 +402,8 @@ let main () =
|
|||||||
" Generate dependencies for native-code only (no .cmo files)";
|
" Generate dependencies for native-code only (no .cmo files)";
|
||||||
"-bytecode", Arg.Set bytecode_only,
|
"-bytecode", Arg.Set bytecode_only,
|
||||||
" Generate dependencies for bytecode-code only (no .cmx files)";
|
" Generate dependencies for bytecode-code only (no .cmx files)";
|
||||||
|
"-opaque", Arg.Set opaque,
|
||||||
|
" Generate dependencies for compilation with -opaque";
|
||||||
(* "-pp", Arg.String(fun s -> Clflags.preprocessor := Some s),
|
(* "-pp", Arg.String(fun s -> Clflags.preprocessor := Some s),
|
||||||
"<cmd> Pipe sources through preprocessor <cmd>"; *)
|
"<cmd> Pipe sources through preprocessor <cmd>"; *)
|
||||||
] in
|
] in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user