Séparation fichier index.html et fichier css

master
Olivier DOSSMANN 2011-02-28 14:18:57 +01:00
parent 9202533d02
commit 94189dbe09
1 changed files with 10 additions and 6 deletions

View File

@ -18,19 +18,18 @@ CSS_NOM = defaut.css
TITRE = Titre par défaut
ACCUEIL = Accueil - $(TITRE)
## utiles pour le makefile
dependances_index = entete.html enqueue.html
PROG_ECHO = `which echo`
## facultatives
#MENU = menu.html
# création de tous les fichiers
all: test index
all: test index.html
# divers tests sur l'existence des dossiers/fichiers
# création si besoin
test:
@$(PROG_ECHO) -e "Lancement des tests…"
@test -f entete.html || exit
@test -f enqueue.html || exit
@test -d img || mkdir img
@test -d categ || mkdir categ
@test -d style || mkdir style
@ -41,16 +40,21 @@ test:
@test -d $(DESTINATION)/image || mkdir $(DESTINATION)/image
@$(PROG_ECHO) -e "\t…terminé."
# création du fichier CSS
css:
@$(PROG_ECHO) -e "Création du fichier CSS…"
@cp style/$(CSS_DEFAUT) $(DESTINATION)/$(CSS_NOM)
$(if $(MENU), @patch -u -p0 $(DESTINATION)/$(CSS_NOM) style/$(CSS_PATCH_AJOUT_MENU))
@$(PROG_ECHO) -e "\t…terminée."
# création de la page d'index
index:
index.html: css $(dependances_index)
@$(PROG_ECHO) -e "Création de la page de garde…"
$(if $(MENU), @cat entete.html menu.html enqueue.html > $(INDEX), @cat entete.html enqueue.html > $(INDEX))
@$(PROG_ECHO) -e "\t…terminée."
@$(PROG_ECHO) -e "Modification du contenu…"
@sed -i "s/TITRE_PORTEAIL/$(TITRE)/g" $(INDEX)
@sed -i "s/ACCUEIL_PORTEAIL/$(ACCUEIL)/g" $(INDEX)
@cp style/$(CSS_DEFAUT) $(DESTINATION)/$(CSS_NOM)
$(if $(MENU), @patch -u -p0 $(DESTINATION)/$(CSS_NOM) style/$(CSS_PATCH_AJOUT_MENU))
@sed -i "s#CSS_DEFAUT#./$(CSS_NOM)#g" $(INDEX)
@$(PROG_ECHO) -e "\t…terminée."