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..6bc0eda 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,12 +70,7 @@ $(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 - -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 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..628c6af 100644 --- a/funcs.mk +++ b/funcs.mk @@ -31,19 +31,44 @@ 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 +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 41b9d7f..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)/$@ +# 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