Skip to content

Commit c532629

Browse files
author
nedmsmith
committed
macro for getting imports
1 parent 312ab44 commit c532629

2 files changed

Lines changed: 35 additions & 7 deletions

File tree

funcs.mk

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,25 @@ $(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+
grep -v '^@\.start\.@' $$@ > $$@.tmp; \
68+
mv $$@.tmp $$@; \
69+
}
70+
71+
.PHONY: get-$(1)
72+
.PHONY: $(1).cddl
73+
74+
endef # get_cddl_release

imports/Makefile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,22 @@ 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 $@
17+
# Get corim-autogen.cddl
18+
#github := https://github.com/ietf-rats-wg/
19+
#corim_rel_dl := draft-ietf-rats-corim/releases/download/
20+
#corim_tag := cddl-8c267cd
21+
#corim_url := $(join $(github), $(join $(corim_rel_dl), $(corim_tag)))
22+
23+
#corim-autogen.cddl: ; $(curl) -LO $(corim_url)/$@ ; grep -v '^@\.start\.@' $@ > [email protected] ; mv [email protected] $@
1724

1825
CLEANFILES += corim-autogen.cddl
1926

0 commit comments

Comments
 (0)