mirror of
https://forge.chapril.org/tykayn/orgmode-to-gemini-blog
synced 2025-11-19 23:00:35 +01:00
115 lines
4.3 KiB
Makefile
115 lines
4.3 KiB
Makefile
.PHONY: stats help epub epub-tykayn epub-cipherbliss epub-qzine epub-all venv install install-calibre install-system-deps install-all help-install
|
|
|
|
VENV = venv
|
|
PYTHON = python3
|
|
PIP = $(VENV)/bin/pip
|
|
|
|
help:
|
|
@echo "Commandes disponibles:"
|
|
@echo ""
|
|
@echo "Installation:"
|
|
@echo " make install-all Installe tout (venv + dépendances Python + système)"
|
|
@echo " make venv Crée l'environnement virtuel Python"
|
|
@echo " make install Installe les dépendances Python dans le venv"
|
|
@echo " make install-system-deps Installe pandoc et Calibre avec apt (nécessite sudo)"
|
|
@echo " make install-calibre Installe uniquement Calibre avec apt (nécessite sudo)"
|
|
@echo ""
|
|
@echo "Statistiques:"
|
|
@echo " make stats Génère les statistiques combinées pour tykayn_blog, cipherbliss_blog et qzine_blog"
|
|
@echo " make stats-all Génère les statistiques pour tous les blogs"
|
|
@echo " make stats-custom Génère les statistiques combinées personnalisées (modifiez la cible dans le Makefile)"
|
|
@echo " make stats-file Génère les statistiques d'un fichier unique (exemple: sources/tykayn_blog/lang_fr/2024-01-article.org)"
|
|
@echo " Utilisez: make stats-file FILE=chemin/vers/fichier.org [DATE_DEBUT=YYYY-MM-DD]"
|
|
@echo ""
|
|
@echo "Export EPUB:"
|
|
@echo " make epub-tykayn Exporte tykayn_blog en EPUB"
|
|
@echo " make epub-cipherbliss Exporte cipherbliss_blog en EPUB"
|
|
@echo " make epub-qzine Exporte qzine_blog en EPUB"
|
|
@echo " make epub-all Exporte tykayn_blog, cipherbliss_blog et qzine_blog en EPUB combiné"
|
|
@echo " make epub Exporte tous les blogs en EPUB (modifiez la cible dans le Makefile)"
|
|
|
|
blogs:
|
|
bash converters.sh cipherbliss_blog
|
|
bash converters.sh tykayn_blog
|
|
stats:
|
|
python3 generate_blog_stats.py cipherbliss_blog
|
|
|
|
stats-all:
|
|
python3 generate_blog_stats.py tykayn_blog cipherbliss_blog qzine_blog --output tk_combinaison_stats.html
|
|
|
|
stats-custom:
|
|
python3 generate_blog_stats.py tykayn_blog cipherbliss_blog qzine_blog --output tk_combinaison_stats.html --objectif-articles 3
|
|
|
|
stats-file:
|
|
@if [ -z "$(FILE)" ]; then \
|
|
echo "Erreur: Veuillez spécifier un fichier avec FILE=chemin/vers/fichier.org"; \
|
|
echo ""; \
|
|
echo "Exemples:"; \
|
|
echo " make stats-file FILE=sources/tykayn_blog/lang_fr/2024-01-article.org"; \
|
|
echo " make stats-file FILE=sources/qzine_blog/lang_fr/20120114T183335__fetichisme-des-poignees-de-porte-zetes-prevenus.org"; \
|
|
echo ""; \
|
|
echo "Avec date de début d'écriture:"; \
|
|
echo " make stats-file FILE=sources/qzine_blog/lang_fr/20120114T183335__fetichisme-des-poignees-de-porte-zetes-prevenus.org DATE_DEBUT=2012-01-14"; \
|
|
exit 1; \
|
|
fi
|
|
@if [ -n "$(DATE_DEBUT)" ]; then \
|
|
python3 generate_blog_stats.py "$(FILE)" --date-debut "$(DATE_DEBUT)"; \
|
|
else \
|
|
python3 generate_blog_stats.py "$(FILE)"; \
|
|
fi
|
|
|
|
epub-tykayn:
|
|
python3 export_to_epub.py tykayn_blog
|
|
|
|
epub-cipherbliss:
|
|
python3 export_to_epub.py cipherbliss_blog
|
|
|
|
epub-qzine:
|
|
python3 export_to_epub.py qzine_blog
|
|
|
|
epub-all:
|
|
python3 export_to_epub.py tykayn_blog cipherbliss_blog qzine_blog
|
|
|
|
epub:
|
|
python3 export_to_epub.py tykayn_blog
|
|
|
|
# Installation
|
|
venv:
|
|
@echo "📦 Création de l'environnement virtuel Python..."
|
|
@if [ -d "$(VENV)" ]; then \
|
|
echo "⚠️ Le venv existe déjà. Supprimez-le avec 'rm -rf $(VENV)' pour le recréer."; \
|
|
else \
|
|
$(PYTHON) -m venv $(VENV); \
|
|
echo "✅ Environnement virtuel créé dans $(VENV)/"; \
|
|
fi
|
|
|
|
install: venv
|
|
@echo "📥 Installation des dépendances Python..."
|
|
@$(PIP) install --upgrade pip
|
|
@$(PIP) install -r requirements.txt
|
|
@echo "✅ Dépendances Python installées"
|
|
|
|
install-calibre:
|
|
@echo "📚 Installation de Calibre..."
|
|
@echo "⚠️ Cette commande nécessite les droits sudo"
|
|
@sudo apt update
|
|
@sudo apt install -y calibre
|
|
@echo "✅ Calibre installé"
|
|
|
|
install-system-deps:
|
|
@echo "📦 Installation des dépendances système (pandoc, calibre)..."
|
|
@echo "⚠️ Cette commande nécessite les droits sudo"
|
|
@sudo apt update
|
|
@sudo apt install -y pandoc calibre
|
|
@echo "✅ Dépendances système installées"
|
|
|
|
install-all: venv install install-system-deps
|
|
@echo ""
|
|
@echo "🎉 Installation terminée !"
|
|
@echo ""
|
|
@echo "Pour utiliser le venv, exécutez:"
|
|
@echo " source $(VENV)/bin/activate"
|
|
@echo ""
|
|
@echo "Ou utilisez directement:"
|
|
@echo " $(VENV)/bin/python3 generate_blog_stats.py ..."
|
|
|