From 3d1a2ee24442f9fe2078a60526eeb913fc59e12a Mon Sep 17 00:00:00 2001 From: eug-vs Date: Thu, 21 Apr 2022 16:06:49 +0300 Subject: feat: add serve target --- Makefile | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 8712bf6..0aada0c 100644 --- a/Makefile +++ b/Makefile @@ -2,13 +2,14 @@ BASE_URL=https://example.com -CONVERT=pandoc --from=gfm+emoji --to=html --section-divs +CONVERT=pandoc --from=gfm+emoji --to=html --section-divs --shift-heading-level-by=1 PAGE_TEMPLATE=templates/page.html OPENRING_TEMPLATE=templates/openring.html RSS_TEMPLATE=templates/rss.xml RSS_ITEM_TEMPLATE=templates/rss_item.xml RSS=out/blog/index.xml +PUBLIC=out/public OPENRING_FOOTER=tmp/openring.html OPENRING_ARGS=-s https://eug-vs.xyz/blog/index.xml -s https://drewdevault.com/blog/index.xml @@ -21,10 +22,10 @@ HTML=$(patsubst src/%.md, out/%.html, $(SOURCES)) BLOG_XML=$(patsubst src/%.md, tmp/%.xml, $(BLOG_SOURCES)) -.PHONY: clean all +.PHONY: clean all serve .SECONDARY: $(TMP_HTML) $(BLOG_XML) -all: $(HTML) $(RSS) +all: $(HTML) $(RSS) $(PUBLIC) out/%.html: tmp/%.content.html tmp/%.meta.title $(PAGE_TEMPLATE) $(OPENRING_FOOTER) @mkdir -p $(@D) @@ -36,7 +37,7 @@ out/%.html: tmp/%.content.html tmp/%.meta.title $(PAGE_TEMPLATE) $(OPENRING_FOOT tmp/%.content.html: src/%.md @mkdir -p $(@D) - $(CONVERT) $< > $@ + sed "s/.md)/.html)/g" $< | $(CONVERT) > $@ tmp/%.meta.title: src/%.md @mkdir -p $(@D) @@ -59,5 +60,12 @@ $(OPENRING_FOOTER): $(OPENRING_TEMPLATE) @mkdir -p $(@D) openring $(OPENRING_ARGS) < $< > $@ +# TODO: this is dumb +$(PUBLIC): src/public + cp -r $< $@ + +serve: $(HTML) + quark -h 127.0.0.1 -p 8000 -d out -l + clean: - rm -rf tmp out + rm -rf tmp out/* -- cgit v1.2.3