Fork temporaire du dépôt eole-annuaire du projet EOLE Testé uniquement en 2.6.2 https://dev-eole.ac-dijon.fr/git/eole-annuaire.git https://dev-eole.ac-dijon.fr/projects/eole-annuaire
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

eole.mk 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. #
  2. # NE PAS EDITER CE FICHIER
  3. #
  4. # Utiliser <appli>.mk à inclure à la fin de Makefile
  5. #################
  6. # Sanity checks #
  7. #################
  8. ifeq (, $(DESTDIR))
  9. $(warning $$(DESTDIR) is empty, installation will be done in /)
  10. endif
  11. ifeq (, $(filter-out XXX-XXX, $(strip $(SOURCE))))
  12. $(error $$(SOURCE) variable has incorrect value '$(SOURCE)')
  13. endif
  14. #########################
  15. # Variables definitions #
  16. #########################
  17. INSTALL := install
  18. INSTALL_DATA := install -m 644
  19. INSTALL_PROGRAM := install -m 755
  20. INSTALL_DIRECTORY := install -m 755 -d
  21. INSTALL_RECURSIVE := cp -dr --no-preserve=ownership
  22. # Standard path
  23. bin_PROG_DIR := $(DESTDIR)/usr/bin
  24. sbin_PROG_DIR := $(DESTDIR)/usr/sbin
  25. man8_DATA_DIR := $(DESTDIR)/usr/share/man/fr.UTF-8/man8
  26. # Base
  27. eole_DIR := $(DESTDIR)/usr/share/eole
  28. ifeq ($(strip $(EOLE_VERSION)), 2.3)
  29. diagnose_PROG_DIR := $(eole_DIR)/diagnose/module
  30. else
  31. diagnose_PROG_DIR := $(eole_DIR)/diagnose/
  32. endif
  33. # Creole
  34. creole_DIR := $(eole_DIR)/creole
  35. dicos_DATA_DIR := $(creole_DIR)/dicos
  36. tmpl_DATA_DIR := $(creole_DIR)/distrib
  37. preservice_PROG_DIR := $(eole_DIR)/preservice
  38. pretemplate_PROG_DIR := $(eole_DIR)/pretemplate
  39. posttemplate_PROG_DIR := $(eole_DIR)/posttemplate
  40. postservice_PROG_DIR := $(eole_DIR)/postservice
  41. ifeq ($(strip $(EOLE_VERSION)), 2.3)
  42. firewall_DATA_DIR := $(eole_DIR)/firewall
  43. endif
  44. bacula_restore_DATA_DIR := $(eole_DIR)/bacula/restore
  45. bareos_restore_DATA_DIR := $(eole_DIR)/bareos/restore
  46. bacula_fichier_DATA_DIR := $(DESTDIR)/etc/bacula/baculafichiers.d
  47. bareos_fichier_DATA_DIR := $(DESTDIR)/etc/bareos/bareosfichiers.d
  48. ifeq ($(strip $(EOLE_VERSION)), 2.3)
  49. schedule_pre_PROG_DIR := $(eole_DIR)/schedule/pre
  50. schedule_post_PROG_DIR := $(eole_DIR)/schedule/post
  51. else
  52. schedule_scripts_PROG_DIR := $(eole_DIR)/schedule/scripts
  53. endif
  54. extra_REC_DIR := $(creole_DIR)/extra
  55. # Zéphir
  56. zephir_DATA_DIR := $(DESTDIR)/usr/share/zephir
  57. zephir_configs_DATA_DIR := $(zephir_DATA_DIR)/monitor/configs
  58. zephir_srv_DATA_DIR := $(zephir_configs_DATA_DIR)/services
  59. zephir_scripts_PROG_DIR := $(zephir_DATA_DIR)/scripts
  60. # SSO
  61. sso_DATA_DIR := $(DESTDIR)/usr/share/sso
  62. sso_filtres_DATA_DIR := $(sso_DATA_DIR)/app_filters
  63. sso_user-info_DATA_DIR := $(sso_DATA_DIR)/user_infos
  64. # EAD
  65. ead_DATA_DIR := $(DESTDIR)/usr/share/ead2/backend/config
  66. ead_actions_DATA_DIR := $(ead_DATA_DIR)/actions
  67. ead_perms_DATA_DIR := $(ead_DATA_DIR)/perms
  68. ead_roles_DATA_DIR := $(ead_DATA_DIR)/roles
  69. # Program libraries goes under /usr/lib/<PROGRAM>/
  70. lib_$(SOURCE)_DATA_DIR := $(DESTDIR)/usr/lib/$(SOURCE)
  71. # Scripts Eole
  72. scripts_PROG_DIR := $(eole_DIR)/sbin
  73. lib_eole_DATA_DIR := $(DESTDIR)/usr/lib/eole
  74. # LDAP
  75. ldap_passwords_DATA_DIR := $(eole_DIR)/annuaire/password_files
  76. # LXC
  77. lxc_DATA_DIR := $(eole_DIR)/lxc
  78. lxc_fstab_DATA_DIR := $(lxc_DATA_DIR)/fstab
  79. lxc_hosts_DATA_DIR := $(lxc_DATA_DIR)/hosts
  80. # SQL
  81. sql_DATA_DIR := $(eole_DIR)/mysql/$(SOURCE)
  82. sql_gen_DATA_DIR := $(sql_DATA_DIR)/gen
  83. sql_updates_DATA_DIR := $(sql_DATA_DIR)/updates
  84. sql_conf_gen_DATA_DIR := $(eole_DIR)/applications/gen
  85. sql_conf_passwords_DATA_DIR := $(eole_DIR)/applications/passwords
  86. sql_conf_updates_DATA_DIR := $(eole_DIR)/applications/updates/$(SOURCE)
  87. # Certifs
  88. certs_DATA_DIR := $(eole_DIR)/certs
  89. # Logrotate
  90. logrotate_DATA_DIR := $(DESTDIR)/etc/logrotate.d
  91. # Cron
  92. cron_PROG_DIR := $(DESTDIR)/etc/cron.daily
  93. # Python modules
  94. ifneq ($(DESTDIR),)
  95. PYTHON_OPTS := --root $(DESTDIR)
  96. endif
  97. # Translation
  98. TRANSLATION_SRC := translation
  99. TRANSLATION_DEST := $(DESTDIR)/usr/share/locale
  100. PO_FILES = $(wildcard $(TRANSLATION_SRC)/*/*.po)
  101. MO_FOLDERS = $(addprefix $(TRANSLATION_DEST), $(addsuffix LC_MESSAGES,$(subst $(TRANSLATION_SRC),,$(dir $(PO_FILES)))))
  102. #############################################
  103. # Common directories and files installation #
  104. #############################################
  105. all:
  106. $(MO_FOLDERS):
  107. $(INSTALL_DIRECTORY) $@
  108. $(PO_FILES): $(MO_FOLDERS)
  109. msgfmt -o $(TRANSLATION_DEST)$(subst $(TRANSLATION_SRC),,$(addsuffix LC_MESSAGES,$(dir $@)))/$(notdir $(@:.po=.mo)) $@
  110. install-lang: $(PO_FILES)
  111. install:: install-dirs install-files install-lang
  112. # $1 = command to run
  113. # $2 = source directory
  114. # $3 = destination directory
  115. define fc_install_file
  116. if [ -d $2 ]; then \
  117. for file in `ls -1 $2/`; do \
  118. $1 $2/$$file $3 || true; \
  119. done; \
  120. fi
  121. endef
  122. ##
  123. ## Directory creation
  124. ##
  125. # use % to catch local name in $*
  126. # data, program and recursive directory require a corresponding
  127. # directory in local sources
  128. %_DATA_DIR %_PROG_DIR %REC_DIR:
  129. test ! -d $(subst _,/,$*) || $(INSTALL_DIRECTORY) $($@)
  130. # Create the directory referenced by the variable without a local one.
  131. %_DIR:
  132. $(INSTALL_DIRECTORY) $($@)
  133. ##
  134. ## Install files present directly under data, program and recursive directories
  135. ##
  136. # $* : name of variable
  137. # $($*): value of variable
  138. %-instdata:
  139. $(call fc_install_file, $(INSTALL_DATA), $(subst _,/,$(subst _DATA_DIR,,$*)), $($*))
  140. %-instprog:
  141. $(call fc_install_file, $(INSTALL_PROGRAM), $(subst _,/,$(subst _PROG_DIR,,$*)), $($*))
  142. %-instrec:
  143. $(call fc_install_file, $(INSTALL_RECURSIVE), $(subst _,/,$(subst _REC_DIR,,$*)), $($*))
  144. # Use second expansion as variables may be created in included
  145. # Makefiles
  146. .SECONDEXPANSION:
  147. # List of all directories
  148. installdirs_LIST = $(foreach V, $(filter %_DIR, $(.VARIABLES)), \
  149. $(if $(filter file, $(origin $(V))), \
  150. $(V)))
  151. # List of data directories
  152. installdata_LIST = $(filter %_DATA_DIR, $(installdirs_LIST))
  153. # List of program directories
  154. installprog_LIST = $(filter %_PROG_DIR, $(installdirs_LIST))
  155. # List of recursive directories
  156. installrec_LIST = $(filter %_REC_DIR, $(installdirs_LIST))
  157. # Expand directories to create as dependency
  158. # Use double-colon to permit user to define additionnal install-dirs
  159. install-dirs:: $$(installdirs_LIST)
  160. # Expand files to install as dependency
  161. # Use double-colon to permit user to define additionnal install-files
  162. install-files:: install-data-files install-prog-files install-rec-dirs
  163. install-data-files: $$(patsubst %,%-instdata,$$(installdata_LIST))
  164. install-prog-files: $$(patsubst %,%-instprog,$$(installprog_LIST))
  165. install-rec-dirs: $$(patsubst %,%-instrec,$$(installrec_LIST))
  166. # Installation of python modules
  167. ifeq ($(shell test -f setup.py && echo 0), 0)
  168. install-files::
  169. python setup.py install --no-compile --install-layout=deb $(PYTHON_OPTS)
  170. endif
  171. .PHONY: install install-dirs install-files install-data-files install-prog-files install-rec-dirs