# -*- Makefile -*- dir := doc/rst2man prerst2man := python $(dir)/prerst2man.py $(dir)/.. $(dir) %.1 :%.rst rst2man $< > $@ %.5 :%.rst rst2man $< > $@ %.7: %.rst rst2man $< > $@ # actual source files RST1SRC := $(wildcard doc/man1/*.rst) RST5SRC := $(wildcard doc/man5/*.rst) RST7SRC := $(wildcard doc/man7/*.rst) RST2MAN1SRC := $(patsubst doc/man1/%,doc/rst2man/man1/%,$(RST1SRC)) RST2MAN5SRC := $(patsubst doc/man5/%,doc/rst2man/man5/%,$(RST5SRC)) RST2MAN7SRC := $(patsubst doc/man7/%,doc/rst2man/man7/%,$(RST7SRC)) RST2MANSRC := ${RST2MAN1SRC} ${RST2MAN5SRC} ${RST2MAN7SRC} MAN1SRC := $(patsubst $(dir)/man1/%.rst,$(dir)/man1/%.1,${RST2MAN1SRC}) MAN5SRC := $(patsubst $(dir)/man5/%.rst,$(dir)/man5/%.5,${RST2MAN5SRC}) MAN7SRC := $(patsubst $(dir)/man7/%.rst,$(dir)/man7/%.7,${RST2MAN7SRC}) MANSRC := ${MAN1SRC} ${MAN5SRC} ${MAN7SRC} rst2man: ${MANSRC} ${RST2MANSRC}: ${RSTSRC} mkdir -p doc/rst2man/man1 doc/rst2man/man5 doc/rst2man/man7 $(prerst2man) CLEAN := ${CLEAN} ${RST2MANSRC} ${MANSRC}