Skip to content

Commit 4828766

Browse files
author
Ned Smith
authored
Merge pull request #53 from TrustedComputingGroup/nms/import-releases
macro for getting imports
2 parents 9e27430 + ef1c4d0 commit 4828766

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

funcs.mk

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,23 @@ $(3)$(1).cddl: $(2)
5050

5151
CLEANFILES += $(3)$(1).cddl
5252

53-
endef # cddl_exp_template
53+
endef # cddl_exp_template
54+
55+
# $(1) - imported cddl file name without .cddl
56+
# $(2) - github url
57+
# $(3) - download location
58+
# $(4) - cddl-xxxx tag name
59+
define get_cddl_release
60+
61+
get-$(1): $(1).cddl
62+
echo "Fetched cddl-release: " $$^
63+
64+
$(1).cddl:
65+
@{ \
66+
$$(curl) -LO $$(join $(2), $$(join $(3), $$(join $(4)/, $$@))); \
67+
sed -i.bak 's/^@\.start\.@//' $$@; \
68+
}
69+
70+
.PHONY: get-$(1)
71+
CLEANFILES += $(1).cddl.bak
72+
endef # get_cddl_release

imports/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ SHELL := /bin/bash
55
include ../tools.mk
66
include ../funcs.mk
77

8-
check:: corim-autogen.cddl
8+
check:: get-corim-autogen
99

1010
# Get corim-autogen.cddl
11-
github := https://github.com/ietf-rats-wg/
12-
corim_rel_dl := draft-ietf-rats-corim/releases/download/
13-
corim_tag := cddl-8c267cd
14-
corim_url := $(join $(github), $(join $(corim_rel_dl), $(corim_tag)))
11+
CORIM := corim-autogen
12+
CORIM_REPO := https://github.com/ietf-rats-wg/
13+
CORIM_DL := draft-ietf-rats-corim/releases/download/
14+
CORIM_TAG := cddl-8c267cd
15+
$(eval $(call get_cddl_release,$(CORIM),$(CORIM_REPO),$(CORIM_DL),$(CORIM_TAG)))
1516

16-
corim-autogen.cddl: ; $(curl) -LO $(corim_url)/$@ ; grep -v '^@\.start\.@' $@ > $@.tmp ; mv $@.tmp $@
1717

1818
CLEANFILES += corim-autogen.cddl
1919

0 commit comments

Comments
 (0)