From c5326296d6ba921444f6d9ff582bb249ec901800 Mon Sep 17 00:00:00 2001 From: nedmsmith Date: Fri, 11 Apr 2025 13:55:44 -0700 Subject: [PATCH 1/5] 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 From bb94217ed1cbea2bcb6e54a7798a06b5bb5af4dd Mon Sep 17 00:00:00 2001 From: Ned Smith Date: Mon, 14 Apr 2025 09:06:44 -0700 Subject: [PATCH 2/5] Update funcs.mk Co-authored-by: Thomas Fossati --- funcs.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/funcs.mk b/funcs.mk index 628c6af..c062e0a 100644 --- a/funcs.mk +++ b/funcs.mk @@ -69,6 +69,5 @@ $(1).cddl: } .PHONY: get-$(1) -.PHONY: $(1).cddl endef # get_cddl_release \ No newline at end of file From beb67ad78cb172c175563c321edcb7da2a33f242 Mon Sep 17 00:00:00 2001 From: Ned Smith Date: Mon, 14 Apr 2025 09:07:12 -0700 Subject: [PATCH 3/5] Update funcs.mk Co-authored-by: Thomas Fossati --- funcs.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/funcs.mk b/funcs.mk index c062e0a..6cfae4b 100644 --- a/funcs.mk +++ b/funcs.mk @@ -64,8 +64,7 @@ get-$(1): $(1).cddl $(1).cddl: @{ \ $$(curl) -LO $$(join $(2), $$(join $(3), $$(join $(4)/, $$@))); \ - grep -v '^@\.start\.@' $$@ > $$@.tmp; \ - mv $$@.tmp $$@; \ + sed -i.bak 's/^@\.start\.@//' $$@; \ } .PHONY: get-$(1) From 7371a28f8ef03f42c5c777e29d63ab32e8b68be2 Mon Sep 17 00:00:00 2001 From: Ned Smith Date: Mon, 14 Apr 2025 09:07:43 -0700 Subject: [PATCH 4/5] Update imports/Makefile Co-authored-by: Thomas Fossati --- imports/Makefile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/imports/Makefile b/imports/Makefile index 3f94dbd..8bdc3eb 100644 --- a/imports/Makefile +++ b/imports/Makefile @@ -14,13 +14,6 @@ CORIM_DL := draft-ietf-rats-corim/releases/download/ CORIM_TAG := cddl-8c267cd $(eval $(call get_cddl_release,$(CORIM),$(CORIM_REPO),$(CORIM_DL),$(CORIM_TAG))) -# 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 From ef1c4d0a5dbd30daa339672527f2674eb6dc2a9c Mon Sep 17 00:00:00 2001 From: Ned Smith Date: Mon, 14 Apr 2025 09:08:04 -0700 Subject: [PATCH 5/5] Update funcs.mk Co-authored-by: Thomas Fossati --- funcs.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/funcs.mk b/funcs.mk index 6cfae4b..fea7d45 100644 --- a/funcs.mk +++ b/funcs.mk @@ -68,5 +68,5 @@ $(1).cddl: } .PHONY: get-$(1) - +CLEANFILES += $(1).cddl.bak endef # get_cddl_release \ No newline at end of file