No Description

eole.mk 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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. pretemplate_PROG_DIR := $(eole_DIR)/pretemplate
  38. posttemplate_PROG_DIR := $(eole_DIR)/posttemplate
  39. postservice_PROG_DIR := $(eole_DIR)/postservice
  40. firewall_DATA_DIR := $(eole_DIR)/firewall
  41. bacula_restore_DATA_DIR := $(eole_DIR)/bacula/restore
  42. bacula_fichier_DATA_DIR := $(DESTDIR)/etc/bacula/baculafichiers.d
  43. ifeq ($(strip $(EOLE_VERSION)), 2.3)
  44. schedule_pre_PROG_DIR := $(eole_DIR)/schedule/pre
  45. schedule_post_PROG_DIR := $(eole_DIR)/schedule/post
  46. else
  47. schedule_scripts_PROG_DIR := $(eole_DIR)/schedule/scripts
  48. endif
  49. extra_REC_DIR := $(creole_DIR)/extra
  50. # Zéphir
  51. zephir_DATA_DIR := $(DESTDIR)/usr/share/zephir
  52. zephir_configs_DATA_DIR := $(zephir_DATA_DIR)/monitor/configs
  53. zephir_srv_DATA_DIR := $(zephir_configs_DATA_DIR)/services
  54. zephir_scripts_PROG_DIR := $(zephir_DATA_DIR)/scripts
  55. # SSO
  56. sso_DATA_DIR := $(DESTDIR)/usr/share/sso
  57. sso_filtres_DATA_DIR := $(sso_DATA_DIR)/app_filters
  58. sso_user-info_DATA_DIR := $(sso_DATA_DIR)/user_infos
  59. # EAD
  60. ead_DATA_DIR := $(DESTDIR)/usr/share/ead2/backend/config
  61. ead_actions_DATA_DIR := $(ead_DATA_DIR)/actions
  62. ead_perms_DATA_DIR := $(ead_DATA_DIR)/perms
  63. ead_roles_DATA_DIR := $(ead_DATA_DIR)/roles
  64. # Program libraries goes under /usr/lib/<PROGRAM>/
  65. lib_$(SOURCE)_DATA_DIR := $(DESTDIR)/usr/lib/$(SOURCE)
  66. # Scripts Eole
  67. scripts_PROG_DIR := $(eole_DIR)/sbin
  68. lib_eole_DATA_DIR := $(DESTDIR)/usr/lib/eole
  69. # LDAP
  70. ldap_passwords_DATA_DIR := $(eole_DIR)/annuaire/password_files
  71. # LXC
  72. lxc_DATA_DIR := $(eole_DIR)/lxc
  73. lxc_fstab_DATA_DIR := $(lxc_DATA_DIR)/fstab
  74. lxc_hosts_DATA_DIR := $(lxc_DATA_DIR)/hosts
  75. # SQL
  76. sql_DATA_DIR := $(eole_DIR)/mysql/$(SOURCE)
  77. sql_gen_DATA_DIR := $(sql_DATA_DIR)/gen
  78. sql_updates_DATA_DIR := $(sql_DATA_DIR)/updates
  79. sql_conf_gen_DATA_DIR := $(eole_DIR)/applications/gen
  80. sql_conf_passwords_DATA_DIR := $(eole_DIR)/applications/passwords
  81. sql_conf_updates_DATA_DIR := $(eole_DIR)/applications/updates/$(SOURCE)
  82. # Certifs
  83. certs_DATA_DIR := $(eole_DIR)/certs
  84. # Logrotate
  85. logrotate_DATA_DIR := $(DESTDIR)/etc/logrotate.d
  86. # Cron
  87. cron_PROG_DIR := $(DESTDIR)/etc/cron.daily
  88. # Python modules
  89. ifneq ($(DESTDIR),)
  90. PYTHON_OPTS := --root $(DESTDIR)
  91. endif
  92. #############################################
  93. # Common directories and files installation #
  94. #############################################
  95. all:
  96. install:: install-dirs install-files
  97. # $1 = command to run
  98. # $2 = source directory
  99. # $3 = destination directory
  100. define fc_install_file
  101. if [ -d $2 ]; then \
  102. for file in `ls -1 $2/`; do \
  103. $1 $2/$$file $3 || true; \
  104. done; \
  105. fi
  106. endef
  107. ##
  108. ## Directory creation
  109. ##
  110. # use % to catch local name in $*
  111. # data, program and recursive directory require a corresponding
  112. # directory in local sources
  113. %_DATA_DIR %_PROG_DIR %REC_DIR:
  114. test ! -d $(subst _,/,$*) || $(INSTALL_DIRECTORY) $($@)
  115. # Create the directory referenced by the variable without a local one.
  116. %_DIR:
  117. $(INSTALL_DIRECTORY) $($@)
  118. ##
  119. ## Install files present directly under data, program and recursive directories
  120. ##
  121. # $* : name of variable
  122. # $($*): value of variable
  123. %-instdata:
  124. $(call fc_install_file, $(INSTALL_DATA), $(subst _,/,$(subst _DATA_DIR,,$*)), $($*))
  125. %-instprog:
  126. $(call fc_install_file, $(INSTALL_PROGRAM), $(subst _,/,$(subst _PROG_DIR,,$*)), $($*))
  127. %-instrec:
  128. $(call fc_install_file, $(INSTALL_RECURSIVE), $(subst _,/,$(subst _REC_DIR,,$*)), $($*))
  129. # Use second expansion as variables may be created in included
  130. # Makefiles
  131. .SECONDEXPANSION:
  132. # List of all directories
  133. installdirs_LIST = $(foreach V, $(filter %_DIR, $(.VARIABLES)), \
  134. $(if $(filter file, $(origin $(V))), \
  135. $(V)))
  136. # List of data directories
  137. installdata_LIST = $(filter %_DATA_DIR, $(installdirs_LIST))
  138. # List of program directories
  139. installprog_LIST = $(filter %_PROG_DIR, $(installdirs_LIST))
  140. # List of recursive directories
  141. installrec_LIST = $(filter %_REC_DIR, $(installdirs_LIST))
  142. # Expand directories to create as dependency
  143. # Use double-colon to permit user to define additionnal install-dirs
  144. install-dirs:: $$(installdirs_LIST)
  145. # Expand files to install as dependency
  146. # Use double-colon to permit user to define additionnal install-files
  147. install-files:: install-data-files install-prog-files install-rec-dirs
  148. install-data-files: $$(patsubst %,%-instdata,$$(installdata_LIST))
  149. install-prog-files: $$(patsubst %,%-instprog,$$(installprog_LIST))
  150. install-rec-dirs: $$(patsubst %,%-instrec,$$(installrec_LIST))
  151. # Installation of python modules
  152. ifeq ($(shell test -f setup.py && echo 0), 0)
  153. install-files::
  154. python setup.py install --no-compile --install-layout=deb $(PYTHON_OPTS)
  155. endif
  156. .PHONY: install install-dirs install-files install-data-files install-prog-files install-rec-dirs