-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (23 loc) · 865 Bytes
/
Makefile
File metadata and controls
30 lines (23 loc) · 865 Bytes
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
# Variables
SOURCE_DIR = drafts
BUILD_DIR = generated
SOURCES = $(wildcard $(SOURCE_DIR)/*.md)
# This creates a list of targets based on filenames in the drafts folder
TARGETS = $(patsubst $(SOURCE_DIR)/%.md, %, $(SOURCES))
.PHONY: all clean $(TARGETS)
all: $(TARGETS)
$(TARGETS):
@echo "-------------------------------------------------------"
@echo "Processing draft: $@"
@echo "-------------------------------------------------------"
# Create or refresh the specific output directory
rm -rf $(BUILD_DIR)/$@
mkdir -p $(BUILD_DIR)/$@
# Generate XML from Markdown
kramdown-rfc $(SOURCE_DIR)/$@.md > $(BUILD_DIR)/$@/$@.xml
# Generate Text and HTML from XML
xml2rfc $(BUILD_DIR)/$@/$@.xml --text --html --pdf --path $(BUILD_DIR)/$@/
@echo "Done! Files available in $(BUILD_DIR)/$@/"
clean:
rm -rf $(BUILD_DIR)
@echo "Cleaned generated files."