From 3a6c9b41a3248a2c6f2c1a6131c34de0d70b793b Mon Sep 17 00:00:00 2001 From: Tiago Oliveira Date: Wed, 26 Jun 2024 07:05:27 +0100 Subject: [PATCH] sct: towards jasmin-ct (2) --- src/Makefile | 7 +++---- src/Makefile.checksct | 24 +++++++++++++++++++----- src/Makefile.common | 2 -- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/Makefile b/src/Makefile index 80e48e29..27d7314d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -24,7 +24,7 @@ SRC := . FILTER ?= $(SRC)/crypto_% JAZZ ?= $(filter $(FILTER), $(filter-out $(addprefix ./,$(EXCLUDE)), $(sort $(dir $(shell find $(SRC) -name '*.jazz'))))) SAFETY ?= $(addsuffix safety, $(JAZZ)) -SCT ?= $(addsuffix sct, $(JAZZ)) +SCT ?= $(addsuffix check_sct, $(JAZZ)) SOURCES ?= $(filter-out ./, $(sort $(dir $(shell find $(SRC) -name 'Makefile')))) ASM := $(shell find $(SRC) -name '*.s') @@ -74,9 +74,8 @@ $(SAFETY): $(MAKE) -C $(@D) $(@F) || true # -------------------------------------------------------------------- - -.PHONY: sct -sct: $(SCT) +.PHONY: check_sct +check_sct: $(SCT) $(SCT): $(MAKE) -C $(@D) $(@F) || true diff --git a/src/Makefile.checksct b/src/Makefile.checksct index d2a2ce09..2168ccfb 100644 --- a/src/Makefile.checksct +++ b/src/Makefile.checksct @@ -3,27 +3,41 @@ # functions # - it is meant to be included by Makefile.common +# JASMIN_CT belongs here (and not Makefile.common): some options differ from jasminc +JASMIN_CT ?= jasmin-ct + ifneq ($(OP),) -# TODO: remove --infer +# TODO: remove --infer and annotate exported functions SCT_FLAGS ?= --infer -CHECK_SCT_SLICE = ($(JASMIN_CT) $(JINCLUDE) -slice $* --sct $(SCT_FLAGS) $< > $@ 2>&1) $(CIT) -CHECK_SCT = ($(JASMIN_CT) $(JINCLUDE) --sct $(SCT_FLAGS) $< > $@ 2>&1) $(CIT) +CHECK_SCT_SLICE = (JASMINPATH="Jade=$(SRC)" $(JASMIN_CT) --slice $* --sct $(SCT_FLAGS) $< > $@ 2>&1) $(CIT) +CHECK_SCT_SLICE_STDOUT = (JASMINPATH="Jade=$(SRC)" $(JASMIN_CT) --slice $* --sct $(SCT_FLAGS) $< ) $(CIT) + +CHECK_SCT = (JASMINPATH="Jade=$(SRC)" $(JASMIN_CT) --sct $(SCT_FLAGS) $< > $@ 2>&1) $(CIT) +CHECK_SCT_STDOUT = (JASMINPATH="Jade=$(SRC)" $(JASMIN_CT) --sct $(SCT_FLAGS) $< ) $(CIT) -SCT_TARGETS = $(addsuffix .sct, $(FUNCTIONS)) +SCT_TARGETS = $(addsuffix .sct, $(FUNCTIONS)) +SCT_TARGETS_STDOUT = $(addsuffix .stdout, $(SCT_TARGETS)) -sct: $(SCT_TARGETS) +check_sct: $(SCT_TARGETS) $(OP).sct : $(OP).jazz $(DEPS_DIR)/$(OP).sct.d | $(DEPS_DIR) $(CI_DIR) $(DEPS) $(CHECK_SCT) +$(OP).sct.stdout : $(OP).jazz | $(CI_DIR) + $(CHECK_SCT_STDOUT) + $(SCT_TARGETS): %.sct : $(OP).jazz $(DEPS_DIR)/%.sct.d | $(DEPS_DIR) $(CI_DIR) $(DEPS) $(CHECK_SCT_SLICE) +$(SCT_TARGETS_STDOUT): +%.sct.stdout : $(OP).jazz | $(CI_DIR) + $(CHECK_SCT_SLICE_STDOUT) + DEPFILES := \ $(DEPFILES) \ $(addprefix $(DEPS_DIR)/, $(addsuffix .sct.d, $(FUNCTIONS) $(OP))) diff --git a/src/Makefile.common b/src/Makefile.common index 0606c32d..9b1b272f 100644 --- a/src/Makefile.common +++ b/src/Makefile.common @@ -40,8 +40,6 @@ JASMIN ?= jasminc JASMINC := $(JASMIN) $(JFLAGS) $(JINCLUDE) COMPILE = ($(JASMINC) -o $@ $<) $(CIT) -JASMIN_CT ?= jasmin-ct - # -------------------------------------------------------------------- include $(SRC)/$(OPERATION)/EcFlags.mk