Skip to content

Commit

Permalink
Update makefile to make extraction cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
Ailrun committed Dec 25, 2023
1 parent c8c79c2 commit c5cbc52
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
with:
ocaml-compiler: ${{ env.OCAML_VER }}
dune-cache: true
cache-prefix: "v2"
- name: install Menhir and Coq
run: |
opam update
Expand Down
3 changes: 1 addition & 2 deletions theories/Frontend/ParserExtraction.v
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ Require Import ExtrOcamlBasic.
Require Import ExtrOcamlNatInt.
Require Import ExtrOcamlNativeString.

(* Meant to be run in this directory *)
Extraction "../driver/parser.ml" Parser.prog.
Extraction "parser.ml" Parser.prog.
15 changes: 15 additions & 0 deletions theories/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ empty :=
space := $(empty) $(empty)

COQMAKEFILE := makefile.coq
PARSERBASE := parser.ml
PARSERFILE := ../driver/$(PARSERBASE)
PARSEREXTRACTIONDIR := Frontend
PARSEREXTRACTIONCOQFILE := $(PARSEREXTRACTIONDIR)/ParserExtraction.v
PARSEREXTRACTIONRESULTFILE := $(PARSEREXTRACTIONDIR)/$(PARSERBASE)
COQPARSERFILE := $(patsubst %.vy,%.v,$(shell find ./ -name '*.vy'))
COQFILES := $(sort $(shell find ./ -name '*.v') $(COQPARSERFILE))

Expand All @@ -11,6 +16,12 @@ all: $(COQMAKEFILE)
-include $(COQMAKEFILE)

clean::
rm -f $(PARSERBASE)
rm -f $(patsubst %.ml,%.mli,$(PARSERBASE))
rm -f $(PARSERFILE)
rm -f $(patsubst %.ml,%.mli,$(PARSERFILE))
rm -f $(PARSEREXTRACTIONRESULTFILE)
rm -f $(patsubst %.ml,%.mli,$(PARSEREXTRACTIONRESULTFILE))
rm -f $(COQMAKEFILE)
rm -f $(COQMAKEFILE).conf

Expand All @@ -20,6 +31,10 @@ $(COQPARSERFILE): %.v : %.vy
$(COQMAKEFILE): _CoqProject
coq_makefile -f _CoqProject -o "$@"

$(PARSERFILE): $(PARSEREXTRACTIONCOQFILE)
make -B "$(patsubst %.v,%.vo,$?)"
mv "$(PARSERBASE)" "$(PARSERFILE)"

.PHONY: update_CoqProject
update_CoqProject: cleanall
(echo "-R . Mcltt"; \
Expand Down

0 comments on commit c5cbc52

Please sign in to comment.