Skip to content

Commit 0ec25a9

Browse files
nikswamyCopilot
andcommitted
Centralize toolchain detection in config.mk; fix BFS postcondition order
Two fixes: 1. Build system: All 22 chapter Makefiles and autoclrs/Makefile now include a shared autoclrs/config.mk that detects binary install (fstar/) vs source build (FStar/) using absolute paths. This eliminates stale .checked files from PULSE_ROOT path mismatches when switching between top-level and standalone chapter builds. 2. BFS.Impl.fst: Reorder postcondition conjuncts (optimality before complexity) to match the .fsti interface, fixing a subtyping failure with F* 2026.04.17. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 27538c0 commit 0ec25a9

26 files changed

Lines changed: 56 additions & 92 deletions

File tree

autoclrs/Makefile

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,11 @@
44
# make # verify all chapters
55
# make -j8 # parallel build
66

7-
# Detect binary install (fstar/) vs source build (FStar/)
8-
ifneq ($(wildcard $(CURDIR)/../fstar/bin/fstar.exe),)
9-
PULSE_ROOT ?= $(CURDIR)/../fstar/pulse
10-
ifndef FSTAR_EXE
11-
FSTAR_EXE := $(CURDIR)/../fstar/bin/fstar.exe
12-
endif
13-
KRML_HOME ?= $(CURDIR)/../fstar/karamel
14-
else
15-
PULSE_ROOT ?= ../FStar/pulse
16-
ifndef FSTAR_EXE
17-
FSTAR_EXE := $(CURDIR)/../FStar/out/bin/fstar.exe
18-
endif
19-
endif
20-
STAGE3 ?= 1
7+
include config.mk
218
export STAGE3
229
export FSTAR_EXE
2310
export PULSE_ROOT
24-
ifdef KRML_HOME
2511
export KRML_HOME
26-
endif
2712

2813
SUBDIRS += ch02-getting-started
2914
SUBDIRS += ch04-divide-conquer

autoclrs/ch02-getting-started/Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
PULSE_ROOT ?= ../../FStar/pulse
2-
STAGE3 ?= 1
3-
export STAGE3
4-
KRML_HOME ?= ../../FStar/karamel
1+
include ../config.mk
52
OTHERFLAGS += --include ../common
63
include $(PULSE_ROOT)/mk/test.mk
74

autoclrs/ch04-divide-conquer/Makefile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
PULSE_ROOT ?= ../../FStar/pulse
2-
STAGE3 ?= 1
3-
export STAGE3
4-
ifndef FSTAR_EXE
5-
FSTAR_EXE := $(realpath ../../FStar/out/bin/fstar.exe)
6-
endif
7-
export FSTAR_EXE
8-
9-
KRML_HOME ?= ../../FStar/karamel
1+
include ../config.mk
102
KRML_EXE ?= $(KRML_HOME)/krml
11-
123
include $(PULSE_ROOT)/mk/test.mk
134

145
# ── C extraction and test targets ───────────────────────────────────────

autoclrs/ch06-heapsort/Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
PULSE_ROOT ?= ../../FStar/pulse
2-
STAGE3 ?= 1
3-
KRML_HOME ?= ../../FStar/karamel
4-
export STAGE3
1+
include ../config.mk
52
include $(PULSE_ROOT)/mk/test.mk
63

74
# ── C extraction and test targets ──────────────────────────────────────

autoclrs/ch07-quicksort/Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
PULSE_ROOT ?= ../../FStar/pulse
2-
KRML_HOME ?= ../../FStar/karamel
3-
STAGE3 ?= 1
4-
export STAGE3
1+
include ../config.mk
52
OTHERFLAGS += --include ../common
63
include $(PULSE_ROOT)/mk/test.mk
74

autoclrs/ch08-linear-sorting/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
PULSE_ROOT ?= ../../FStar/pulse
2-
KRML_HOME ?= ../../FStar/karamel
1+
include ../config.mk
32
KRML_EXE ?= $(KRML_HOME)/krml
4-
STAGE3 ?= 1
53
include $(PULSE_ROOT)/mk/test.mk
64

75
# ── C extraction and test targets ──────────────────────────────────

autoclrs/ch09-order-statistics/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
PULSE_ROOT ?= ../../FStar/pulse
2-
KRML_HOME ?= ../../FStar/karamel
1+
include ../config.mk
32
include $(PULSE_ROOT)/mk/test.mk
43
OTHERFLAGS += --include ../common
54

autoclrs/ch10-elementary-ds/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
PULSE_ROOT ?= ../../FStar/pulse
2-
KRML_HOME ?= ../../FStar/karamel
1+
include ../config.mk
32
include $(PULSE_ROOT)/mk/test.mk
43
OTHERFLAGS += --include ../common
54

autoclrs/ch11-hash-tables/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
PULSE_ROOT ?= ../../FStar/pulse
2-
KRML_HOME ?= ../../FStar/karamel
1+
include ../config.mk
32
include $(PULSE_ROOT)/mk/test.mk
43

54
# ── C extraction and test targets ──────────────────────────────────

autoclrs/ch12-bst/Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
PULSE_ROOT ?= ../../FStar/pulse
2-
KRML_HOME ?= ../../FStar/karamel
3-
STAGE3 ?= 1
4-
export STAGE3
1+
include ../config.mk
52
include $(PULSE_ROOT)/mk/test.mk
63

74
# ── C extraction and test for Chapter 12 BSTs ──────────────────────

0 commit comments

Comments
 (0)