summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 12 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index 8f656a9..5eba701 100644
--- a/Makefile
+++ b/Makefile
@@ -1,41 +1,35 @@
-GEMTEXT=$(shell find -L site -type f -name "*.gmi" -print)
-HTML=$(GEMTEXT:%.gmi=%.html)
+.POSIX:
+
+CFLAGS = -O3 -std=c99 -Wall -pedantic -pedantic-errors -pipe
+
RSS=$(shell find -L . -type d -name "*.rss" -print)
RSS_XML=$(RSS:%.rss=%.xml)
.PHONY: clean
.PHONY: all
-all: $(HTML) $(RSS_XML)
-
-%.html: %.gmi header.html footer.html gmi2html
- @echo "GMI2HTML $@"
- cp header.html $@
- ./gmi2html < $< | sed -e 's/\.gmi/\.html/g ; /^<h2>.*/i </div><div class="content">' >> $@
- echo "</div>" >> $@
- cat footer.html >> $@
+all: $(RSS_XML)
-%.xml: %.rss %.rss.header.xml %.rss.item_header.xml rss_item_footer.xml rss_footer.xml
+%.xml: %.rss %.rss.header.xml %.rss.item_header.xml rss_item_footer.xml rss_footer.xml gmi2html.cgi
@echo "RSS $@"
cat $<.header.xml > $@
for i in $(shell ls -r $</*.gmi | head -n 15) ; do \
cat $<.item_header.xml >> $@; \
echo "<title>`sed -n '/^# .*/p' $$i | cut -c 3-`</title>" >> $@; \
echo "<pubDate>`basename $$i | head -c8 | xargs date '+%a, %d %b %Y' -d`</pubDate>" >> $@; \
- echo "<link>https://leagueh.xyz/$$i</link>" | sed 's/site\///g ; s/.gmi/.html/g' >> $@; \
- echo "<description>`./gmi2html < $$i | sed '/^#.*/d ; s/</\&lt;/g ; s/>/\&gt;/g '`</description>" >> $@; \
+ echo "<link>https://leagueh.xyz/$$i</link>" | sed 's/site\///g' >> $@; \
+ echo "<description>`REQUEST_METHOD=GET PATH_INFO=$$i ./gmi2html.cgi | tail -n +4 | sed '/^#.*/d ; s/</\&lt;/g ; s/>/\&gt;/g'`</description>" >> $@; \
cat rss_item_footer.xml >> $@; \
done
cat rss_footer.xml >> $@
-gmi2html: gmi2html.c
+gmi2html.cgi: gmi2html.cgi.c
@echo "CC $@"
- $(CC) $(CFLAGS) $^ -o $@
+ $(CC) $(CFLAGS) -o $@ $^
.PHONY: clean
clean:
- rm -f gmi2html
- rm -f ${HTML}
- rm -f ${RSS_XML}
+ rm -f gmi2html.cgi
+ rm -f $(RSS_XML)
$(V).SILENT: