Skip to content

Commit ab0d947

Browse files
committed
Support the use of already-installed MenhirLib and Flocq libraries
configure flags -use-external-Flocq and -use external-MenhirLib.
1 parent b525fbe commit ab0d947

File tree

11 files changed

+82
-67
lines changed

11 files changed

+82
-67
lines changed

Makefile

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,19 @@ else
2727
ARCHDIRS=$(ARCH)_$(BITSIZE) $(ARCH)
2828
endif
2929

30-
DIRS=lib common $(ARCHDIRS) backend cfrontend driver \
31-
flocq/Core flocq/Prop flocq/Calc flocq/IEEE754 \
32-
exportclight MenhirLib cparser
30+
DIRS := lib common $(ARCHDIRS) backend cfrontend driver exportclight cparser
3331

34-
RECDIRS=lib common $(ARCHDIRS) backend cfrontend driver flocq exportclight \
35-
MenhirLib cparser
32+
COQINCLUDES := $(foreach d, $(DIRS), -R $(d) compcert.$(d))
3633

37-
COQINCLUDES=$(foreach d, $(RECDIRS), -R $(d) compcert.$(d))
34+
ifeq ($(LIBRARY_FLOCQ),local)
35+
DIRS += flocq/Core flocq/Prop flocq/Calc flocq/IEEE754
36+
COQINCLUDES += -R flocq Flocq
37+
endif
38+
39+
ifeq ($(LIBRARY_MENHIRLIB),local)
40+
DIRS += MenhirLib
41+
COQINCLUDES += -R MenhirLib MenhirLib
42+
endif
3843

3944
COQCOPTS ?= -w -undeclared-scope -w -omega-is-deprecated
4045
COQC="$(COQBIN)coqc" -q $(COQINCLUDES) $(COQCOPTS)
@@ -50,13 +55,17 @@ GPATH=$(DIRS)
5055

5156
# Flocq
5257

58+
ifeq ($(LIBRARY_FLOCQ),local)
5359
FLOCQ=\
5460
Raux.v Zaux.v Defs.v Digits.v Float_prop.v FIX.v FLT.v FLX.v FTZ.v \
5561
Generic_fmt.v Round_pred.v Round_NE.v Ulp.v Core.v \
5662
Bracket.v Div.v Operations.v Round.v Sqrt.v \
5763
Div_sqrt_error.v Mult_error.v Plus_error.v \
5864
Relative.v Sterbenz.v Round_odd.v Double_rounding.v \
5965
Binary.v Bits.v
66+
else
67+
FLOCQ=
68+
endif
6069

6170
# General-purpose libraries (in lib/)
6271

@@ -117,9 +126,13 @@ PARSER=Cabs.v Parser.v
117126

118127
# MenhirLib
119128

129+
ifeq ($(LIBRARY_MENHIRLIB),local)
120130
MENHIRLIB=Alphabet.v Automaton.v Grammar.v Interpreter_complete.v \
121131
Interpreter_correct.v Interpreter.v Main.v Validator_complete.v \
122132
Validator_safe.v Validator_classes.v
133+
else
134+
MENHIRLIB=
135+
endif
123136

124137
# Putting everything together (in driver/)
125138

@@ -259,7 +272,7 @@ driver/Version.ml: VERSION
259272

260273
cparser/Parser.v: cparser/Parser.vy
261274
@rm -f $@
262-
$(MENHIR) --coq --coq-lib-path compcert.MenhirLib --coq-no-version-check cparser/Parser.vy
275+
$(MENHIR) --coq --coq-no-version-check cparser/Parser.vy
263276
@chmod a-w $@
264277

265278
depend: $(GENERATED) depend1
@@ -318,6 +331,9 @@ check-proof: $(FILES)
318331
print-includes:
319332
@echo $(COQINCLUDES)
320333

334+
CoqProject:
335+
@echo $(COQINCLUDES) > _CoqProject
336+
321337
-include .depend
322338

323339
FORCE:

aarch64/Archi.v

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515

1616
(** Architecture-dependent parameters for AArch64 *)
1717

18+
From Flocq Require Import Binary Bits.
1819
Require Import ZArith List.
19-
(*From Flocq*)
20-
Require Import Binary Bits.
2120

2221
Definition ptr64 := true.
2322

arm/Archi.v

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616

1717
(** Architecture-dependent parameters for ARM *)
1818

19+
From Flocq Require Import Binary Bits.
1920
Require Import ZArith List.
20-
(*From Flocq*)
21-
Require Import Binary Bits.
2221

2322
Definition ptr64 := false.
2423

configure

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ clightgen=false
2727
install_coqdev=false
2828
responsefile="gnu"
2929
ignore_coq_version=false
30+
library_Flocq=local
31+
library_MenhirLib=local
3032

3133
usage='Usage: ./configure [options] target
3234
For help on options and targets, do: ./configure -help
@@ -84,6 +86,8 @@ Options:
8486
-libdir <dir> Install libraries in <dir>
8587
-coqdevdir <dir> Install Coq development (.vo files) in <dir>
8688
-toolprefix <pref> Prefix names of tools ("gcc", etc) with <pref>
89+
-use-external-Flocq Use an already-installed Flocq library
90+
-use-external-MenhirLib Use an already-installed MenhirLib library
8791
-no-runtime-lib Do not compile nor install the runtime support library
8892
-no-standard-headers Do not install nor use the standard .h headers
8993
-clightgen Also compile and install the clightgen tool
@@ -124,6 +128,10 @@ while : ; do
124128
ignore_coq_version=true;;
125129
-install-coqdev|--install-coqdev|-install-coq-dev|--install-coq-dev)
126130
install_coqdev=true;;
131+
-use-external-Flocq|--use-external-Flocq)
132+
library_Flocq=external;;
133+
-use-external-MenhirLib|--use-external-MenhirLib)
134+
library_MenhirLib=external;;
127135
-help|--help)
128136
echo "$help"; exit 0;;
129137
-*)
@@ -611,47 +619,6 @@ if $missingtools; then
611619
exit 2
612620
fi
613621

614-
cat > .merlin <<EOF
615-
S lib
616-
S common
617-
S $arch
618-
S backend
619-
S cfrontend
620-
S driver
621-
S debug
622-
S exportclight
623-
S cparser
624-
S extraction
625-
626-
B lib
627-
B common
628-
B $arch
629-
B backend
630-
B cfrontend
631-
B driver
632-
B debug
633-
B exportclight
634-
B cparser
635-
B extraction
636-
637-
EOF
638-
639-
echo "-R lib compcert.lib \
640-
-R common compcert.common \
641-
-R ${arch} compcert.${arch} \
642-
-R backend compcert.backend \
643-
-R cfrontend compcert.cfrontend \
644-
-R driver compcert.driver \
645-
-R flocq compcert.flocq \
646-
-R exportclight compcert.exportclight \
647-
-R cparser compcert.cparser \
648-
-R MenhirLib compcert.MenhirLib" > _CoqProject
649-
case $arch in
650-
x86)
651-
echo "-R x86_${bitsize} compcert.x86_${bitsize}" >> _CoqProject
652-
;;
653-
esac
654-
655622
#
656623
# Generate Makefile.config
657624
#
@@ -694,6 +661,8 @@ LIBMATH=$libmath
694661
MODEL=$model
695662
SYSTEM=$system
696663
RESPONSEFILE=$responsefile
664+
LIBRARY_FLOCQ=$library_Flocq
665+
LIBRARY_MENHIRLIB=$library_MenhirLib
697666
EOF
698667
else
699668
cat >> Makefile.config <<'EOF'
@@ -787,9 +756,41 @@ CLIGHTGEN=false
787756
# Whether the other tools support responsefiles in gnu syntax
788757
RESPONSEFILE="none"
789758
759+
# Whether to use the local copies of Flocq and MenhirLib
760+
LIBRARY_FLOCQ=local # external
761+
LIBRARY_MENHIRLIB=local # external
790762
EOF
791763
fi
792764

765+
#
766+
# Generate Merlin and CoqProject files to simplify development
767+
#
768+
cat > .merlin <<EOF
769+
S lib
770+
S common
771+
S $arch
772+
S backend
773+
S cfrontend
774+
S driver
775+
S debug
776+
S exportclight
777+
S cparser
778+
S extraction
779+
780+
B lib
781+
B common
782+
B $arch
783+
B backend
784+
B cfrontend
785+
B driver
786+
B debug
787+
B exportclight
788+
B cparser
789+
B extraction
790+
EOF
791+
792+
make CoqProject
793+
793794
#
794795
# Clean up target-dependent files to force their recompilation
795796
#
@@ -828,6 +829,8 @@ CompCert configuration:
828829
Math library.................. $libmath
829830
Build command to use.......... $make
830831
Menhir API library............ $menhir_dir
832+
The Flocq library............. $library_Flocq
833+
The MenhirLib library......... $library_MenhirLib
831834
Binaries installed in......... $bindirexp
832835
Runtime library provided...... $has_runtime_lib
833836
Library files installed in.... $libdirexp
@@ -846,4 +849,3 @@ EOF
846849
fi
847850

848851
fi
849-

lib/Floats.v

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
(** Formalization of floating-point numbers, using the Flocq library. *)
1818

1919
Require Import Coqlib Zbits Integers.
20-
(*From Flocq*)
21-
Require Import Binary Bits Core.
20+
From Flocq Require Import Binary Bits Core.
2221
Require Import IEEE754_extra.
2322
Require Import Program.
2423
Require Archi.

lib/IEEE754_extra.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
(** Additional operations and proofs about IEEE-754 binary
1818
floating-point numbers, on top of the Flocq library. *)
1919

20+
From Flocq Require Import Core Digits Operations Round Bracket Sterbenz
21+
Binary Round_odd.
2022
Require Import Psatz.
2123
Require Import Bool.
2224
Require Import Eqdep_dec.
23-
(*From Flocq *)
24-
Require Import Core Digits Operations Round Bracket Sterbenz Binary Round_odd.
2525

2626
Local Open Scope Z_scope.
2727

powerpc/Archi.v

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616

1717
(** Architecture-dependent parameters for PowerPC *)
1818

19+
From Flocq Require Import Binary Bits.
1920
Require Import ZArith List.
20-
(*From Flocq*)
21-
Require Import Binary Bits.
2221

2322
Definition ptr64 := false.
2423

riscV/Archi.v

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616

1717
(** Architecture-dependent parameters for RISC-V *)
1818

19+
From Flocq Require Import Binary Bits.
1920
Require Import ZArith List.
20-
(*From Flocq*)
21-
Require Import Binary Bits.
2221

2322
Parameter ptr64 : bool.
2423

test/clightgen/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ ARCHDIRS=$(ARCH)
55
else
66
ARCHDIRS=$(ARCH)_$(BITSIZE) $(ARCH)
77
endif
8-
RECDIRS=lib common $(ARCHDIRS) cfrontend flocq exportclight
9-
COQINCLUDES=$(foreach d, $(RECDIRS), -R ../../$(d) compcert.$(d))
8+
RECDIRS := lib common $(ARCHDIRS) cfrontend exportclight
9+
COQINCLUDES := $(foreach d, $(RECDIRS), -R ../../$(d) compcert.$(d))
10+
ifeq ($(LIBRARY_FLOCQ),local)
11+
COQINCLUDES += -R ../../flocq Flocq
12+
endif
13+
1014

1115
CLIGHTGEN=../../clightgen
1216
COQC=coqc

x86_32/Archi.v

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616

1717
(** Architecture-dependent parameters for x86 in 32-bit mode *)
1818

19+
From Flocq Require Import Binary Bits.
1920
Require Import ZArith List.
20-
(*From Flocq*)
21-
Require Import Binary Bits.
2221

2322
Definition ptr64 := false.
2423

0 commit comments

Comments
 (0)