Auto-éditer un wikilivre/Annexer (Version internationalisée)/Makefile

Un livre de Wikilivres.

Attention ce Makefile n'est pas terminé, il est cependant opérationnel pour des tests à condition d'avoir téléchargé les sources, les archives, resources, icons, man.

Il est nécessaire d'organiser le Makefile pour l'empaquetage
  1. placer en tête de fichier, la dépendance de création du binaire $(PGM).
  2. vérifier que la dépendance 'install' dépende de la création du / des binaires.
  3. effacer le / les fichiers binaires $(PGM) dans la dépendance inconditionnelle 'clean'. Elle devra être la première exécutée à la création du paquet afin de commencer avec un répertoire propre
  4. ajouter la macro $(DESTDIR) en premier lieu pour les essais.
  5. Pendant les essais, vérifier qu'aucune commande ne retourne une valeur différente de zéro, le paquet ne serait pas créé et la demande ppa serait refusée avec des mots très décourrageants.
  6. nettoyer le répertoire à la fin de la compilation s'il y a lieu sachant que la directive 'clean:' est obligatoire.

Makefiles for tests[modifier | modifier le wikicode]

Logo

Il est possible qu'il y ait une distorsion entre cette version add_appendix par rapport à la version précédente addapendix.
Cette version n'est pas éprouvée !

  • Lancer le Makefile comme suit: make -d install DESTDIR=../tests
#!/bin/make
# file:Makefile for packaging ubuntu add_appendix
# add_appendix-O~211217
# updated by french wikibooks user:Goelette_Cardabela
# 
# To test make -d clean install DESTDIR=../tests
# Lors de l'installation les fichiers sources doivent être recopiés
# d'un autre répertoire qui peut être dans ~/Add_appendix
#
# /usr/local directory
VERSION=220304
BIN		= $(DESTDIR)/usr/local/bin
DOCU	= $(DESTDIR)/usr/local/share/add_appendix/doc
CATMANDIR		= $(DESTDIR)/var/cache/man
CATMANDIR_FR	= $(DESTDIR)/var/cache/man/fr.UTF-8/cat1 debian
DATAS	= $(DESTDIR)/usr/local/datas
DOC		= $(DESTDIR)/usr/local/share/doc/Add_appendix
ETC		= $(DESTDIR)/usr/local/etc
LIB		= $(DESTDIR)/usr/local/lib
SLIBS	= annex.lib.sh cpcleaned2bin.sh ecfpb.sh ecfpc.sh findbook.sh killalldoc.sh
# system directories
ICONS	= $(DESTDIR)/usr/share/icons/hicolor
LANG	= $(DESTDIR)/usr/share/locale
MAN		= $(DESTDIR)/usr/share/man
MIME	= $(DESTDIR)/usr/share/mime
SRC		= $(DESTDIR)/usr/local/src/Add_appendix
SRCS	= add_sclic.sh add_sclipco.sh add_sclipwb.sh add_sclt.sh annex.sh\
		download.sh en_sclic.inc.sh en_sclipco.inc.sh\
		en_sclipwb.inc.sh en_sclt.inc.sh fr_sclic.inc.sh\
		fr_sclipco.inc.sh fr_sclipwb.inc.sh fr_sclt.inc.sh header.inc.sh\
		list.sh pre-annex.sh scli.inc.sh add_appendix.sh annexer.sh
SBIN	= $(DESTDIR)/usr/local/sbin
SBINS	= compil2bin.sh findversions.sh install_annex.sh \
		install_datasfiles.sh makeman_annex.sh users_install_annex.sh
PGM		= add_appendix

# local Add_appendix directories as variables
Installdir=.
Workdir=.
Bindir=./bin
Booksdir=./books
Datasdir=./datas
Libdir=./lib
Sharedir=./share
Srcdir=./src/Add_appendix
Sbindir=./sbin
Testsdir=./tests
Varsdir=./vars
Langdir=./share/addappendix/resources/lang/po
Localedir=./share/locale
Mandir=./share/man

install: $(PGM)
            
$(PGM): 
	@echo "*** DESTDIR : $(DESTDIR)"
	# Create all directories to making up the application
	install -d $(BIN) $(DOCU) $(CATMANDIR_FR) $(DATAS) $(LIB) $(ETC) $(SBIN) $(SRC)
	# Copy all sources files in SRC directory
	cp -f $(Srcdir)/* $(SRC)/.
	# Copy all executables files in BIN directory
	cp -f $(Bindir)/* $(BIN)/.
	# Copy all datas files to DATAS directory
	cp -f $(Datasdir)/* $(DATAS)/.
	# Copy all sbin executables files to SBIN directory
	cp -rf $(Sbindir)/* $(SBIN)/.
	# Copy all lib files to LIB directory
	cp -rf $(Libdir)/* $(LIB)/.
	# Create new Add_appendix directory and essential sub-directories from package
	@if [ -e ~/Add_appendix ]; then echo "~/Add_appendix exist, ok"; else mkdir -p ~/Add_appendix; fi
	@if [ -e ~/Add_appendix/books ]; then echo "~/Add-appendix/books exist ok"; else mkdir -p ~/Add_appendix/books; fi
	@if [ -e ~/Add_appendix/vars ]; then echo "~/Add_appendix/vars exist ok"; else mkdir -p ~/Add_appendix/vars; fi
	@if [ -e ~/Add_appendix/temp ]; then mkdir -p ~/Add_appendix/temp; fi

install: $(PGM)
    # Create SHARE sub directories
	install -d $(ICON) $(LANG) $(MAN) $(MIME)

	#install icons and update cache
	install -d $(ICONS) $(ICONS)/scalable/mimetypes $(ICONS)/256x256/mimetypes
	install -d $(ICONS)/256x256/apps $(ICONS)/48x48/apps $(ICONS)/32x32/apps $(ICONS)/16x16/apps $(ICONS)/8x8/apps
	#cp -f $(Sharedir)/icons/AA256x256.svg $(ICONS)/scalable/mimetypes/addappendix.svg
	cp -f $(Sharedir)/icons/hicolor/scalable/mimetypes/addappendix.svg  $(ICONS)/scalable/mimetypes/addappendix.svg
	#cp -f $(Sharedir)/icons/AA256x256.png $(ICONS)/256x256/mimetypes/addappendix.png
	cp -f $(Sharedir)/icons/hicolor/256x256/mimetypes/addappendix.png $(ICONS)/256x256/mimetypes/addappendix.png
	#cp -f $(Sharedir)/icons/AA256x256.svg $(ICONS)/256x256/mimetypes/addappendix.svg
	cp -f $(Sharedir)/icons/hicolor/256x256/mimetypes/addappendix.svg $(ICONS)/256x256/mimetypes/addappendix.svg
	#cp -f $(Sharedir)/icons/AA48x48bleu.png $(ICONS)/48x48/apps/addappendix.png
	cp -f $(Sharedir)/icons/hicolor/48x48/apps/addappendix.png $(ICONS)/48x48/apps/addappendix.png
	#cp -f $(Sharedir)/icons/AA32x32bleu.png $(ICONS)/32x32/apps/addappendix.png
	cp -f $(Sharedir)/icons/hicolor/32x32/apps/addappendix.png $(ICONS)/32x32/apps/addappendix.png
	#cp -f $(Sharedir)/icons/AA16x16bleu.png $(ICONS)/16x16/apps/addappendix.png
	cp -f $(Sharedir)/icons/hicolor/16x16/apps/addappendix.png $(ICONS)/16x16/apps/addappendix.png
	#cp -f $(Sharedir)/icons/AA8x8bleu.png $(ICONS)/8x8/apps/addappendix.png
	cp -f $(Sharedir)/icons/hicolor/8x8/apps/addappendix.png $(ICONS)/8x8/apps/addappendix.png
	#
	# Attention il faut que toute la commande soit sur la même ligne d'où le caractère escape '\'
	# On ne peut mettre à jour la base de données que si les images sont installées dans le système
	# La ligne suivante est à inclure dans 'postinst' du paquet ubuntu
	@if [ -z $(DESTDIR) ]; then sudo gtk-update-icon-cache -t /usr/share/icons/hicolor;fi

	# Install languages after directories installation
	install -d $(LANG)/de/LC_MESSAGES $(LANG)/en/LC_MESSAGES $(LANG)/fr/LC_MESSAGES $(LANG)/es/LC_MESSAGES
	## de
	#cp -f $(Localedir)/de/LC_MESSAGES/*.mo $(LANG)/de/LC_MESSAGES/.
	## en
	#cp -f $(Localedir)/en/LC_MESSAGES/*.mo $(LANG)/en/LC_MESSAGES/.
	## es
	#cp -f $(Localedir)/es/LC_MESSAGES/*.mo $(LANG)/es/LC_MESSAGES/.
	## fr
	cp -f $(Localedir)/fr/LC_MESSAGES/*.mo $(LANG)/fr/LC_MESSAGES/.
	cp -u $(Langdir)/fr/add_appendix.mo $(LANG)/fr/LC_MESSAGES/add_appendix.mo
	cp -u $(Langdir)/fr/annex.mo $(LANG)/fr/LC_MESSAGES/annex.mo
	cp -u $(Langdir)/fr/header.inc.mo $(LANG)/fr/LC_MESSAGES/header.inc.mo

	#install manuals
	install -d $(MAN) $(MAN)/man1 $(MAN)/de/man1 $(MAN)/en/man1 $(MAN)/es/man1 $(MAN)/fr/man1 $(MAN)/fr.UTF-8/man1
	## Default manual
	@if [ -e $(Mandir)/man1/add_appendix.1.gz ]; then catman -M $(Man)/man1/add_appendix.1.gz; fi
	@if [ -e $(mandir)/man1/annex.1.gz ]; then catman -M $(MAN)/man1/annex.1.gz; fi
	@if [ -e $(mandir)/man1/compil2bin.1.gz; then catman -M $(MAN)/man1/compil2bin.1.gz; fi
	## de
	## en
	## es
	## fr
	@if [ -e $(Mandir)/fr.UTF-8/man1/add_appendix.1.gz ]; then catman -M $(MAN)/fr.UTF-8/man1/add_appendix.1.gz; fi
	@if [ -e $(Mandir)/fr.UTF-8/man1/annex.1.gz; then catman -M $(MAN)/fr.UTF-8/man1/annex.1.gz; fi
	@if [ -e $(Mandir)/fr.UTF-8/man1/annexer.1.gz; then catman -M $(MAN)/fr.UTF-8/man1/annexer.1.gz; fi
	# La ligne suivante est à inclure dans 'postinst' du paquet ubuntu
	@if [ -z $(DESTDIR) ]; then mandb -u; fi

	#install mime
	install -d $(MIME)
	@if [ -e $Sharedir/mime/packages/addappendix.xml ]; then cp -f $Sharedir/mime/package/addappendix.xml $(MIME)/packages/addappendix.xml; fi
	@if [ -e $Sharedir/mime/packages/annexer.xml ]; then cp -f $Sharedir/mime/packages/annexer.xml $(MIME)/packages/annexer.xml; fi
	# La ligne suivante est à inclure dans 'postinst' du paquet ubuntu
	@if [ -z $(DESTDIR) ]; then sudo update-mime-database /usr/share/mime; fi

	
	#install archives
	#install -d $(ARCHIVES)/books
	#cp -rf ./archives/books/* $(ARCHIVES)/books/.
		
clean:
	rm -rf ./tmp

Résultat des tests[modifier | modifier le wikicode]

Les deux commandes add_appendix.sh et annexer.sh permettront d'éviter de commencer à créer manuellement le répertoire des livres contenant la liste des pages à indexer
jpl@jpl-GE60-2OC-2OE:~/packaging/addappendix$ find tests
tests
tests/usr
tests/usr/share
tests/usr/share/man
tests/usr/share/man/es
tests/usr/share/man/es/man1
tests/usr/share/man/en
tests/usr/share/man/en/man1
tests/usr/share/man/de
tests/usr/share/man/de/man1
tests/usr/share/man/fr
tests/usr/share/man/fr/man1
tests/usr/share/man/man1
tests/usr/share/man/fr.UTF-8
tests/usr/share/man/fr.UTF-8/man1
tests/usr/share/locale
tests/usr/share/locale/es
tests/usr/share/locale/es/LC_MESSAGES
tests/usr/share/locale/en
tests/usr/share/locale/en/LC_MESSAGES
tests/usr/share/locale/de
tests/usr/share/locale/de/LC_MESSAGES
tests/usr/share/locale/fr
tests/usr/share/locale/fr/LC_MESSAGES
tests/usr/share/locale/fr/LC_MESSAGES/add_sclipwb.mo
tests/usr/share/locale/fr/LC_MESSAGES/header.inc.mo
tests/usr/share/locale/fr/LC_MESSAGES/en_sclipco.inc.mo
tests/usr/share/locale/fr/LC_MESSAGES/en_sclt.inc.mo
tests/usr/share/locale/fr/LC_MESSAGES/en_sclipwb.inc.mo
tests/usr/share/locale/fr/LC_MESSAGES/annexer.mo
tests/usr/share/locale/fr/LC_MESSAGES/add_appendix.mo
tests/usr/share/locale/fr/LC_MESSAGES/add_sclt.mo
tests/usr/share/locale/fr/LC_MESSAGES/annex.mo
tests/usr/share/locale/fr/LC_MESSAGES/en_sclic.inc.mo
tests/usr/share/locale/fr/LC_MESSAGES/add_sclipco.mo
tests/usr/share/locale/fr/LC_MESSAGES/add_sclic.mo
tests/usr/share/icons
tests/usr/share/icons/hicolor
tests/usr/share/icons/hicolor/48x48
tests/usr/share/icons/hicolor/48x48/apps
tests/usr/share/icons/hicolor/48x48/apps/addappendix.png
tests/usr/share/icons/hicolor/16x16
tests/usr/share/icons/hicolor/16x16/apps
tests/usr/share/icons/hicolor/16x16/apps/addappendix.png
tests/usr/share/icons/hicolor/256x256
tests/usr/share/icons/hicolor/256x256/apps
tests/usr/share/icons/hicolor/256x256/mimetypes
tests/usr/share/icons/hicolor/256x256/mimetypes/addappendix.svg
tests/usr/share/icons/hicolor/256x256/mimetypes/addappendix.png
tests/usr/share/icons/hicolor/32x32
tests/usr/share/icons/hicolor/32x32/apps
tests/usr/share/icons/hicolor/32x32/apps/addappendix.png
tests/usr/share/icons/hicolor/8x8
tests/usr/share/icons/hicolor/8x8/apps
tests/usr/share/icons/hicolor/8x8/apps/addappendix.png
tests/usr/share/icons/hicolor/scalable
tests/usr/share/icons/hicolor/scalable/mimetypes
tests/usr/share/icons/hicolor/scalable/mimetypes/addappendix.svg
tests/usr/share/mime
tests/usr/local
tests/usr/local/bin
tests/usr/local/bin/add_sclic
tests/usr/local/bin/fr_sclt.inc
tests/usr/local/bin/annex
tests/usr/local/bin/add_sclipwb
tests/usr/local/bin/pre-annex
tests/usr/local/bin/fr_sclipwb.inc
tests/usr/local/bin/add_appendix
tests/usr/local/bin/en_sclic.inc
tests/usr/local/bin/bookurl.txt
tests/usr/local/bin/add_sclt
tests/usr/local/bin/en_sclt.inc
tests/usr/local/bin/header.inc
tests/usr/local/bin/annexer
tests/usr/local/bin/mwbookurl.txt
tests/usr/local/bin/en_sclipco.inc
tests/usr/local/bin/en_sclipwb.inc
tests/usr/local/bin/add_sclipco
tests/usr/local/bin/scli.inc
tests/usr/local/bin/README
tests/usr/local/bin/list
tests/usr/local/bin/fr_sclipco.inc
tests/usr/local/bin/fr_sclic.inc
tests/usr/local/bin/download
tests/usr/local/share
tests/usr/local/share/addappendix
tests/usr/local/share/addappendix/doc
tests/usr/local/src
tests/usr/local/src/Add_appendix
tests/usr/local/src/Add_appendix/add_sclic.sh
tests/usr/local/src/Add_appendix/list.sh
tests/usr/local/src/Add_appendix/en_sclic.inc.sh
tests/usr/local/src/Add_appendix/files_list
tests/usr/local/src/Add_appendix/en_sclipwb.inc.sh
tests/usr/local/src/Add_appendix/add_sclipwb.sh
tests/usr/local/src/Add_appendix/addappendix.sh
tests/usr/local/src/Add_appendix/header.inc.sh
tests/usr/local/src/Add_appendix/download.sh
tests/usr/local/src/Add_appendix/fr_sclic.inc.sh
tests/usr/local/src/Add_appendix/annexer.sh
tests/usr/local/src/Add_appendix/FILES-VERSIONS.txt
tests/usr/local/src/Add_appendix/add_sclipco.sh
tests/usr/local/src/Add_appendix/fr_sclt.inc.sh
tests/usr/local/src/Add_appendix/scli.inc.sh
tests/usr/local/src/Add_appendix/annex.sh
tests/usr/local/src/Add_appendix/en_sclipco.inc.sh
tests/usr/local/src/Add_appendix/fr_sclipwb.inc.sh
tests/usr/local/src/Add_appendix/fr_sclipco.inc.sh
tests/usr/local/src/Add_appendix/en_sclt.inc.sh
tests/usr/local/src/Add_appendix/pre-annex.sh
tests/usr/local/src/Add_appendix/add_sclt.sh
tests/usr/local/lib
tests/usr/local/lib/cpcleaned2bin.lib
tests/usr/local/lib/ecf.lib
tests/usr/local/lib/killalldoc.lib
tests/usr/local/lib/findbook.lib
tests/usr/local/lib/src
tests/usr/local/lib/src/findbook.sh
tests/usr/local/lib/src/files_list
tests/usr/local/lib/src/FILES-VERSIONS.txt
tests/usr/local/lib/src/ecfpc.sh
tests/usr/local/lib/src/annex.lib.sh
tests/usr/local/lib/src/killalldoc.sh
tests/usr/local/lib/src/cpcleaned2bin.sh
tests/usr/local/lib/src/ecfpb.sh
tests/usr/local/lib/updt-annex-lib.sh
tests/usr/local/lib/annex.lib
tests/usr/local/sbin
tests/usr/local/sbin/userman
tests/usr/local/sbin/sbin_files.list
tests/usr/local/sbin/sbin_files.versions.txt
tests/usr/local/sbin/install_datasfiles
tests/usr/local/sbin/install_annex
tests/usr/local/sbin/users_install_annex
tests/usr/local/sbin/htmlman
tests/usr/local/sbin/BINFILES_VERSIONS
tests/usr/local/sbin/makeman_annex
tests/usr/local/sbin/sbin_files.versions2.txt
tests/usr/local/sbin/src
tests/usr/local/sbin/src/install_datasfiles.sh
tests/usr/local/sbin/src/install_annex.sh
tests/usr/local/sbin/src/users_install_annex.sh
tests/usr/local/sbin/src/SRCFILES_VERSIONS
tests/usr/local/sbin/src/compil2bin.sh
tests/usr/local/sbin/src/findversions.sh
tests/usr/local/sbin/src/makeman_annex.sh
tests/usr/local/sbin/src/.txt
tests/usr/local/sbin/src/list.txt
tests/usr/local/sbin/compil2bin
tests/usr/local/sbin/findversions
tests/usr/local/sbin/textman
tests/usr/local/sbin/docu2html
tests/usr/local/sbin/updt-manuals
tests/usr/local/etc
tests/usr/local/datas
tests/usr/local/datas/content_cleaner.dat
tests/usr/local/datas/conversions.dat
tests/usr/local/datas/unrecognized_links.dat
tests/var
tests/var/cache
tests/var/cache/man
tests/var/cache/man/fr.UTF-8
tests/var/cache/man/fr.UTF-8/cat1