CCOPTS = --std=gnu99 -Wall -Werror -O2 .PHONY: src all: $(error Must specify a target (adoc, rst, or src)) validate: ifndef SRC $(error Variable SRC must be defined) endif ifndef DEST $(error Variable DEST must be defined) endif adoc: validate printf '

%s

\n' "$(shell head -n1 $(SRC))" > "$(DEST)" asciidoc -s \ -a sectlinks \ -b html5 \ -o - "$(SRC)" >> "$(DEST)" rst: validate rst2html5.py \ --initial-header-level=2 \ --cloak-email-addresses \ --template "res/rst_template.txt" "$(SRC)" "$(DEST)" printf '

Last edited: %s

\n' \ "$(shell date '+%F %T %Z')" >> "$(DEST)" md: validate cmark --to html "$(SRC)" > "$(DEST)" printf '

Last edited: %s

\n' \ "$(shell date '+%F %T %Z')" >> "$(DEST)" src: if [ ! -d obj ]; then mkdir obj; fi cc $(CCOPTS) src/common.c -c -o obj/common.o cc $(CCOPTS) src/cgi.c -c -o obj/cgi.o cc $(CCOPTS) src/j2.c -c -o obj/j2.o cc $(CCOPTS) src/main.c obj/*.o -o index test: src if [ ! -d tests/obj ]; then mkdir tests/obj; fi cc $(CCOPTS) tests/assert.c -c -o tests/obj/assert.o cc $(CCOPTS) obj/*.o tests/obj/*.o tests/main.c -o tests/runtests tests/runtests clean: if [ -d obj ]; then rm -r obj/*; fi rm -f index