# BIM's BSD Leaflet Makefile.
#   First by Oliver Fromme  <olli@fromme.com>
#   Replaced by Julian H. Stacey <jhs @ berklix.org> adding dual language & HTML
#   & pdf & auto tool. build & wysiwyg editing via berklix.mk macros.
#   E: Creates a 3 x 2 folded leaflet
#   D: Erzeugen eines 3x2-Faltblattes.
#   E: See commentary at beginning of leaflet.l_tex
#   D: Siehe die Kommentare am Anfang von leaflet.l_tex
#
# PENDING:
#	- The pdf is single column per page.
#	- Fix land/seascape inversion on side 2.

# NO_SIDEBAR=YES

ALL =	le txt dvi lmth pdf # ps

LL=leaflet
FOR_PS = $(LL)_e.ps $(LL)_g.ps
TARGS = $(LL)_e.txt $(LL)_g.txt \
	$(LL)_e.dvi $(LL)_g.dvi $(LL)_e.html $(LL)_g.html \
	$(LL)_e.pdf $(LL)_g.pdf $(LL)_e.ps $(LL)_g.ps

BIM_URL =	http://www.berklix.org/bim/
LATEX2HTML_ARGS = -split +0	-address bim-leaflet_ERASE@mailman.berklix.org \
	-up_url ${BIM_URL}		-up_title Berkeley_In_Munich	\
	-prev_url ${LEAFLET_URL}	-prev_title BIM_Leaflet
#	-split +0 and -split 0 both fail to put all data in one file
LEAFLET_URL	= http://www.berklix.org/bim/leaflet/
XDVI_ARGS	= -paper 99x210mm
CLEAN =	WARNINGS \
	images.pl images.tex img1.old img1.png img2.png labels.pl share_mk

# JHS=	http://www.berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/gen/share/mk/
JHS=	http://www.berklix.com/src/share/mk/

.if exists( /usr/share/mk/berklix.mk )
all2:	${ALL}
#	I guess all2 is to avoid colliding with all: in berklix.mk
.else
all:
	make fetch_macros
.endif

check:
	ls -l ${TARGS}
	@echo "All exist."
clean:
	@echo "Clean is dangerous as this is a web served directory."
	@echo "& the .ps files get no text in 5.3, though 4.11 is OK."
	@# rm -f ${CLEAN}
	@echo "If you really want to clean, type	make _clean"
spell:
	@echo "If you don't have a dual language dictionary, "
	@echo -n "this will be verbose."
	sleep 4
	${ISPELL} -t ${LL}.l_tex

.if exists(/usr/share/mk/berklix.mk)
.include <berklix.mk>
.else
fetch_macros:
	mkdir macros
	cd macros && fetch ${JHS}/berklix.mk && fetch ${JHS}/berklix.mk
	@echo "Installing macros - May fail if you aren't root."
	cd macros && install berklix*.mk /usr/share/mk/
	rm -rf macros
	make
.endif
