DESTDIR		= ..
SOURCES		= $(wildcard *.raw)
TEMPLATES	= $(shell find . -name \*.tmpl -printf "%P\n" | sort)
DESTS			= $(addprefix $(DESTDIR)/, $(SOURCES:.raw=.html))
DEPS			= $(SOURCES:.raw=.P)
WPP				= ../../wpp
DEBUG			= #-g
WPPFLAGS	= -x $(DEBUG) -f '../../htmlbeauty'

default: all


%.P: %.raw $(WPP)
	$(WPP) -d $< > $@

$(DESTDIR)/%.html: %.raw $(WPP)
	@$(WPP) $(WPPFLAGS) $<

all: $(DESTS)

clean:
	-rm -f $(DESTS)

cleandep:
	-rm -f $(DEPS)

distclean: clean cleandep

depend dep: $(DEPS)

force rebuild:
	$(WPP) $(WPPFLAGS) $(SOURCES)

manual_8.raw: manual_8.pl manual_8.txt
	manual_8.pl

ci:
	ci -l $(SOURCES) $(TEMPLATES) Makefile manual_8.txt manual_8.pl


-include $(DEPS)
