path = /usr/local/texlive/2023/bin/x86_64-linux/

default: class doc essai
quick: class essai
blitz: class

class: prepamath.cls
prepamath.cls: prepamath.ins prepamath.dtx
	$(path)tex '\nonstopmode \input prepamath.ins'
	cp prepamath.cls documentation/prepamath.cls
	cp prepamath.ist documentation/prepamath.ist
	cp prepamath.cls ../../problemes/IL3M-preprint/091573120_MEP/091573120_LaTeX

doc: prepamath.pdf
prepamath.pdf: prepamath.dtx
	$(path)latex '\nonstopmode \input{prepamath.dtx}'
	$(path)makeindex -s gind.ist -o prepamath.ind prepamath.idx
	$(path)makeindex -s gglo.ist -o prepamath.gls prepamath.glo
	$(path)latex '\nonstopmode \input{prepamath.dtx}'
	$(path)dvips prepamath
	ps2pdf -dALLOWPSTRANSPARENCY prepamath.ps prepamath.pdf
	rm prepamath.dvi prepamath.ps

essai: testIL.pdf essai-rabat.pdf
testIL.pdf: prepamath.cls testIL.tex src/*.tex
	$(path)latex '\nonstopmode \input{testIL}'
	$(path)makeindex -s prepamath.ist -o testIL.ind testIL.idx
	$(path)latex '\nonstopmode \input{testIL}'
	$(path)dvips -t a4 -O 0in,-2in testIL
	ps2pdf -dALLOWPSTRANSPARENCY -dPDFSETTINGS=/prepress -dEmbedAllFonts=true -sPAPERSIZE=a4 testIL.ps testIL.pdf
	rm testIL.dvi testIL.ps

essai-rabat.pdf: prepamath.cls essai-rabat.tex
	$(path)latex '\nonstopmode \input{essai-rabat}'
	$(path)dvips essai-rabat
	ps2pdf -dALLOWPSTRANSPARENCY -dPDFSETTINGS=/prepress -dEmbedAllFonts=true essai-rabat.ps essai-rabat.pdf
	rm essai-rabat.dvi essai-rabat.ps

zip:
	tar czvf prepamath.tar.gz Makefile commandes.tex prepamath.dtx prepamath.cls prepamath.ist rabat.sty Picto*.eps testIL.tex testIL.pdf *.eps essai-rabat.tex essai-rabat.pdf documentation/Makefile documentation/commandes.tex documentation/manuel.tex documentation/manuel.pdf documentation/mini-manuel.tex documentation/mini-manuel.pdf src/*.tex src/Makefile figures/* pdg.eps

clean:
	rm -f *.dvi *.ps *. *.toc *.toc? *.aux *.log *~ *.out *.ilg *.glo *.idx *.ind *.gls *.dvi *.ps corr* *.cor figures/*~ src/*~ src/*.aux
