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
|
2011-03-15 19:03:56 +00:00
|
|
|
INDEX = $(DESTINATION)/index.xhtml
|
2011-03-07 19:01:16 +00:00
|
|
|
CSS_SANS_MENU = bicolore_sans_menu.css
|
|
|
|
CSS_AVEC_MENU = bicolore_avec_menu.css
|
2011-02-28 10:51:49 +00:00
|
|
|
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-09 21:32:15 +00:00
|
|
|
#MENU = $(DOSSIER_HTML)/menu.html
|
2011-03-11 11:56:25 +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)
|
2011-03-07 19:01:16 +00:00
|
|
|
dependances_css = style/$(CSS_SANS_MENU)
|
2011-02-28 13:38:24 +00:00
|
|
|
else
|
2011-03-07 19:01:16 +00:00
|
|
|
dependances_css = style/$(CSS_AVEC_MENU)
|
2011-02-28 13:38:24 +00:00
|
|
|
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-11-29 11:47:39 +00:00
|
|
|
PROG_RM = `which rm`
|
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-11-29 11:47:39 +00:00
|
|
|
@$(PROG_TEST) -d img || mkdir img
|
|
|
|
@$(PROG_TEST) -d categ || mkdir categ
|
|
|
|
@$(PROG_TEST) -d style || mkdir style
|
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")
|
2011-03-05 14:35:45 +00:00
|
|
|
@$(PROG_ECHO) -e "\t…création de la destination"
|
2011-11-29 11:47:39 +00:00
|
|
|
@$(PROG_TEST) -d $(DESTINATION) || mkdir $(DESTINATION)
|
2011-03-05 14:35:45 +00:00
|
|
|
@$(PROG_ECHO) -e "\t…création du dossier image"
|
2011-11-29 11:47:39 +00:00
|
|
|
@$(PROG_TEST) -d $(DESTINATION)/image || mkdir $(DESTINATION)/image
|
2011-03-05 14:35:45 +00:00
|
|
|
@$(PROG_ECHO) -e "\t…copie des fichiers images"
|
2011-11-29 11:47:39 +00:00
|
|
|
@$(PROG_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…"
|
2011-03-07 19:01:16 +00:00
|
|
|
$(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)
|
2011-03-04 18:08:15 +00:00
|
|
|
@$(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)
|
2011-11-29 11:47:39 +00:00
|
|
|
@$(PROG_SED) -i "s/DEBUG=1/DEBUG=0/g" $(script_contenu)
|
2011-03-05 10:28:13 +00:00
|
|
|
@$(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"
|
2011-11-29 11:47:39 +00:00
|
|
|
@$(PROG_CAT) $(entete) > $(INDEX)
|
2011-03-04 18:08:15 +00:00
|
|
|
# modification du contenu
|
|
|
|
@$(PROG_ECHO) -e "\t…modification du contenu"
|
2011-11-29 11:47:39 +00:00
|
|
|
@$(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)
|
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"
|
2011-11-29 11:47:39 +00:00
|
|
|
@$(PROG_CAT) $(contenu) >> $(INDEX)
|
2011-03-04 19:06:35 +00:00
|
|
|
# fin du contenu
|
|
|
|
@$(PROG_ECHO) -e "\t…insertion de la fin du contenu"
|
2011-11-29 11:47:39 +00:00
|
|
|
@$(PROG_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"
|
2011-11-29 11:47:39 +00:00
|
|
|
@$(PROG_CAT) $(enqueue) >> $(INDEX)
|
2011-03-04 18:08:15 +00:00
|
|
|
@$(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-11-29 11:47:39 +00:00
|
|
|
@$(PROG_RM) -rf $(DESTINATION)
|
|
|
|
@$(PROG_RM) -f $(contenu)
|
2011-03-04 18:08:15 +00:00
|
|
|
@$(PROG_ECHO) -e " …terminé."
|