File: dune

package info (click to toggle)
menhir 20201216-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,056 kB
  • sloc: ml: 23,365; makefile: 181; sh: 95; lisp: 8
file content (24 lines) | stat: -rw-r--r-- 842 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
;; Note: the library MenhirLib is not built here; it is built in lib/pack.

;; These rules generate the module [StaticVersion]. This module defines a
;; value of type [unit] whose name is [require_XXXXXXXX], where [XXXXXXXX]
;; is our 8-digit version number. This number is set in the [dune-project]
;; file.

;; When the [--table] switch is passed, Menhir produces a reference to
;; [MenhirLib.StaticVersion.require_XXXXXXXX] in the generated code. This
;; ensures that the generated code can be linked only with an appropriate
;; version of MenhirLib. This is important because we use unsafe casts: a
;; version mismatch could cause a crash.

(rule
  (with-stdout-to StaticVersion.mli
    (echo "val require_%{version:menhir}: unit\n")
  )
)

(rule
  (with-stdout-to StaticVersion.ml
    (echo "let require_%{version:menhir} = ()\n")
  )
)