Skip to content

Make configure not require ocamlc #349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ CFG_STDLIB :=$(call CFG_LIB_NAME,std)
ifdef CFG_OCAMLC_OPT
$(info cfg: have ocaml native compiler)
OPT=.opt
else
else ifdef CFG_OCAMLC
$(info cfg: have only ocaml bytecode compiler)
endif

Expand Down Expand Up @@ -137,6 +137,12 @@ SREQ2 := stage2/rustc$(X) $(LREQ) stage3/glue.o stage3/$(CFG_STDLIB)

export CFG_SRC_DIR

######################################################################
# Subprograms
######################################################################

LLVM_AS := $(CFG_LLVM_BINDIR)/llvm-as


######################################################################
# Single-target rules
Expand All @@ -145,17 +151,21 @@ export CFG_SRC_DIR
all: rt/$(CFG_RUNTIME) \
rustllvm/$(CFG_RUSTLLVM) \
stage0/$(CFG_STDLIB) \
stage0/intrinsics.bc \
stage0/rustc$(X) \
$(GENERATED) \
$(DOCS) \
stage1/$(CFG_STDLIB) \
stage1/intrinsics.bc \
stage1/glue.o \
stage1/rustc$(X) \
stage2/$(CFG_STDLIB) \
stage2/intrinsics.bc \
stage2/glue.o \
stage2/rustc$(X) \
stage3/$(CFG_STDLIB) \
stage3/glue.o \
stage3/intrinsics.bc \
stage3/rustc$(X)


Expand All @@ -172,6 +182,7 @@ config.mk: $(S)configure $(S)Makefile.in
# Additional makefiles
######################################################################

include $(CFG_SRC_DIR)/mk/intrinsics.mk
include $(CFG_SRC_DIR)/mk/stage0.mk
include $(CFG_SRC_DIR)/mk/stage1.mk
include $(CFG_SRC_DIR)/mk/stage2.mk
Expand Down
9 changes: 8 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ need_cmd find
need_cmd uname
need_cmd date
need_cmd tr
need_cmd sed

msg "inspecting environment"

Expand Down Expand Up @@ -185,13 +186,13 @@ putvar CFG_CONFIGURE_ARGS
step_msg "looking for build programs"
probe_need CFG_GCC gcc
probe_need CFG_GIT git
probe_need CFG_OCAMLC ocamlc
probe_need CFG_PERL perl
probe_need CFG_PYTHON python
probe_need CFG_CURL curl

probe CFG_LLVM_CONFIG llvm-config
probe CFG_VALGRIND valgrind
probe CFG_OCAMLC ocamlc
probe CFG_OCAMLOPT ocamlopt
probe CFG_OCAMLC_OPT ocamlc.opt
probe CFG_OCAMLOPT_OPT ocamlopt.opt
Expand All @@ -215,6 +216,10 @@ then
--version \
| grep version \
| cut -d ' ' -f 5-)
CFG_LLVM_TRIPLE=$("$CFG_LLVM_BINDIR/llc" \
--version \
| grep Host: \
| cut -d ' ' -f 4-)
elif [ ! -z "$CFG_LLVM_CONFIG" ]
then
CFG_LLVM_VERSION=$(llvm-config --version)
Expand All @@ -224,6 +229,7 @@ then
CFG_LLVM_CXXFLAGS=$(llvm-config --cxxflags)
CFG_LLVM_LDFLAGS=$(llvm-config --ldflags)
CFG_LLVM_LIBS=$(llvm-config --libs)
CFG_LLVM_TRIPLE=$(llvm-config --host-target)
else
err "either the \"CFG_LLVM_ROOT\" environment variable must be set, or a \
\"llvm-config\" script must be present"
Expand All @@ -244,6 +250,7 @@ putvar CFG_LLVM_LIBDIR
putvar CFG_LLVM_CXXFLAGS
putvar CFG_LLVM_LDFLAGS
putvar CFG_LLVM_LIBS
putvar CFG_LLVM_TRIPLE

# Munge any paths that appear in config.mk back to posix-y
perl -i.bak -p -e 's@ ([a-zA-Z]):[/\\]@ /\1/@go;' \
Expand Down
19 changes: 19 additions & 0 deletions mk/intrinsics.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
######################################################################
# intrinsics.bc rules
######################################################################

# TODO: Use clang to compile the C++.
INTRINSICS_LL_IN := $(S)src/rt/intrinsics/intrinsics.ll.in
INTRINSICS_LL := intrinsics/intrinsics.ll
INTRINSICS_BC := intrinsics/intrinsics.bc

$(INTRINSICS_LL): $(INTRINSICS_LL_IN) $(MKFILES)
@$(call E, mkdir: intrinsics)
$(Q)mkdir -p intrinsics
@$(call E, sed: $@)
$(Q)sed s/@CFG_LLVM_TRIPLE@/$(CFG_LLVM_TRIPLE)/g $< > $@

$(INTRINSICS_BC): $(INTRINSICS_LL) $(MKFILES)
@$(call E, llvm-as: $@)
$(Q)$(LLVM_AS) -o $@ $<

6 changes: 6 additions & 0 deletions mk/stage0.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ stage0/glue.o: stage0/rustc$(X)

stage0/$(CFG_STDLIB): stage0/rustc$(X)
$(Q)touch $@

# TODO: Include as part of the snapshot.
stage0/intrinsics.bc: $(INTRINSICS_BC)
@$(call E, cp: $@)
$(Q)cp $< $@

10 changes: 8 additions & 2 deletions mk/stage1.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
stage1/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) \
stage0/rustc$(X) stage0/$(CFG_STDLIB) $(LREQ) $(MKFILES)
stage0/rustc$(X) stage0/$(CFG_STDLIB) stage0/intrinsics.bc \
$(LREQ) $(MKFILES)
@$(call E, compile: $@)
$(STAGE0) -c --shared -o $@ $<

Expand All @@ -12,10 +13,15 @@ stage1/rustc.o: $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ0)
@$(call E, compile: $@)
$(STAGE0) -c -o $@ $<

stage1/glue.o: stage0/rustc$(X) stage0/$(CFG_STDLIB) $(LREQ) $(MKFILES)
stage1/glue.o: stage0/rustc$(X) stage0/$(CFG_STDLIB) stage0/intrinsics.bc \
$(LREQ) $(MKFILES)
@$(call E, generate: $@)
$(STAGE0) -c -o $@ --glue

stage1/intrinsics.bc: $(INTRINSICS_BC)
@$(call E, cp: $@)
$(Q)cp $< $@

# Due to make not wanting to run the same implicit rules twice on the same
# rule tree (implicit-rule recursion prevention, see "Chains of Implicit
# Rules" in GNU Make manual) we have to re-state the %.o and %.s patterns here
Expand Down
11 changes: 8 additions & 3 deletions mk/stage2.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
stage2/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) stage1/rustc$(X) $(MKFILES)
stage2/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) stage1/rustc$(X) \
stage1/intrinsics.bc $(MKFILES)
@$(call E, compile: $@)
$(STAGE1) -c --shared -o $@ $<

Expand All @@ -11,11 +12,15 @@ stage2/rustc.o: $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ1)
@$(call E, compile: $@)
$(STAGE1) -c -o $@ $<

stage2/glue.o: stage1/rustc$(X) stage1/$(CFG_STDLIB) \
rustllvm/$(CFG_RUSTLLVM) rt/$(CFG_RUNTIME)
stage2/glue.o: stage1/rustc$(X) stage1/$(CFG_STDLIB) stage1/intrinsics.bc \
rustllvm/$(CFG_RUSTLLVM) rt/$(CFG_RUNTIME)
@$(call E, generate: $@)
$(STAGE1) -c -o $@ --glue

stage2/intrinsics.bc: $(INTRINSICS_BC)
@$(call E, cp: $@)
$(Q)cp $< $@

# Due to make not wanting to run the same implicit rules twice on the same
# rule tree (implicit-rule recursion prevention, see "Chains of Implicit
# Rules" in GNU Make manual) we have to re-state the %.o and %.s patterns here
Expand Down
9 changes: 7 additions & 2 deletions mk/stage3.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
stage3/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) stage2/rustc$(X) $(MKFILES)
stage3/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) stage2/rustc$(X) \
stage2/intrinsics.bc $(MKFILES)
@$(call E, compile: $@)
$(STAGE2) -c --shared -o $@ $<

Expand All @@ -11,11 +12,15 @@ stage3/rustc.o: $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ2)
@$(call E, compile: $@)
$(STAGE2) -c -o $@ $<

stage3/glue.o: stage2/rustc$(X) stage2/$(CFG_STDLIB) \
stage3/glue.o: stage2/rustc$(X) stage2/$(CFG_STDLIB) stage2/intrinsics.bc \
rustllvm/$(CFG_RUSTLLVM) rt/$(CFG_RUNTIME)
@$(call E, generate: $@)
$(STAGE2) -c -o $@ --glue

stage3/intrinsics.bc: $(INTRINSICS_BC)
@$(call E, cp: $@)
$(Q)cp $< $@

# Due to make not wanting to run the same implicit rules twice on the same
# rule tree (implicit-rule recursion prevention, see "Chains of Implicit
# Rules" in GNU Make manual) we have to re-state the %.o and %.s patterns here
Expand Down
19 changes: 18 additions & 1 deletion mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,27 @@ ALL_TEST_SOURCES = $(TEST_CFAIL_SOURCES_STAGE0) \
unexport RUST_LOG


check_nocompile: $(TEST_CFAIL_OUTS_STAGE0) \
check-nocompile: $(TEST_CFAIL_OUTS_STAGE0) \
$(TEST_CFAIL_OUTS_STAGE1) \
$(TEST_CFAIL_OUTS_STAGE2)

check-stage0: tidy \
$(TEST_RPASS_EXES_STAGE0) $(TEST_RFAIL_EXES_STAGE0) \
$(TEST_RPASS_OUTS_STAGE0) $(TEST_RFAIL_OUTS_STAGE0) \
$(TEST_CFAIL_OUTS_STAGE0) \


check-stage1: tidy \
$(TEST_RPASS_EXES_STAGE1) $(TEST_RFAIL_EXES_STAGE1) \
$(TEST_RPASS_OUTS_STAGE1) $(TEST_RFAIL_OUTS_STAGE1) \
$(TEST_CFAIL_OUTS_STAGE1) \


check-stage2: tidy \
$(TEST_RPASS_EXES_STAGE2) $(TEST_RFAIL_EXES_STAGE2) \
$(TEST_RPASS_OUTS_STAGE2) $(TEST_RFAIL_OUTS_STAGE2) \
$(TEST_CFAIL_OUTS_STAGE2) \


check: tidy \
$(TEST_RPASS_EXES_STAGE0) $(TEST_RFAIL_EXES_STAGE0) \
Expand Down
Loading