Commit 4c12662c authored by Clément DURAND's avatar Clément DURAND

completed makefile

parent 2d3966a2
.PHONY:all %.all install %.install clean %.clean cleandist %.cleandist release
SUBMAKE:=make -s -C
SUBMAKABLE:=$(shell find -mindepth 2 -name '[Mm]akefile' | sed 's%^./%%;s%/[^/]*%%')
define submake
@tput setaf 3
@echo make[$1] $2
@tput sgr0
@$3 $(SUBMAKE) $1 $2
endef
all: $(patsubst %,%.all,$(SUBMAKABLE))
%.all:
$(call submake,$*,,)
install: $(patsubst %,%.install,$(SUBMAKABLE))
%.install:
$(call submake,$*,install,sudo)
clean: $(patsubst %,%.clean,$(SUBMAKABLE))
%.clean:
$(call submake,$*,clean,)
cleandist: $(patsubst %,%.cleandist,$(SUBMAKABLE))
%.cleandist:
$(call submake,$*,cleandist,)
release:
$(call submake,.,,)
$(call submake,.,clean,)
#! /bin/bash
if [ "$(whoami)" != "root" ]; then
echo "Vous devez posséder les droits administrateurs pour installer ce package."
echo "Veuillez utiliser la commande « sudo sh unix_installer.sh »."
exit 1
fi
cd source
pdflatex polytechnique.dtx >> /dev/null
makeindex -q -s gind.ist -o polytechnique.ind polytechnique.idx >> /dev/null
pdflatex polytechnique.dtx >> /dev/null
rm *.aux *.glo *.idx *.ilg *.ind *.log *.toc *.out >> /dev/null
chemindist=$(kpsewhich -var-value TEXMFMAIN)
chemintex=${chemindist}/tex/latex/polytechnique
cheminsource=${chemindist}/source/latex/polytechnique
cheminsourceresources=${chemindist}/source/latex/polytechnique
chemindoc=${chemindist}/doc/latex/polytechnique
mkdir ${chemintex}
mkdir ${cheminsource}
mkdir ${cheminsourceresources}
mkdir ${chemindoc}
cp polytechnique.dtx ${cheminsource}
cp polytechnique.sty ${chemintex}
cp polytechnique.pdf ${chemindoc}
cp *.eps ${cheminsourceresources}
cp *.eps ${chemintex}
cp *.pdf ${cheminsourceresources}
cp *.pdf ${chemintex}
echo "************************************************"
echo "* La base de donnees des packages est en train *"
echo "* de se mettre à jour. Cela peut prendre un *"
echo "* peu de temps. Merci de patienter. *"
echo "************************************************"
texhash >> /dev/null
echo "************************************************"
echo "* Le package a ete installe ! La documentation *"
echo "* se trouve a l'emplacement suivant : *"
echo ${chemindoc}
echo "* Les fichiers sources et resources a *"
echo "* l'endroit suivant : *"
echo ${cheminsource}
echo "* Et le .sty a l'endroit suivant : *"
echo ${chemintex}
echo "* Bonne utilisation ! *"
echo "************************************************"
.PHONY: package install clean cleandist
V:=1
ifeq ("$V","1")
define say
@tput setaf 4
@echo $1
@tput sgr0
endef
else
define say
endef
endif
define installed
@tput setaf 2
@tput bold
@echo "SUCCESS : installed in '"$1"'."
endef
PDFLATEX:=pdflatex -interaction=nonstopmode
MAKEINDEX:=makeindex -q -s gind.ist -o
OUTPUT:=>/dev/null 2>&1
PKGDIR:=$(shell kpsewhich --show-path=ls-R | tr : '\n' | grep texmf | grep local | head -n1)
POLYPKGDIR:=$(PKGDIR)/tex/latex/polytechnique
DTXFILES:=$(shell find -name '*.dtx')
GENFILES:=$(patsubst %.dtx,%.pdf,$(DTXFILES)) $(patsubst %.dtx,%.sty,$(DTXFILES))
all: package
package: polytechnique.sty
%.sty: %.dtx
$(PDFLATEX) $*.dtx
$(call say,creating package file $@)
@$(PDFLATEX) $*.dtx $(OUTPUT)
@$(MAKEINDEX) $*.ind $*.idx $(OUTPUT)
@$(PDFLATEX) $*.dtx $(OUTPUT)
install: package clean
mkdir -p $(POLYPKGDIR)
cp -r . $(POLYPKGDIR)
$(call say,creating destination $(POLYPKGDIR))
@mkdir -p $(POLYPKGDIR)
$(call say,copying files to $(POLYPKGDIR))
@cp -r . $(POLYPKGDIR)
@rm -f $(POLYPKGDIR)/Makefile
$(call installed,$(POLYPKGDIR))
clean:
rm -f polytechnique.aux polytechnique.glo polytechnique.idx polytechnique.log polytechnique.out polytechnique.toc
$(call say,cleaning files)
@rm -f polytechnique.aux polytechnique.glo polytechnique.idx polytechnique.log polytechnique.out polytechnique.toc polytechnique.ind polytechnique.ilg
cleandist: clean
rm -f polytechnique.pdf polytechnique.sty
$(call say,removing doc and package files)
@rm -f $(GENFILES)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment