Makefile 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. # Makefile for Qi.
  2. #
  3. # Copyright (c) 2015-2019 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.3
  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 = /usr/local/pkgs
  33. targetdir = /usr/local
  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 = mkdir -p -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 'a simple but well-integrated package manager' \
  90. -o $@ src/qi
  91. html : doc/$(project).html
  92. doc/$(project).html : doc/$(project).texi
  93. cd doc && LC_ALL=C $(MAKEINFO) --html --no-split \
  94. $(project).texi
  95. dist : doc
  96. ln -sf . $(DISTNAME)
  97. tarlz --solid -9 -cvf $(DISTNAME).tar.lz \
  98. $(DISTNAME)/AUTHORS \
  99. $(DISTNAME)/COPYING \
  100. $(DISTNAME)/CREDITS \
  101. $(DISTNAME)/Makefile \
  102. $(DISTNAME)/NEWS \
  103. $(DISTNAME)/README \
  104. $(DISTNAME)/configure \
  105. $(DISTNAME)/doc/example.order \
  106. $(DISTNAME)/doc/fdl.txt \
  107. $(DISTNAME)/doc/qi.1 \
  108. $(DISTNAME)/doc/$(project).html \
  109. $(DISTNAME)/doc/$(project).info \
  110. $(DISTNAME)/doc/$(project).texi \
  111. $(DISTNAME)/doc/recipe1 \
  112. $(DISTNAME)/doc/recipe2 \
  113. $(DISTNAME)/doc/recipe3 \
  114. $(DISTNAME)/etc/$(project)rc.in \
  115. $(DISTNAME)/src/qi.in
  116. rm -f $(DISTNAME)
  117. sha256sum $(DISTNAME).tar.lz > $(DISTNAME).tar.lz.sha256
  118. distclean : clean
  119. -rm -f *.tar *.tar.lz *.tar.lz.*
  120. clean :
  121. -rm -f src/$(project) etc/$(project)rc config.mak
  122. install : all install-info install-man
  123. @echo "*** Checking required directories ..."
  124. if [ ! -d "$(DESTDIR)${bindir}" ] ; then \
  125. $(INSTALL_DIR) "$(DESTDIR)${bindir}" ; \
  126. fi
  127. if [ ! -d "$(DESTDIR)${sysconfdir}" ] ; then \
  128. $(INSTALL_DIR) "$(DESTDIR)${sysconfdir}" ; \
  129. fi
  130. @echo "*** Installing on $(DESTDIR)${bindir} ..."
  131. $(INSTALL_PROGRAM) src/$(project) "$(DESTDIR)${bindir}/$(project)"
  132. @echo "*** Installing config file on $(DESTDIR)${sysconfdir} ..."
  133. $(INSTALL_DATA) etc/$(project)rc "$(DESTDIR)${sysconfdir}/$(project)rc"
  134. @echo "Done."
  135. install-info :
  136. @echo "*** Checking required directory ..."
  137. if [ ! -d "$(DESTDIR)${infodir}" ] ; then \
  138. $(INSTALL_DIR) "$(DESTDIR)${infodir}" ; \
  139. fi
  140. @echo "*** Installing Info document on $(DESTDIR)${infodir} ..."
  141. $(INSTALL_DATA) doc/$(project).info \
  142. "$(DESTDIR)${infodir}/$(project).info"
  143. -install-info --info-dir="$(DESTDIR)${infodir}" \
  144. "$(DESTDIR)${infodir}/$(project).info"
  145. install-man :
  146. if [ ! -d "$(DESTDIR)${mandir}/man1" ] ; then \
  147. $(INSTALL_DIR) "$(DESTDIR)${mandir}/man1" ; \
  148. fi
  149. @echo "*** Installing manual pages on $(DESTDIR)${mandir}/man1 ..."
  150. $(INSTALL_DATA) doc/qi.1 "$(DESTDIR)${mandir}/man1"
  151. uninstall : uninstall-info uninstall-man
  152. @echo "*** Uninstalling from $(DESTDIR)${bindir} ..."
  153. -rm -f "$(DESTDIR)${bindir}/$(project)"
  154. -rm -f "$(DESTDIR)${sysconfdir}/$(project)rc"
  155. uninstall-info :
  156. -install-info \
  157. --info-dir="$(DESTDIR)${infodir}" \
  158. --remove "$(DESTDIR)${infodir}/$(project).info"
  159. -rm -f "$(DESTDIR)${infodir}/$(project).info"
  160. uninstall-man :
  161. -rm -f "$(DESTDIR)${mandir}/man1/qi.1"