

LANGUAGE = english
# Adjust this (or create a symlink) to the location of your webml copy (if you have one)
WEBWML   = ~/debian/www/webwml/$(LANGUAGE)

FILES= \
bug-log-access.txt          bug-maint-mailcontrol.txt constitution.1.0.txt   \
bug-log-mailserver.txt      bug-reporting.txt         mailing-lists.txt      \
bug-mailserver-refcard.txt  constitution.txt          social-contract.txt    \
bug-maint-info.txt          constitution.1.1.txt      social-contract.1.0.txt \
constitution.1.2.txt        social-contract.txt 	  constitution.1.3.txt

all: $(FILES)

clean:
	-rm -f $(FILES) *.html 
realclean: clean
	-rm -f *.wml

%.html: %.wml
	wml -q $< >$@

%.txt: %.html
	lynx -dump -nolist $< >$@

# These rules are conditioned to the existence of $(WEBWML)
# so that the package can be built regardless of its existence
# Warning: hack
webwmlexists := $(shell ls -d $(WEBWML) 2>/dev/null)

ifneq "$(webwmlexists)" ""
bug-log-access.wml: $(WEBWML)/Bugs/Access.wml
	cat $<  |grep -v ^# >$@
bug-log-mailserver.wml: $(WEBWML)/Bugs/server-request.wml
	cat $<  |grep -v ^# >$@
bug-mailserver-refcard.wml: $(WEBWML)/Bugs/server-refcard.wml
	cat $<  |grep -v ^# >$@
bug-maint-info.wml: $(WEBWML)/Bugs/Developer.wml
	cat $<  |grep -v ^# >$@
bug-maint-mailcontrol.wml: $(WEBWML)/Bugs/server-control.wml
	cat $<  |grep -v ^# >$@
bug-reporting.wml: $(WEBWML)/Bugs/Reporting.wml
	cat $<  |grep -v ^# >$@
constitution.wml: $(WEBWML)/devel/constitution.wml
	cat $<  | perl -pe 's/<toc-add-entry /<h2><toc-add-entry /; s/toc-add-entry>/toc-add-entry><\/h2>/' | grep -v ^# >$@
constitution.1.3.wml: $(WEBWML)/devel/constitution.1.3.wml
	cat $<  |grep -v ^# >$@
constitution.1.2.wml: $(WEBWML)/devel/constitution.1.2.wml
	cat $<  |grep -v ^# >$@
constitution.1.1.wml: $(WEBWML)/devel/constitution.1.1.wml
	cat $<  |grep -v ^# >$@
constitution.1.0.wml: $(WEBWML)/devel/constitution.1.0.wml
	cat $<  |grep -v ^# >$@
mailing-lists.wml:  $(WEBWML)/MailingLists/subscribe.wml
	cat $<  |grep -v ^# >$@
social-contract.wml:  $(WEBWML)/social_contract.wml
	cat $<  |grep -v ^# >$@
social-contract.1.0.wml:  $(WEBWML)/social_contract.1.0.wml
	cat $<  |grep -v ^# >$@

mailing-lists.txt: $(WEBWML)/MailingLists/mailing-lists.txt
	cp $< $@

## the Makfile in $(WEBWML)/MailingLists needs internet access!
$(WEBWML)/MailingLists/mailing-lists.txt:
	cd $(WEBWML)/MailingLists && $(MAKE) mailing-lists.txt
endif

# Not in Debian's website, therefore kept in our own SVN:
# source-unpack.txt
# debian-manifesto
