From d88416259b106ea3b3c9da88847f0c83e50ed83a Mon Sep 17 00:00:00 2001 From: nedmsmith Date: Thu, 10 Apr 2025 16:01:56 -0700 Subject: [PATCH 1/3] improve releases Created exports dir with coev.cddl that doesn't include dependent cddl files. added filter to remove @.start.@ from imported cddl files. Added exports directory to cddl-releases. --- .github/workflows/makefile.yml | 2 +- Makefile | 6 +++--- exports/{ce.cddl => coev.cddl} | 2 ++ funcs.mk | 14 +++++++++----- imports/Makefile | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) rename exports/{ce.cddl => coev.cddl} (97%) diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index 4664c92..986405b 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -22,4 +22,4 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} files: | - ./*-autogen.cddl + ./exports/coev.cddl ./*-autogen.cddl diff --git a/Makefile b/Makefile index 18745c3..205a68d 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ check:: check-eat check-eat-examples check:: check-comidx check-comidx-examples check:: check-spdm check-spdm-examples check:: check-ce check-ce-examples -check:: exp-ce +check:: exp-coev include $(CE_DIR)ce-frags.mk CE_DEPS := $(addprefix $(CE_DIR), $(CE_FRAGS)) @@ -70,8 +70,8 @@ $(IMPORT_DEPS): check-imports check-imports: $(MAKE) -C $(IMPORTS_DIR) -# Make ce.cddl export file -$(eval $(call cddl_exp_template,ce,$(CE_DEPS))) +# Make coev.cddl export file - used by cddl-releases +$(eval $(call cddl_exp_template,coev,$(CE_DEPS),$(EXPORTS_DIR),$(IMPORT_FRAGS))) clean: ; rm -f $(CLEANFILES); $(MAKE) -C $(IMPORTS_DIR) clean diff --git a/exports/ce.cddl b/exports/coev.cddl similarity index 97% rename from exports/ce.cddl rename to exports/coev.cddl index 2d0010c..b1a4143 100644 --- a/exports/ce.cddl +++ b/exports/coev.cddl @@ -1,3 +1,5 @@ +; This cddl file depends on these cddl files: corim-autogen.cddl + spdm-toc = spdm-toc-map / tagged-spdm-toc tagged-spdm-toc = #6.570(spdm-toc-map) diff --git a/funcs.mk b/funcs.mk index 107a6f4..075e900 100644 --- a/funcs.mk +++ b/funcs.mk @@ -31,19 +31,23 @@ CLEANFILES += $(3:.diag=.pretty) endef # cddl_check_template +# $(1) - export label +# $(2) - cddl fragments +# $(3) - export directory +# $(4) - import dependencies define cddl_exp_template -exp-$(1): $(EXPORTS_DIR)$(1).cddl +exp-$(1): $(3)$(1).cddl echo ">>> Creating exportable cddl file" ; .PHONY: exp-$(1) -$(EXPORTS_DIR)$(1).cddl: $(2) - +$(3)$(1).cddl: $(2) + echo -e "; This cddl file depends on these cddl files: "$(4)"\n" > $$@ @for f in $$^ ; do \ ( grep -v '^;' $$$$f ; echo ) ; \ - done > $$@ + done >> $$@ -CLEANFILES += $(EXPORTS_DIR)$(1).cddl +CLEANFILES += $(3)$(1).cddl endef # cddl_exp_template \ No newline at end of file diff --git a/imports/Makefile b/imports/Makefile index 41b9d7f..7878793 100644 --- a/imports/Makefile +++ b/imports/Makefile @@ -13,7 +13,7 @@ corim_rel_dl := draft-ietf-rats-corim/releases/download/ corim_tag := cddl-8c267cd corim_url := $(join $(github), $(join $(corim_rel_dl), $(corim_tag))) -corim-autogen.cddl: ; $(curl) -LO $(corim_url)/$@ +corim-autogen.cddl: ; $(curl) -LO $(corim_url)/$@ ; grep -v '^@\.start\.@' $@ > $@.tmp ; mv $@.tmp $@ CLEANFILES += corim-autogen.cddl From 312ab449b38304f3b5a335db3b178b94a33c92e0 Mon Sep 17 00:00:00 2001 From: nedmsmith Date: Thu, 10 Apr 2025 16:06:05 -0700 Subject: [PATCH 2/3] Update Makefile remove stale make target --- Makefile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Makefile b/Makefile index 205a68d..6bc0eda 100644 --- a/Makefile +++ b/Makefile @@ -74,8 +74,3 @@ check-imports: $(eval $(call cddl_exp_template,coev,$(CE_DEPS),$(EXPORTS_DIR),$(IMPORT_FRAGS))) clean: ; rm -f $(CLEANFILES); $(MAKE) -C $(IMPORTS_DIR) clean - -exce: ce-autogen.cddl - @echo -n "copying ce.cddl to exports" - # @cp $(CE_DIR)/ce-autogen.cddl exports/ce.cddl - $(eval $(call cddl_exports_template, exports/ce, $(CE_DEPS))) \ No newline at end of file From c5326296d6ba921444f6d9ff582bb249ec901800 Mon Sep 17 00:00:00 2001 From: nedmsmith Date: Fri, 11 Apr 2025 13:55:44 -0700 Subject: [PATCH 3/3] macro for getting imports --- funcs.mk | 23 ++++++++++++++++++++++- imports/Makefile | 19 +++++++++++++------ 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/funcs.mk b/funcs.mk index 075e900..628c6af 100644 --- a/funcs.mk +++ b/funcs.mk @@ -50,4 +50,25 @@ $(3)$(1).cddl: $(2) CLEANFILES += $(3)$(1).cddl -endef # cddl_exp_template \ No newline at end of file +endef # cddl_exp_template + +# $(1) - imported cddl file name without .cddl +# $(2) - github url +# $(3) - download location +# $(4) - cddl-xxxx tag name +define get_cddl_release + +get-$(1): $(1).cddl + echo "Fetched cddl-release: " $$^ + +$(1).cddl: + @{ \ + $$(curl) -LO $$(join $(2), $$(join $(3), $$(join $(4)/, $$@))); \ + grep -v '^@\.start\.@' $$@ > $$@.tmp; \ + mv $$@.tmp $$@; \ + } + +.PHONY: get-$(1) +.PHONY: $(1).cddl + +endef # get_cddl_release \ No newline at end of file diff --git a/imports/Makefile b/imports/Makefile index 7878793..3f94dbd 100644 --- a/imports/Makefile +++ b/imports/Makefile @@ -5,15 +5,22 @@ SHELL := /bin/bash include ../tools.mk include ../funcs.mk -check:: corim-autogen.cddl +check:: get-corim-autogen # Get corim-autogen.cddl -github := https://github.com/ietf-rats-wg/ -corim_rel_dl := draft-ietf-rats-corim/releases/download/ -corim_tag := cddl-8c267cd -corim_url := $(join $(github), $(join $(corim_rel_dl), $(corim_tag))) +CORIM := corim-autogen +CORIM_REPO := https://github.com/ietf-rats-wg/ +CORIM_DL := draft-ietf-rats-corim/releases/download/ +CORIM_TAG := cddl-8c267cd +$(eval $(call get_cddl_release,$(CORIM),$(CORIM_REPO),$(CORIM_DL),$(CORIM_TAG))) -corim-autogen.cddl: ; $(curl) -LO $(corim_url)/$@ ; grep -v '^@\.start\.@' $@ > $@.tmp ; mv $@.tmp $@ +# Get corim-autogen.cddl +#github := https://github.com/ietf-rats-wg/ +#corim_rel_dl := draft-ietf-rats-corim/releases/download/ +#corim_tag := cddl-8c267cd +#corim_url := $(join $(github), $(join $(corim_rel_dl), $(corim_tag))) + +#corim-autogen.cddl: ; $(curl) -LO $(corim_url)/$@ ; grep -v '^@\.start\.@' $@ > $@.tmp ; mv $@.tmp $@ CLEANFILES += corim-autogen.cddl