Makefile 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. # Makefile for Qi.
  2. #
  3. # Copyright (c) 2015-2018 Matias Fonzo, <selk@dragora.org>.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. project = qi
  17. version = 1.0-rc25
  18. ## DO NOT MAKE CHANGES HERE.
  19. #
  20. # Use config.mak to override any of the following variables:
  21. prefix = /usr/local
  22. exec_prefix = $(prefix)
  23. bindir = $(exec_prefix)/bin
  24. sbindir = $(exec_prefix)/sbin
  25. libexecdir = $(exec_prefix)/libexec
  26. sysconfdir = $(prefix)/etc
  27. localstatedir = $(prefix)/var
  28. datarootdir = $(prefix)/share
  29. infodir = $(datarootdir)/info
  30. mandir = $(datarootdir)/man
  31. docdir = $(datarootdir)/doc
  32. packagedir = $(prefix)/pkg
  33. targetdir = /
  34. ##
  35. DISTNAME = ${project}-${version}
  36. MAKEINFO = makeinfo
  37. INSTALL = install
  38. INSTALL_PROGRAM = ${INSTALL} -p -m 755
  39. INSTALL_DATA = ${INSTALL} -p -m 644
  40. INSTALL_DIR = ${INSTALL} -d -m 755
  41. HELP2MAN_OPTS = --version-option=-V
  42. .PHONY: all \
  43. doc info man html \
  44. dist distclean clean \
  45. install install-info \
  46. uninstall uninstall-info
  47. -include config.mak
  48. all : $(project) $(project)rc
  49. $(project) : src/$(project)
  50. src/$(project) : src/$(project).in
  51. @echo "Making tool: src/$(project) ..."
  52. @sed -e "s|@VERSION@|$(version)|g" \
  53. -e "s|@PREFIX@|$(prefix)|g" \
  54. -e "s|@BINDIR@|$(bindir)|g" \
  55. -e "s|@SBINDIR@|$(sbindir)|g" \
  56. -e "s|@LIBEXECDIR@|$(libexecdir)|g" \
  57. -e "s|@SYSCONFDIR@|$(sysconfdir)|g" \
  58. -e "s|@LOCALSTATEDIR@|$(localstatedir)|g" \
  59. -e "s|@INFODIR@|$(infodir)|g" \
  60. -e "s|@MANDIR@|$(mandir)|g" \
  61. -e "s|@DOCDIR@|$(docdir)|g" \
  62. -e "s|@PACKAGEDIR@|$(packagedir)|g" \
  63. -e "s|@TARGETDIR@|$(targetdir)|g" \
  64. $< > $@ && \
  65. chmod 755 $@
  66. $(project)rc : etc/$(project)rc
  67. etc/$(project)rc : etc/$(project)rc.in
  68. @echo "Making config: etc/$(project)rc ..."
  69. @sed -e "s|@PREFIX@|$(prefix)|g" \
  70. -e "s|@BINDIR@|$(bindir)|g" \
  71. -e "s|@SBINDIR@|$(sbindir)|g" \
  72. -e "s|@LIBEXECDIR@|$(libexecdir)|g" \
  73. -e "s|@SYSCONFDIR@|$(sysconfdir)|g" \
  74. -e "s|@LOCALSTATEDIR@|$(localstatedir)|g" \
  75. -e "s|@INFODIR@|$(infodir)|g" \
  76. -e "s|@MANDIR@|$(mandir)|g" \
  77. -e "s|@DOCDIR@|$(docdir)|g" \
  78. -e "s|@PACKAGEDIR@|$(packagedir)|g" \
  79. -e "s|@TARGETDIR@|$(targetdir)|g" \
  80. $< > $@ && \
  81. chmod 644 $@
  82. doc : info man html
  83. info : doc/$(project).info
  84. doc/$(project).info : doc/$(project).texi
  85. cd doc && LC_ALL=C $(MAKEINFO) $(project).texi
  86. man : doc/qi.1
  87. doc/qi.1 : src/qi
  88. LC_ALL=C help2man ${HELP2MAN_OPTS} \
  89. -n 'package manager' -o $@ src/qi
  90. html : doc/$(project).html
  91. doc/$(project).html : doc/$(project).texi
  92. cd doc && LC_ALL=C $(MAKEINFO) --html --no-split \
  93. --css-ref=document-1.0.1.css $(project).texi
  94. dist : doc
  95. ln -sf . $(DISTNAME)
  96. tar -Hustar -cvf $(DISTNAME).tar \
  97. $(DISTNAME)/AUTHORS \
  98. $(DISTNAME)/COPYING \
  99. $(DISTNAME)/CREDITS \
  100. $(DISTNAME)/Makefile \
  101. $(DISTNAME)/NEWS \
  102. $(DISTNAME)/README \
  103. $(DISTNAME)/configure \
  104. $(DISTNAME)/doc/recipe \
  105. $(DISTNAME)/doc/document*.css \
  106. $(DISTNAME)/doc/example.order \
  107. $(DISTNAME)/doc/fdl.texi \
  108. $(DISTNAME)/doc/qi.1 \
  109. $(DISTNAME)/doc/$(project).html \
  110. $(DISTNAME)/doc/$(project).info \
  111. $(DISTNAME)/doc/$(project).texi \
  112. $(DISTNAME)/etc/$(project)rc.in \
  113. $(DISTNAME)/src/qi.in
  114. rm -f $(DISTNAME)
  115. lzip -v -9 $(DISTNAME).tar
  116. distclean : clean
  117. -rm -f *.tar *.tar.lz
  118. clean :
  119. -rm -f src/$(project) etc/$(project)rc config.mak
  120. install : all install-info install-man
  121. @echo "*** Checking required directories ..."
  122. if [ ! -d "$(DESTDIR)${bindir}" ] ; then \
  123. $(INSTALL_DIR) "$(DESTDIR)${bindir}" ; \
  124. fi
  125. if [ ! -d "$(DESTDIR)${sysconfdir}" ] ; then \
  126. $(INSTALL_DIR) "$(DESTDIR)${sysconfdir}" ; \
  127. fi
  128. @echo "*** Installing on $(DESTDIR)${bindir} ..."
  129. $(INSTALL_PROGRAM) src/$(project) "$(DESTDIR)${bindir}/$(project)"
  130. @echo "*** Installing config file on $(DESTDIR)${sysconfdir} ..."
  131. $(INSTALL_DATA) etc/$(project)rc "$(DESTDIR)${sysconfdir}/$(project)rc"
  132. install-info :
  133. @echo "*** Checking required directory ..."
  134. if [ ! -d "$(DESTDIR)${infodir}" ] ; then \
  135. $(INSTALL_DIR) "$(DESTDIR)${infodir}" ; \
  136. fi
  137. @echo "*** Installing Info document on $(DESTDIR)${infodir} ..."
  138. $(INSTALL_DATA) doc/$(project).info \
  139. "$(DESTDIR)${infodir}/$(project).info"
  140. -install-info --info-dir="$(DESTDIR)${infodir}" \
  141. "$(DESTDIR)${infodir}/$(project).info"
  142. install-man :
  143. if [ ! -d "$(DESTDIR)${mandir}/man1" ] ; then \
  144. $(INSTALL_DIR) "$(DESTDIR)${mandir}/man1" ; \
  145. fi
  146. @echo "*** Installing manual pages on $(DESTDIR)${mandir}/man1 ..."
  147. $(INSTALL_DATA) doc/qi.1 "$(DESTDIR)${mandir}/man1"
  148. uninstall : uninstall-info uninstall-man
  149. @echo "*** Uninstalling from $(DESTDIR)${bindir} ..."
  150. -rm -f "$(DESTDIR)${bindir}/$(project)"
  151. -rm -f "$(DESTDIR)${sysconfdir}/$(project)rc"
  152. uninstall-info :
  153. -install-info \
  154. --info-dir="$(DESTDIR)${infodir}" \
  155. --remove "$(DESTDIR)${infodir}/$(project).info"
  156. -rm -f "$(DESTDIR)${infodir}/$(project).info"
  157. uninstall-man :
  158. -rm -f "$(DESTDIR)${mandir}/man1/qi.1"