all: sty pdf

sty: songproj.sty

pdf: songproj.pdf

%.pdf: %.dtx %.gls %.ind
	xelatex $<

%.glo %.aux %.idx: %.dtx
	xelatex $<

%.gls: %.glo
	makeindex -s gglo.ist -o $@ $<

%.ind: %.idx
	makeindex -s gind.ist -o $@ $<

%.sty: %.ins %.dtx
	xelatex $<

mostlyclean:
	rm -f *.aux *.glo *.gls *.hd *.idx *.ilg *.ind *.log *.out

clean: mostlyclean
	rm -f *.pdf

maintainer-clean: clean
	rm -f *.sty

.PHONY: all sty doc mostlyclean clean maintainer-clean
