Skip to content

Commit b274ea5

Browse files
authored
Merge pull request ocaml#12843 from dra27/gnu-make-4-4-1
Improve "undefined Makefile variables" warning and fix it for GNU make 4.4.1
2 parents 2f1416b + dd9ae91 commit b274ea5

3 files changed

Lines changed: 25 additions & 8 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ USE_STDLIB = -nostdlib -I ../stdlib
604604
FLEXDLL_OBJECTS = \
605605
flexdll_$(FLEXDLL_CHAIN).$(O) flexdll_initer_$(FLEXDLL_CHAIN).$(O)
606606
FLEXLINK_BUILD_ENV = \
607+
MSVCC_ROOT= \
607608
MSVC_DETECT=0 OCAML_CONFIG_FILE=../Makefile.config \
608609
CHAINS=$(FLEXDLL_CHAIN) ROOTDIR=..
609610
FLEXDLL_SOURCES = \
@@ -655,8 +656,7 @@ boot/ocamlrun$(EXE):
655656
# Start up the system from the distribution compiler
656657
.PHONY: coldstart
657658
coldstart: boot/ocamlrun$(EXE) runtime/libcamlrun.$(A)
658-
$(MAKE) -C stdlib OCAMLRUN='$$(ROOTDIR)/$<' \
659-
CAMLC='$$(BOOT_OCAMLC) $(USE_RUNTIME_PRIMS)' all
659+
$(MAKE) -C stdlib OCAMLRUN='$$(ROOTDIR)/$<' USE_BOOT_OCAMLC=true all
660660
rm -f $(addprefix boot/, libcamlrun.$(A) $(LIBFILES))
661661
cp $(addprefix stdlib/, $(LIBFILES)) boot
662662
cd boot; $(LN) ../runtime/libcamlrun.$(A) .

stdlib/Makefile

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,26 @@ include $(ROOTDIR)/Makefile.common
2323

2424
TARGET_BINDIR ?= $(BINDIR)
2525

26-
COMPILER=$(ROOTDIR)/ocamlc$(EXE)
27-
CAMLC=$(OCAMLRUN) $(COMPILER)
28-
COMPFLAGS=-strict-sequence -absname -w +a-4-9-41-42-44-45-48 \
29-
-g -warn-error +A -bin-annot -nostdlib -principal
26+
# There are three ways the Standard Library is compiled in bytecode:
27+
# 1. During coldstart
28+
# - using ../boot/ocamlc which runs on ../boot/ocamlrun
29+
# 2. During coreall (via library),
30+
# - using ../ocamlc which runs on ../boot/ocamlrun
31+
# 3. During coreboot (via library-cross),
32+
# - using ../ocamlc which at that point runs on ../runtime/ocamlrun
33+
# If $(USE_BOOT_OCAMLC) is non-empty, we select case 1 and use $(BOOT_OCAMLC).
34+
# Otherwise, we use $(OCAMLRUN) ../ocamlc, with $(OCAMLRUN) being
35+
# ../boot/ocamlrun by default, but able to overridden by library-cross to
36+
# ../runtime/ocamlrun.
37+
USE_BOOT_OCAMLC ?=
38+
39+
ifeq "$(USE_BOOT_OCAMLC)" ""
40+
CAMLC = $(OCAMLRUN) $(ROOTDIR)/ocamlc$(EXE)
41+
else
42+
CAMLC = $(BOOT_OCAMLC)
43+
endif
44+
COMPFLAGS = -strict-sequence -absname -w +a-4-9-41-42-44-45-48 \
45+
-g -warn-error +A -bin-annot -nostdlib -principal
3046
ifeq "$(FLAMBDA)" "true"
3147
OPTCOMPFLAGS += -O3
3248
endif
@@ -220,7 +236,7 @@ stdlib__%.cmx:
220236
-o $@ -c $(filter %.ml, $^)
221237

222238
# Dependencies on the compiler
223-
COMPILER_DEPS=$(filter-out -use-prims $(OCAMLRUN), $(CAMLC))
239+
COMPILER_DEPS=$(filter-out $(OCAMLRUN), $(CAMLC))
224240
$(OBJS) std_exit.cmo: $(COMPILER_DEPS)
225241
$(OBJS:.cmo=.cmi) std_exit.cmi: $(COMPILER_DEPS)
226242
$(OBJS:.cmo=.cmx) std_exit.cmx: $(OPTCOMPILER)

tools/ci/actions/runner.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ Build () {
5555
fi
5656
failed=0
5757
if grep -Fq ' warning: undefined variable ' build.log; then
58-
echo Undefined Makefile variables detected
58+
echo Undefined Makefile variables detected:
59+
grep -F ' warning: undefined variable ' build.log
5960
failed=1
6061
fi
6162
rm build.log

0 commit comments

Comments
 (0)