-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMakefile
69 lines (51 loc) · 1.96 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
SHELL := /bin/bash
LIBDIR := lib
include $(LIBDIR)/main.mk
$(LIBDIR)/main.mk:
ifneq (,$(shell grep "path *= *$(LIBDIR)" .gitmodules 2>/dev/null))
git submodule sync
git submodule update $(CLONE_ARGS) --init
else
git clone -q --depth 10 $(CLONE_ARGS) \
-b main https://github.com/martinthomson/i-d-template $(LIBDIR)
endif
#include cddl/tools.mk
include cddl/CDDL-FRAGS.mk
# The list of files that have CDDL fragments from which the comments were removed
NC_COMMON_CDDL_FRAGS := $(addprefix nc-cddl/,$(DOCUMENT_COMMON_CDDL_FRAGS))
NC_CBOR_CDDL_FRAGS := $(addprefix nc-cddl/,$(CBOR_SPECIFIC_CDDL_FRAGS))
NC_JSON_CDDL_FRAGS := $(addprefix nc-cddl/,$(JSON_SPECIFIC_CDDL_FRAGS))
# Make targets that get put in the document
# (Also the individual COMMON_CDDL_FRAGS go into the document)
NC_COMMON_CDDL_FOR_DOCUMENT := nc-cddl/common.cddl
NC_CBOR_CDDL_FOR_DOCUMENT := nc-cddl/cbor.cddl
NC_JSON_CDDL_FOR_DOCUMENT := nc-cddl/json.cddl
CLEANFILES += $(NC_COMMON_CDDL_FRAGS)
CLEANFILES += $(NC_CBOR_CDDL_FRAGS)
CLEANFILES += $(NC_JSON_CDDL_FRAGS)
draft-ietf-rats-eat.md: $(NC_COMMON_CDDL_FRAGS) \
$(NC_COMMON_CDDL_FOR_DOCUMENT) \
$(NC_CBOR_CDDL_FOR_DOCUMENT) \
$(NC_JSON_CDDL_FOR_DOCUMENT)
# Rule to build CDDL files without CDDL comments
# This also turns the unassigned integer labels in to "TBD"
# Remove these substitutions when they are no longer TBD.
nc-cddl/%.cddl: cddl/%.cddl
mkdir -p nc-cddl
sed 's/;.*//' $< | \
cat -s > $@
$(NC_COMMON_CDDL_FOR_DOCUMENT): $(NC_COMMON_CDDL_FRAGS)
@for f in $^ ; do \
( cat $$f ; echo ) ; \
done > $@
$(NC_CBOR_CDDL_FOR_DOCUMENT): $(NC_CBOR_CDDL_FRAGS)
@for f in $^ ; do \
( cat $$f ; echo ) ; \
done > $@
$(NC_JSON_CDDL_FOR_DOCUMENT): $(NC_JSON_CDDL_FRAGS)
@for f in $^ ; do \
( cat $$f ; echo ) ; \
done > $@
# TODO: re-enable examples checking as some point
#.PHONY: examples
#examples: ; $(MAKE) -C cddl check-examples