Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
./*-autogen.cddl
./exports/coev.cddl ./*-autogen.cddl
11 changes: 3 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)))
2 changes: 2 additions & 0 deletions exports/ce.cddl → exports/coev.cddl
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
37 changes: 31 additions & 6 deletions funcs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
19 changes: 13 additions & 6 deletions imports/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down