-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build with dune #212
Build with dune #212
Changes from 12 commits
21d59dd
977c5e7
c1aebd4
ab4cac4
94913e4
e151bfe
d123962
e923c07
5048cd9
addf91f
005c3ce
6df4e93
f815223
beacaa3
14eaa69
85c5dcb
895a077
0d32469
30c24bb
7eb9fa3
69a40f1
f8a67bc
704f38b
5379b45
05ebb4d
0601a57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,12 @@ | |
|
||
all: verify-all compile-all | ||
|
||
extra: | ||
+dune build | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
where I initially anticipated
Thanks again for chiming in! |
||
|
||
.PHONY: all verify-all compile-all extra | ||
|
||
|
||
################################################################################ | ||
# Verification & extraction # | ||
################################################################################ | ||
|
@@ -52,15 +58,18 @@ ROOTS = $(wildcard *.fst) $(wildcard *.fsti) $(wildcard ../runtime/*.fst) \ | |
FStar.HyperStack.IO.fst FStar.IO.fst FStar.Int.Cast.Full.fst \ | ||
FStar.Bytes.fsti FStar.Dyn.fsti LowStar.Printf.fst LowStar.Endianness.fst | ||
|
||
.PHONY: clean clean-c | ||
clean: clean-c | ||
.PHONY: clean clean-c clean-ml | ||
clean: clean-c clean-ml | ||
rm -rf *.checked *.source .depend | ||
|
||
SHELL:=$(shell which bash) | ||
|
||
clean-c: | ||
rm -rf dist out extract-all */*.o | ||
|
||
clean-ml: | ||
dune clean | ||
|
||
ifndef NODEPEND | ||
ifndef MAKE_RESTARTS | ||
.depend: .FORCE obj | ||
|
@@ -108,7 +117,7 @@ $(GENERIC_DIR): | |
mkdir -p $@ | ||
|
||
# Everything in the universe | ||
$(GENERIC_DIR)/Makefile.include: $(ALL_KRML_FILES) | $(GENERIC_DIR) $(wildcard c/*.c) $(wildcard c/*.h) ../_build/src/Karamel.native | ||
$(GENERIC_DIR)/Makefile.include: $(ALL_KRML_FILES) | $(GENERIC_DIR) $(wildcard c/*.c) $(wildcard c/*.h) ../src/_build/default/Karamel.exe | ||
../krml $(KRML_ARGS) -tmpdir $(GENERIC_DIR) \ | ||
-warn-error +9+11 \ | ||
$(MACHINE_INTS) \ | ||
|
@@ -123,7 +132,7 @@ $(GENERIC_DIR)/Makefile.include: $(ALL_KRML_FILES) | $(GENERIC_DIR) $(wildcard c | |
cp c/*.c c/*.h $(dir $@) | ||
|
||
# Minimalistic build (just machine integers and endianness) | ||
$(MINI_DIR)/Makefile.include: $(ALL_KRML_FILES) | $(MINI_DIR) $(wildcard c/fstar_uint128*.h) ../_build/src/Karamel.native | ||
$(MINI_DIR)/Makefile.include: $(ALL_KRML_FILES) | $(MINI_DIR) $(wildcard c/fstar_uint128*.h) ../src/_build/default/Karamel.exe | ||
mkdir -p $(dir $@) | ||
KRML_HOME=$(shell pwd)/.. \ | ||
../krml $(KRML_ARGS) -tmpdir $(MINI_DIR) \ | ||
|
@@ -144,8 +153,7 @@ $(MINI_DIR)/Makefile.include: $(ALL_KRML_FILES) | $(MINI_DIR) $(wildcard c/fstar | |
# Extracted (and verified) uint128s; copied into generic and minimal. Note that | ||
# FStar.UInt64 shares the same bundle name, meaning that | ||
# FStar_UInt128_Verified.h can be dropped in any of the two krmllibs above. | ||
$(UINT128_DIR)/Makefile.include: $(ALL_KRML_FILES) | $(GENERIC_DIR) $(MINI_DIR) ../_build/src/Karamel.native | ||
KRML_HOME=$(shell pwd)/.. \ | ||
$(UINT128_DIR)/Makefile.include: $(ALL_KRML_FILES) | $(GENERIC_DIR) $(MINI_DIR) ../src/_build/default/Karamel.exe | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any reason for removing KRML_HOME when it's present in the other recipe above? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is probably an overlook, let me restore that. Thanks! |
||
../krml $(KRML_ARGS) -tmpdir $(UINT128_DIR) \ | ||
$(addprefix -add-include ,'<inttypes.h>' '<stdbool.h>' '"krml/internal/types.h"' '"krml/internal/target.h"') \ | ||
-bundle FStar.UInt64[rename=FStar_UInt_8_16_32_64] \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(library | ||
(name krmllib) | ||
(libraries | ||
fstar.lib) | ||
(wrapped false) | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(lang dune 2.0) | ||
(name krmllib) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
all: | ||
+dune build | ||
|
||
clean: | ||
dune clean | ||
|
||
.PHONY: all clean |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(include_subdirs unqualified) | ||
|
||
(executable | ||
(name Karamel) | ||
(libraries | ||
ppx_deriving.std | ||
ppx_deriving_yojson | ||
zarith | ||
pprint | ||
unix | ||
menhirLib | ||
sedlex | ||
process | ||
fix | ||
wasm | ||
visitors.ppx | ||
visitors.runtime | ||
sedlex.ppx | ||
) | ||
(preprocess | ||
(pps ppx_deriving.std ppx_deriving_yojson sedlex.ppx visitors.ppx) | ||
) | ||
(flags (:standard -warn-error -A -w @[email protected]@[email protected]@31..38-39-40-41@43@57)) | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(lang dune 2.0) | ||
(name karamel) | ||
(using menhir 2.0) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(menhir | ||
(modules KParser) | ||
(flags --explain --dump) | ||
(infer true) | ||
) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
(executable | ||
(name Client) | ||
(libraries | ||
Ctypes1_stubs | ||
Lowlevel_bindings | ||
Lowlevel_stubs | ||
Ctypes2_bindings | ||
Ctypes2_stubs | ||
Client_foreign | ||
) | ||
(link_flags "-linkall") | ||
(modes (byte exe) (native exe)) | ||
(flags (:standard -w -32-33)) | ||
) | ||
|
||
(library | ||
(name Client_foreign) | ||
(modules) | ||
(wrapped false) | ||
(foreign_stubs (language c) (names Lowlevel Ctypes1 Ctypes2 Lowlevel_c_stubs Ctypes1_c_stubs Ctypes2_c_stubs) (include_dirs %{env:KRML_HOME=../../..}/include %{env:KRML_HOME=../../..}/krmllib/dist/generic internal %{env:CTYPES_LIB_DIR=.})) | ||
) | ||
|
||
(rule | ||
(target Ctypes1_c_stubs.c) | ||
(deps lib/Ctypes1_c_stubs.c) | ||
(action (copy %{deps} %{target})) | ||
) | ||
|
||
(rule | ||
(target Lowlevel_c_stubs.c) | ||
(deps lib/Lowlevel_c_stubs.c) | ||
(action (copy %{deps} %{target})) | ||
) | ||
|
||
(rule | ||
(target Ctypes2_c_stubs.c) | ||
(deps lib/Ctypes2_c_stubs.c) | ||
(action (copy %{deps} %{target})) | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(lang dune 3.2) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
(library | ||
(name Ctypes1_bindings) | ||
(wrapped false) | ||
(libraries | ||
ctypes | ||
) | ||
(modules Ctypes1_bindings) | ||
(flags (:standard -w -A)) | ||
) | ||
|
||
(library | ||
(name Lowlevel_bindings) | ||
(wrapped false) | ||
(libraries | ||
ctypes | ||
Ctypes1_bindings | ||
Ctypes1_stubs | ||
) | ||
(modules Lowlevel_bindings) | ||
(flags (:standard -w -A)) | ||
) | ||
|
||
(library | ||
(name Ctypes2_bindings) | ||
(wrapped false) | ||
(modules Ctypes2_bindings) | ||
(libraries | ||
Ctypes1_bindings | ||
Ctypes1_stubs | ||
) | ||
(flags (:standard -w -A)) | ||
) | ||
|
||
(library | ||
(name Lowlevel_stubs) | ||
(wrapped false) | ||
(modules Lowlevel_stubs) | ||
(libraries | ||
ctypes.stubs | ||
) | ||
) | ||
|
||
(library | ||
(name Ctypes1_stubs) | ||
(wrapped false) | ||
(modules Ctypes1_stubs) | ||
(libraries | ||
ctypes.stubs | ||
) | ||
) | ||
|
||
(library | ||
(name Ctypes2_stubs) | ||
(wrapped false) | ||
(modules Ctypes2_stubs) | ||
(libraries | ||
ctypes.stubs | ||
) | ||
) | ||
|
||
(rule | ||
(targets Ctypes1_stubs.ml Ctypes1_c_stubs.c) | ||
(deps ../lib_gen/Ctypes1_gen.exe) | ||
(action (chdir .. (run %{dep:../lib_gen/Ctypes1_gen.exe}))) | ||
) | ||
|
||
(rule | ||
(targets Lowlevel_stubs.ml Lowlevel_c_stubs.c) | ||
(deps ../lib_gen/Lowlevel_gen.exe) | ||
(action (chdir .. (run %{dep:../lib_gen/Lowlevel_gen.exe}))) | ||
) | ||
|
||
(rule | ||
(targets Ctypes2_stubs.ml Ctypes2_c_stubs.c) | ||
(deps ../lib_gen/Ctypes2_gen.exe) | ||
(action (chdir .. (run %{dep:../lib_gen/Ctypes2_gen.exe}))) | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
(executable | ||
(name Ctypes1_gen) | ||
(modules Ctypes1_gen) | ||
(libraries | ||
ctypes.stubs | ||
Ctypes1_bindings | ||
) | ||
(link_flags "-linkall") | ||
) | ||
|
||
(executable | ||
(name Lowlevel_gen) | ||
(modules Lowlevel_gen) | ||
(libraries | ||
ctypes.stubs | ||
Lowlevel_bindings | ||
) | ||
(link_flags "-linkall") | ||
) | ||
|
||
(executable | ||
(name Ctypes2_gen) | ||
(modules Ctypes2_gen) | ||
(libraries | ||
ctypes.stubs | ||
Ctypes2_bindings | ||
) | ||
(link_flags "-linkall") | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the GNU make manual, "5.7.1 How the MAKE Variable Works":
Is there a reason why you added these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I can remove this redundant
+
for clarity, thanks for pointing out!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, f3fac5a introduced
+$(MAKE)
for the test rule, but it was keeping a pre-existing+
, so I could remove it from there as well