Bez popisu

Makefile 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. .PHONY: package install clean cleandist
  2. V:=1
  3. ifeq ("$V","1")
  4. define say
  5. @tput setaf 4
  6. @echo $1
  7. @tput sgr0
  8. endef
  9. else
  10. define say
  11. endef
  12. endif
  13. define installed
  14. @tput setaf 2
  15. @tput bold
  16. @echo "SUCCESS : installed in '"$1"'."
  17. endef
  18. PDFLATEX:=pdflatex -interaction=nonstopmode
  19. MAKEINDEX:=makeindex -q -s gind.ist -o
  20. OUTPUT:=>/dev/null 2>&1
  21. PKGDIR:=$(shell kpsewhich --show-path=ls-R | tr : '\n' | grep texmf | grep local | head -n1)
  22. POLYPKGDIR:=$(PKGDIR)/tex/latex/polytechnique
  23. DTXFILES:=$(shell find -name '*.dtx')
  24. GENFILES:=$(patsubst %.dtx,%.pdf,$(DTXFILES)) $(patsubst %.dtx,%.sty,$(DTXFILES))
  25. all: package
  26. package: polytechnique.sty
  27. %.sty: %.dtx
  28. $(call say,creating package file $@)
  29. @$(PDFLATEX) $*.dtx $(OUTPUT)
  30. @$(MAKEINDEX) $*.ind $*.idx $(OUTPUT)
  31. @$(PDFLATEX) $*.dtx $(OUTPUT)
  32. install: package clean
  33. $(call say,creating destination $(POLYPKGDIR))
  34. @mkdir -p $(POLYPKGDIR)
  35. $(call say,copying files to $(POLYPKGDIR))
  36. @cp -r . $(POLYPKGDIR)
  37. @rm -f $(POLYPKGDIR)/Makefile
  38. $(call installed,$(POLYPKGDIR))
  39. clean:
  40. $(call say,cleaning files)
  41. @rm -f polytechnique.aux polytechnique.glo polytechnique.idx polytechnique.log polytechnique.out polytechnique.toc polytechnique.ind polytechnique.ilg
  42. cleandist: clean
  43. $(call say,removing doc and package files)
  44. @rm -f $(GENFILES)