-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (46 loc) · 1.7 KB
/
Makefile
File metadata and controls
56 lines (46 loc) · 1.7 KB
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
# Define the base name of your draft (without extension)
DRAFT_NAME := draft-xia-ipsecme-eesp-stateless-encryption
# Define source and target files
MD_SOURCE := $(DRAFT_NAME).md
XML_TARGET := draft/$(DRAFT_NAME).xml
TXT_TARGET := draft/$(DRAFT_NAME).txt
HTML_TARGET := draft/$(DRAFT_NAME).html
# If you have PDF support installed for xml2rfc:
# PDF_TARGET := $(DRAFT_NAME).pdf
# Define commands for the converters
# kramdown-rfc is typically available as a Ruby gem
# sudo gem install kramdown-rfc
KRAMDOWN_RFC := kramdown-rfc
# xml2rfc is a Python package
# pip install xml2rfc
# For PDF support: pip install "xml2rfc[pdf]"
XML2RFC := xml2rfc
# Default target: build all common formats
all: $(TXT_TARGET) $(HTML_TARGET) # $(PDF_TARGET)
# Rule to convert Markdown to RFCXML
$(XML_TARGET): $(MD_SOURCE)
mkdir -p draft || true
@echo "Converting $(MD_SOURCE) to RFCXML ($(XML_TARGET))..."
$(KRAMDOWN_RFC) $< > $@
@echo "RFCXML conversion complete $@"
# Rule to convert RFCXML to TXT
$(TXT_TARGET): $(XML_TARGET)
@echo "Converting $(XML_TARGET) to TXT ($(TXT_TARGET))..."
$(XML2RFC) --text $< -o $@
@echo "TXT conversion complete."
# Rule to convert RFCXML to HTML
$(HTML_TARGET): $(XML_TARGET)
@echo "Converting $(XML_TARGET) to HTML ($(HTML_TARGET))..."
$(XML2RFC) --html $< -o $@
@echo "HTML conversion complete."
# Rule to convert RFCXML to PDF (uncomment if you have PDF setup)
# $(PDF_TARGET): $(XML_TARGET)
# @echo "Converting $(XML_TARGET) to PDF ($(PDF_TARGET))..."
# $(XML2RFC) --pdf $< -o $@
# @echo "PDF conversion complete."
# Clean up generated files
clean:
@echo "Cleaning up generated files..."
rm -f $(XML_TARGET) $(TXT_TARGET) $(HTML_TARGET) $(PDF_TARGET)
@echo "Clean up complete."
.PHONY: all clean