From 5d4eecd626934433f0687ba0526de595f8b1b75e Mon Sep 17 00:00:00 2001 From: Lukc Date: Thu, 16 Feb 2012 12:58:00 +0100 Subject: [PATCH] =?UTF-8?q?Le=20GNUmakefile=20ne=20devrait=20plus=20tout?= =?UTF-8?q?=20reconstruire=20sans=20que=20les=20fichiers=20.txt=20n?= =?UTF-8?q?=E2=80=99aient=20chang=C3=A9.=20=20=20*=20La=20somme=20de=20con?= =?UTF-8?q?tr=C3=B4le=20md5=20a=20=C3=A9t=C3=A9=20retir=C3=A9e.=20=20=20*?= =?UTF-8?q?=20L=E2=80=99ensemble=20a=20=C3=A9t=C3=A9=20test=C3=A9,=20mais?= =?UTF-8?q?=20d=E2=80=99autres=20tests=20seraient=20appr=C3=A9ci=C3=A9s=20?= =?UTF-8?q?=20=20=20=20(apr=C3=A8s=20tout,=20je=20connais=20bien=20moins?= =?UTF-8?q?=20l=E2=80=99outil=20que=20Blanko).=20=20=20*=20Les=20v=C3=A9ri?= =?UTF-8?q?fications=20de=20la=20pr=C3=A9sence=20de=20certains=20outils=20?= =?UTF-8?q?ont=20aussi=20=C3=A9t=C3=A9=20=20=20=20=20retir=C3=A9s,=20car?= =?UTF-8?q?=20d=C3=A9pr=C3=A9ci=C3=A9s=20en=20l=E2=80=99absence=20de=20som?= =?UTF-8?q?me=20de=20contr=C3=B4le=20MD5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GNUmakefile | 42 +++++++++++------------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 2323db1..5fab73e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -37,9 +37,6 @@ PROG_SH = `which sh` PROG_RM = `which rm` PROG_FIND = `which find` PROG_SORT = `which sort` -PROG_AWK = `which awk` -PROG_MD5SUM = `which md5sum` -PROG_DIFF = `which diff` PROG_WC = `which wc` # vérification des programmes @@ -70,22 +67,13 @@ endif ifndef PROG_SORT error_sort = 1 endif -ifndef PROG_AWK -error_awk = 1 -endif -ifndef PROG_MD5SUM -error_md5sum = 1 -endif -ifndef PROG_DIFF -error_diff = 1 -endif ifndef PROG_WC error_wc = 1 endif ## DEBUT # création de tous les fichiers -all: test index.html +all: test index # divers tests sur l'existence des dossiers/fichiers # création si besoin @@ -101,15 +89,7 @@ test: $(if $(error_rm), @$(PROG_ECHO) -e "\t\trm : MANQUANT." ; exit 1) $(if $(error_find), @$(PROG_ECHO) -e "\t\tfind : MANQUANT." ; exit 1) $(if $(error_sort), @$(PROG_ECHO) -e "\t\tsort : MANQUANT." ; exit 1) - $(if $(error_awk), @$(PROG_ECHO) -e "\t\tawk : MANQUANT." ; exit 1) - $(if $(error_md5sum), @$(PROG_ECHO) -e "\t\tmd5sum : MANQUANT." ; exit 1) - $(if $(error_diff), @$(PROG_ECHO) -e "\t\tdiff : MANQUANT." ; exit 1) $(if $(error_wc), @$(PROG_ECHO) -e "\t\twc : MANQUANT." ; exit 1) - @$(PROG_ECHO) -e "\t…existence de la somme de contrôle MD5" - @if $(PROG_TEST) -f $(somme_md5); \ - then $(PROG_ECHO) -e "\t\t-> OK"; \ - else $(PROG_ECHO) -e "\t\t-> manquant"; \ - fi @$(PROG_ECHO) -e "\t…existence des dossiers img, categ et style" @$(PROG_TEST) -d img || mkdir img @$(PROG_TEST) -d $(categ) || mkdir $(categ) @@ -129,20 +109,14 @@ test: @$(PROG_ECHO) -e " …terminé." # création du fichier CSS -css: $(dependances_css) +$(DESTINATION)/$(CSS_NOM): $(dependances_css) @$(PROG_ECHO) -e "Création du fichier CSS…" $(if $(MENU), @cp style/$(CSS_AVEC_MENU) $(DESTINATION)/$(CSS_NOM), @cp style/$(CSS_SANS_MENU) $(DESTINATION)/$(CSS_NOM)) # @cp style/$(CSS_DEFAUT) $(DESTINATION)/$(CSS_NOM) @$(PROG_ECHO) -e " …terminée." -# vérification de la somme de contrôle des catégories et des éléments, création si besoin -$(somme_md5): - @$(PROG_ECHO) -e "Création d'un fichier 'somme de contrôle' pour l'ensemble des catégories…" - @$(PROG_FIND) ./$(categ) -type f -name *.$(ext) -exec $(PROG_MD5SUM) {} + | $(PROG_AWK) '{print $$1}' | $(PROG_SORT) > $(somme_md5) - @$(PROG_ECHO) -e " …terminée." - # création du fichier $(contenu) -contenu: $(script_contenu) $(somme_md5) +$(contenu): $(script_contenu) */*.txt @$(PROG_SED) -i "s/DEBUG=1/DEBUG=0/g" $(script_contenu) @$(PROG_ECHO) -e "Création du contenu avec les valeurs suivantes : " @$(PROG_ECHO) -e "\t\t- Dossier catégorie : $(categ)" @@ -155,14 +129,20 @@ contenu: $(script_contenu) $(somme_md5) @$(PROG_SH) $(script_contenu) $(categ) $(contenu) $(ext) $(composants) $(categ_deb) $(categ_fin) $(elem) # création de la page d'index -index.html: $(DOSSIER_HTML) css contenu $(dependances_index) $(contenu) +index: $(INDEX) +$(INDEX): $(DOSSIER_HTML) $(DESTINATION)/$(CSS_NOM) $(dependances_index) $(contenu) @$(PROG_ECHO) -e "Création de la page de garde…" # entete @$(PROG_ECHO) -e "\t…insertion de l'entête" @$(PROG_CAT) $(entete) > $(INDEX) # modification du contenu @$(PROG_ECHO) -e "\t…modification du contenu" - @$(PROG_SED) -i -e "s/@@TITRE_PORTEAIL@@/$(TITRE)/g" -e "s/@@ACCUEIL_PORTEAIL@@/$(ACCUEIL)/g" -e "s#@@CSS_DEFAUT@@#./$(CSS_NOM)#g" -e "s/^\(.*\)@@.*@@\(.*\)$$/\1\2/g" $(INDEX) + @$(PROG_SED) -i \ + -e "s/@@TITRE_PORTEAIL@@/$(TITRE)/g" \ + -e "s/@@ACCUEIL_PORTEAIL@@/$(ACCUEIL)/g" \ + -e "s#@@CSS_DEFAUT@@#./$(CSS_NOM)#g" \ + -e "s/^\(.*\)@@.*@@\(.*\)$$/\1\2/g" \ + $(INDEX) @$(PROG_ECHO) -e "\t …contenu modifié avec succès !" # introduction (SI la variable INTRO est remplie) $(if $(INTRO), @cat $(INTRO) >> $(INDEX); $(PROG_ECHO) -e "\t…insertion de l'introduction" || exit 1)