2011-03-05 10:00:22 +00:00
|
|
|
###########
|
|
|
|
# LICENCE #
|
|
|
|
###########
|
|
|
|
|
|
|
|
# Copyright (C) 2011 DOSSMANN Olivier <olivier@dossmann.net> ##
|
|
|
|
|
|
|
|
# This file is part of PorteAil.
|
|
|
|
#
|
|
|
|
# PorteAil is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# PorteAil is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with PorteAil. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
|
2011-02-23 21:42:16 +00:00
|
|
|
# définition de cibles particulières
|
|
|
|
.PHONY: clean
|
|
|
|
|
2011-02-28 15:39:03 +00:00
|
|
|
## VARIABLES ##
|
|
|
|
## configuration
|
2011-02-23 21:42:16 +00:00
|
|
|
DESTINATION = porteail
|
|
|
|
INDEX = $(DESTINATION)/index.html
|
2011-02-28 10:51:49 +00:00
|
|
|
CSS_DEFAUT = bicolore_sans_menu.css
|
|
|
|
CSS_PATCH_AJOUT_MENU = bicolore_ajout_menu.patch
|
|
|
|
CSS_NOM = defaut.css
|
2011-02-23 21:42:16 +00:00
|
|
|
TITRE = Titre par défaut
|
|
|
|
ACCUEIL = Accueil - $(TITRE)
|
2011-02-28 15:39:03 +00:00
|
|
|
DOSSIER_HTML = composants
|
|
|
|
## divers
|
2011-03-04 18:08:15 +00:00
|
|
|
MENU = $(DOSSIER_HTML)/menu.html
|
2011-03-04 18:40:20 +00:00
|
|
|
INTRO = $(DOSSIER_HTML)/introduction.html
|
2011-02-28 11:00:20 +00:00
|
|
|
## utiles pour le makefile
|
2011-02-28 13:38:24 +00:00
|
|
|
ifndef $(MENU)
|
|
|
|
dependances_css = style/$(CSS_DEFAUT)
|
|
|
|
else
|
|
|
|
dependances_css = style/$(CSS_DEFAUT) style/$(CSS_PATCH_AJOUT_MENU)
|
|
|
|
endif
|
2011-02-28 15:39:03 +00:00
|
|
|
entete = $(DOSSIER_HTML)/entete.html
|
|
|
|
enqueue = $(DOSSIER_HTML)/enqueue.html
|
2011-03-04 19:06:35 +00:00
|
|
|
contenu_fin = $(DOSSIER_HTML)/contenu_fin.html
|
|
|
|
dependances_index = $(entete) $(enqueue) $(contenu_fin)
|
2011-03-05 10:28:13 +00:00
|
|
|
script_contenu = creation_categ.sh
|
|
|
|
contenu = categories.html
|
2011-03-04 18:08:15 +00:00
|
|
|
# programmes
|
2011-02-28 11:00:20 +00:00
|
|
|
PROG_ECHO = `which echo`
|
2011-03-04 18:08:15 +00:00
|
|
|
PROG_TEST = `which test`
|
|
|
|
PROG_SED = `which sed`
|
|
|
|
PROG_PATCH = `which patch`
|
|
|
|
PROG_CAT = `which cat`
|
2011-03-04 18:40:20 +00:00
|
|
|
PROG_CP = `which cp`
|
2011-03-05 10:28:13 +00:00
|
|
|
PROG_BASH = `which bash`
|
2011-02-23 21:42:16 +00:00
|
|
|
|
2011-02-28 15:39:03 +00:00
|
|
|
## DEBUT
|
2011-02-23 21:42:16 +00:00
|
|
|
# création de tous les fichiers
|
2011-02-28 13:18:57 +00:00
|
|
|
all: test index.html
|
2011-02-23 21:42:16 +00:00
|
|
|
|
|
|
|
# divers tests sur l'existence des dossiers/fichiers
|
|
|
|
# création si besoin
|
2011-02-28 15:39:03 +00:00
|
|
|
test:
|
2011-02-28 11:00:20 +00:00
|
|
|
@$(PROG_ECHO) -e "Lancement des tests…"
|
2011-03-04 18:08:15 +00:00
|
|
|
@$(PROG_ECHO) -e "\t…existence des dossiers img, categ et style"
|
2011-02-23 21:42:16 +00:00
|
|
|
@test -d img || mkdir img
|
|
|
|
@test -d categ || mkdir categ
|
|
|
|
@test -d style || mkdir style
|
2011-03-04 18:08:15 +00:00
|
|
|
@$(PROG_ECHO) -e "\t…existence de la feuille de style par défaut : '$(CSS_DEFAUT)'"
|
2011-02-23 21:42:16 +00:00
|
|
|
@test -f style/$(CSS_DEFAUT) || exit
|
2011-03-04 18:40:20 +00:00
|
|
|
@$(PROG_ECHO) -e "\t…option introduction dans la page"
|
|
|
|
$(if $(INTRO), @test -f $(INTRO) || exit)
|
|
|
|
$(if $(INTRO), @$(PROG_ECHO) -e "\t\t-> activée", @$(PROG_ECHO) -e "\t\t-> désactivée")
|
|
|
|
@$(PROG_ECHO) -e "\t…option ajout d'un menu (vérification de l'existence)"
|
|
|
|
$(if $(MENU), @test -f $(MENU) || exit)
|
|
|
|
$(if $(MENU), @$(PROG_ECHO) -e "\t\t-> activée", @$(PROG_ECHO) -e "\t\t-> désactivée")
|
|
|
|
$(if $(MENU), @test -f style/$(CSS_PATCH_AJOUT_MENU) || exit)
|
2011-03-05 14:35:45 +00:00
|
|
|
@$(PROG_ECHO) -e "\t…création de la destination"
|
2011-02-23 21:42:16 +00:00
|
|
|
@test -d $(DESTINATION) || mkdir $(DESTINATION)
|
2011-03-05 14:35:45 +00:00
|
|
|
@$(PROG_ECHO) -e "\t…création du dossier image"
|
2011-02-23 21:42:16 +00:00
|
|
|
@test -d $(DESTINATION)/image || mkdir $(DESTINATION)/image
|
2011-03-05 14:35:45 +00:00
|
|
|
@$(PROG_ECHO) -e "\t…copie des fichiers images"
|
|
|
|
@cp -r img/* $(DESTINATION)/image
|
2011-03-04 18:08:15 +00:00
|
|
|
@$(PROG_ECHO) -e " …terminé."
|
2011-02-23 21:42:16 +00:00
|
|
|
|
2011-02-28 13:18:57 +00:00
|
|
|
# création du fichier CSS
|
2011-02-28 13:38:24 +00:00
|
|
|
css: $(dependances_css)
|
2011-02-28 13:18:57 +00:00
|
|
|
@$(PROG_ECHO) -e "Création du fichier CSS…"
|
|
|
|
@cp style/$(CSS_DEFAUT) $(DESTINATION)/$(CSS_NOM)
|
2011-03-04 18:08:15 +00:00
|
|
|
$(if $(MENU), @patch -u -p0 $(DESTINATION)/$(CSS_NOM) style/$(CSS_PATCH_AJOUT_MENU); $(PROG_ECHO) -e "\t…patch pour affichage du menu")
|
|
|
|
@$(PROG_ECHO) -e " …terminée."
|
2011-02-28 13:18:57 +00:00
|
|
|
|
2011-03-05 10:28:13 +00:00
|
|
|
# création du fichier $(contenu)
|
|
|
|
contenu: $(script_contenu)
|
|
|
|
@sed -i "s/DEBUG=1/DEBUG=0/g" $(script_contenu)
|
|
|
|
@$(PROG_BASH) $(script_contenu) || exit
|
|
|
|
|
2011-02-23 21:42:16 +00:00
|
|
|
# création de la page d'index
|
2011-03-05 10:28:13 +00:00
|
|
|
index.html: $(DOSSIER_HTML) css contenu $(dependances_index) $(contenu)
|
2011-02-28 11:00:20 +00:00
|
|
|
@$(PROG_ECHO) -e "Création de la page de garde…"
|
2011-03-04 18:08:15 +00:00
|
|
|
# entete
|
|
|
|
@$(PROG_ECHO) -e "\t…insertion de l'entête"
|
|
|
|
@cat $(entete) > $(INDEX)
|
|
|
|
# modification du contenu
|
|
|
|
@$(PROG_ECHO) -e "\t…modification du contenu"
|
2011-03-04 18:49:39 +00:00
|
|
|
@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)
|
2011-03-04 18:08:15 +00:00
|
|
|
@$(PROG_ECHO) -e "\t …contenu modifié avec succès !"
|
|
|
|
# introduction (SI la variable INTRO est remplie)
|
2011-03-04 18:40:20 +00:00
|
|
|
$(if $(INTRO), @cat $(INTRO) >> $(INDEX); $(PROG_ECHO) -e "\t…insertion de l'introduction" || exit)
|
2011-03-04 18:08:15 +00:00
|
|
|
# contenu
|
2011-03-05 10:28:13 +00:00
|
|
|
@$(PROG_ECHO) -e "\t…insertion du contenu"
|
|
|
|
@cat $(contenu) >> $(INDEX)
|
2011-03-04 19:06:35 +00:00
|
|
|
# fin du contenu
|
|
|
|
@$(PROG_ECHO) -e "\t…insertion de la fin du contenu"
|
|
|
|
@cat $(contenu_fin) >> $(INDEX)
|
2011-03-04 18:08:15 +00:00
|
|
|
# menu
|
|
|
|
$(if $(MENU), @cat $(MENU) >> $(INDEX); $(PROG_ECHO) -e "\t…insertion du menu" || exit)
|
|
|
|
# enqueue
|
|
|
|
@$(PROG_ECHO) -e "\t…insertion de l'enqueue"
|
|
|
|
@cat $(enqueue) >> $(INDEX)
|
|
|
|
@$(PROG_ECHO) -e " …terminée."
|
2011-02-23 21:42:16 +00:00
|
|
|
|
|
|
|
# nettoyage des fichiers générés
|
|
|
|
clean:
|
2011-02-28 11:00:20 +00:00
|
|
|
@$(PROG_ECHO) -e "Nettoyage des fichiers en cours…"
|
2011-02-23 21:42:16 +00:00
|
|
|
@rm -rf $(DESTINATION)
|
2011-03-04 18:08:15 +00:00
|
|
|
@$(PROG_ECHO) -e " …terminé."
|