@@ -12,6 +12,7 @@ GHCFLAGS?= # -XStrict
12
12
CFLAGS? =
13
13
14
14
CARGO_BUILD := cargo build
15
+ ZIG_BUILD := zig build
15
16
16
17
SKIP_BEDROCK2? =
17
18
@@ -30,17 +31,17 @@ INSTALLDEFAULTROOT := Crypto
30
31
install-standalone install-standalone-ocaml install-standalone-haskell \
31
32
uninstall-standalone uninstall-standalone-ocaml uninstall-standalone-haskell \
32
33
util all-except-generated \
33
- c-files bedrock2-files rust-files go-files json-files java-files generated-files \
34
- lite-c-files lite-bedrock2-files lite-rust-files lite-go-files lite-json-files lite-java-files lite-generated-files \
34
+ c-files bedrock2-files rust-files go-files json-files java-files zig-files generated-files \
35
+ lite-c-files lite-bedrock2-files lite-rust-files lite-go-files lite-json-files lite-java-files lite-zig-files lite- generated-files \
35
36
bedrock2-backend \
36
37
update-go-pkg-cache \
37
38
deps \
38
39
nobigmem print-nobigmem \
39
40
lite only-heavy printlite \
40
41
all-except-compiled \
41
42
some-early pre-standalone pre-standalone-extracted standalone standalone-haskell standalone-ocaml \
42
- test-c-files test-bedrock2-files test-rust-files test-go-files test-json-files test-java-files \
43
- only-test-c-files only-test-bedrock2-files only-test-rust-files only-test-go-files only-test-json-files only-test-java-files \
43
+ test-c-files test-bedrock2-files test-rust-files test-go-files test-json-files test-java-files test-zig-files \
44
+ only-test-c-files only-test-bedrock2-files only-test-rust-files only-test-go-files only-test-json-files only-test-java-files only-test-zig-files \
44
45
test-go-module only-test-go-module \
45
46
javadoc only-javadoc \
46
47
check-output accept-output
@@ -140,6 +141,7 @@ GO_DIR := fiat-go/
140
141
JSON_DIR := fiat-json/src/
141
142
JAVA_DIR := fiat-java/src/
142
143
JAVADOC_DIR := fiat-java/doc/
144
+ ZIG_DIR := fiat-zig/src/
143
145
144
146
# Java only really supports 32-bit builds, because we have neither 64x64->64x64 multiplication, nor uint128
145
147
# Java also requires that class names match file names
@@ -218,13 +220,15 @@ ALL_RUST_FILES := $(patsubst %,$(RUST_DIR)%.rs,$(ALL_BASE_FILES))
218
220
ALL_GO_FILES := $(patsubst % ,$(GO_DIR ) % .go,$(call GO_RENAME_TO_FILE,$(filter-out $(BASE_FILES_NEEDING_INT128 ) ,$(ALL_BASE_FILES ) ) ) )
219
221
ALL_JSON_FILES := $(patsubst % ,$(JSON_DIR ) % .json,$(ALL_BASE_FILES ) )
220
222
ALL_JAVA_FILES := $(patsubst % ,$(JAVA_DIR ) % .java,$(call JAVA_RENAME,$(filter-out $(BASE_FILES_NEEDING_INT128 ) ,$(ALL_BASE_FILES ) ) ) )
223
+ ALL_ZIG_FILES := $(patsubst % ,$(ZIG_DIR ) % .zig,$(ALL_BASE_FILES ) )
221
224
222
225
LITE_C_FILES := $(patsubst % ,$(C_DIR ) % .c,$(LITE_BASE_FILES ) )
223
226
LITE_BEDROCK2_FILES := $(patsubst % ,$(BEDROCK2_DIR ) % .c,$(filter-out $(BASE_FILES_NEEDING_INT128 ) ,$(LITE_BASE_FILES ) ) )
224
227
LITE_RUST_FILES := $(patsubst % ,$(RUST_DIR ) % .rs,$(LITE_BASE_FILES ) )
225
228
LITE_GO_FILES := $(patsubst % ,$(GO_DIR ) % .go,$(call GO_RENAME_TO_FILE,$(filter-out $(BASE_FILES_NEEDING_INT128 ) ,$(LITE_BASE_FILES ) ) ) )
226
229
LITE_JSON_FILES := $(patsubst % ,$(JSON_DIR ) % .json,$(LITE_BASE_FILES ) )
227
230
LITE_JAVA_FILES := $(patsubst % ,$(JAVA_DIR ) % .java,$(call JAVA_RENAME,$(filter-out $(BASE_FILES_NEEDING_INT128 ) ,$(LITE_BASE_FILES ) ) ) )
231
+ LITE_ZIG_FILES := $(patsubst % ,$(ZIG_DIR ) % .zig,$(LITE_BASE_FILES ) )
228
232
229
233
BEDROCK2_UNSATURATED_SOLINAS := src/ExtractionOCaml/bedrock2_unsaturated_solinas
230
234
BEDROCK2_WORD_BY_WORD_MONTGOMERY := src/ExtractionOCaml/bedrock2_word_by_word_montgomery
@@ -273,8 +277,8 @@ endif
273
277
CHECK_OUTPUTS := $(addprefix check-,$(OUTPUT_PREOUTS ) )
274
278
ACCEPT_OUTPUTS := $(addprefix accept-,$(OUTPUT_PREOUTS ) )
275
279
276
- generated-files : c-files rust-files go-files json-files java-files
277
- lite-generated-files : lite-c-files lite-rust-files lite-go-files lite-json-files lite-java-files
280
+ generated-files : c-files rust-files go-files json-files java-files zig-files
281
+ lite-generated-files : lite-c-files lite-rust-files lite-go-files lite-json-files lite-java-files lite-zig-files
278
282
all-except-compiled : coq pre-standalone-extracted check-output
279
283
all-except-generated : standalone-ocaml perf-standalone all-except-compiled
280
284
all : all-except-generated generated-files
@@ -291,13 +295,15 @@ rust-files: $(ALL_RUST_FILES)
291
295
go-files : $(ALL_GO_FILES )
292
296
json-files : $(ALL_JSON_FILES )
293
297
java-files : $(ALL_JAVA_FILES )
298
+ zig-files : $(ALL_ZIG_FILES )
294
299
295
300
lite-c-files : $(LITE_C_FILES )
296
301
lite-bedrock2-files : $(LITE_BEDROCK2_FILES )
297
302
lite-rust-files : $(LITE_RUST_FILES )
298
303
lite-go-files : $(LITE_GO_FILES )
299
304
lite-json-files : $(LITE_JSON_FILES )
300
305
lite-java-files : $(LITE_JAVA_FILES )
306
+ lite-zig-files : $(LITE_ZIG_FILES )
301
307
302
308
lite : $(LITE_VOFILES )
303
309
nobigmem : $(NOBIGMEM_VOFILES )
@@ -537,6 +543,17 @@ test-rust-files: $(ALL_RUST_FILES)
537
543
test-rust-files only-test-rust-files :
538
544
cd fiat-rust; $(CARGO_BUILD )
539
545
546
+ $(ALL_ZIG_FILES ) : $(ZIG_DIR ) % .zig : $$($$($$* _BINARY_NAME) )
547
+ $(SHOW ) ' SYNTHESIZE > $@'
548
+ $(HIDE ) rm -f $@ .ok
549
+ $(HIDE ) ($( TIMER) $( $( $* _BINARY_NAME) ) --lang Zig --internal-static --public-function-case camelCase --private-function-case camelCase $( $* _DESCRIPTION) $( $* _ARGS) $( $* _FUNCTIONS) && touch $@ .ok) > $@ .tmp
550
+ $(HIDE ) (rm $@ .ok && mv $@ .tmp $@ ) || ( RV=$$ ? ; cat $@ .tmp; exit $$ RV )
551
+
552
+ test-zig-files : $(ALL_ZIG_FILES )
553
+
554
+ test-zig-files only-test-zig-files :
555
+ cd fiat-zig; $(ZIG_BUILD )
556
+
540
557
all : $(addprefix fiat-rust/,$(COPY_TO_FIAT_RUST ) )
541
558
all : $(addprefix fiat-go/,$(COPY_TO_FIAT_GO ) )
542
559
0 commit comments