qi: Bump to version 2.0 (Release Candidate 12)
[dragora.git] / qi / Makefile
blobb33948dcac56cbcd631af5ea2b60ef0ee4c3032b
1 # Makefile for Qi.
3 # Copyright (c) 2015-2020 Matias Fonzo, <selk@dragora.org>.
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 project = qi
18 version = 2.0rc12
20 ## DO NOT MAKE CHANGES HERE.
22 # Use config.mak to override any of the following variables:
23 prefix = /usr/local
24 exec_prefix = $(prefix)
25 bindir = $(exec_prefix)/bin
26 sbindir = $(exec_prefix)/sbin
27 libexecdir = $(exec_prefix)/libexec
28 sysconfdir = $(prefix)/etc
29 localstatedir = $(prefix)/var
30 datarootdir = $(prefix)/share
31 infodir = $(datarootdir)/info
32 mandir = $(datarootdir)/man
33 docdir = $(datarootdir)/doc
34 packagedir = /usr/local/pkgs
35 targetdir = /usr/local
36 arch = $(shell uname -m)
38 DISTNAME = ${project}-${version}
40 MAKEINFO = makeinfo
41 INSTALL = install
42 INSTALL_PROGRAM = ${INSTALL} -p -m 755
43 INSTALL_DATA = ${INSTALL} -p -m 644
44 INSTALL_DIR = mkdir -p -m 755
45 HELP2MAN_OPTS = --version-string=${version}
47 .PHONY: all \
48 doc info man html \
49 dist distclean clean \
50 install install-info \
51 uninstall uninstall-info
53 -include config.mak
56 all : $(project) $(project)rc
58 $(project) : src/$(project)
60 src/$(project) : src/$(project).in
62 @echo "Making src/$(project) ..."
63 @echo ""
64 sed -e "s|@VERSION@|$(version)|g" \
65 -e "s|@PREFIX@|$(prefix)|g" \
66 -e "s|@BINDIR@|$(bindir)|g" \
67 -e "s|@SBINDIR@|$(sbindir)|g" \
68 -e "s|@LIBEXECDIR@|$(libexecdir)|g" \
69 -e "s|@SYSCONFDIR@|$(sysconfdir)|g" \
70 -e "s|@LOCALSTATEDIR@|$(localstatedir)|g" \
71 -e "s|@INFODIR@|$(infodir)|g" \
72 -e "s|@MANDIR@|$(mandir)|g" \
73 -e "s|@DOCDIR@|$(docdir)|g" \
74 -e "s|@PACKAGEDIR@|$(packagedir)|g" \
75 -e "s|@TARGETDIR@|$(targetdir)|g" \
76 -e "s|@ARCH@|$(arch)|g" \
77 $< > $@ && \
78 chmod 755 $@
80 $(project)rc : etc/$(project)rc
82 etc/$(project)rc : etc/$(project)rc.in
84 @echo "Making config: etc/$(project)rc ..."
85 @echo ""
86 sed -e "s|@PREFIX@|$(prefix)|g" \
87 -e "s|@BINDIR@|$(bindir)|g" \
88 -e "s|@SBINDIR@|$(sbindir)|g" \
89 -e "s|@LIBEXECDIR@|$(libexecdir)|g" \
90 -e "s|@SYSCONFDIR@|$(sysconfdir)|g" \
91 -e "s|@LOCALSTATEDIR@|$(localstatedir)|g" \
92 -e "s|@INFODIR@|$(infodir)|g" \
93 -e "s|@MANDIR@|$(mandir)|g" \
94 -e "s|@DOCDIR@|$(docdir)|g" \
95 -e "s|@PACKAGEDIR@|$(packagedir)|g" \
96 -e "s|@TARGETDIR@|$(targetdir)|g" \
97 -e "s|@ARCH@|$(arch)|g" \
98 $< > $@ && \
99 chmod 644 $@
101 doc : info man html
103 info : doc/$(project).info
105 doc/$(project).info : doc/$(project).texi
106 cd doc && LC_ALL=C $(MAKEINFO) $(project).texi
108 man : doc/qi.1
110 doc/qi.1 : src/qi
111 LC_ALL=C help2man ${HELP2MAN_OPTS} \
112 --name="a simple but well-integrated package manager" \
113 --output=$@ src/qi
115 html : doc/$(project).html
117 doc/$(project).html : doc/$(project).texi
118 cd doc && LC_ALL=C $(MAKEINFO) --html --no-split \
119 $(project).texi
121 dist : doc
122 rm -f $(DISTNAME)
123 ln -sf . $(DISTNAME)
124 tarlz --solid -9 -cvf $(DISTNAME).tar.lz \
125 $(DISTNAME)/AUTHORS \
126 $(DISTNAME)/COPYING \
127 $(DISTNAME)/CREDITS \
128 $(DISTNAME)/Makefile \
129 $(DISTNAME)/NEWS \
130 $(DISTNAME)/README.md \
131 $(DISTNAME)/configure \
132 $(DISTNAME)/doc/example.order \
133 $(DISTNAME)/doc/fdl.txt \
134 $(DISTNAME)/doc/qi.1 \
135 $(DISTNAME)/doc/$(project).html \
136 $(DISTNAME)/doc/$(project).info \
137 $(DISTNAME)/doc/$(project).texi \
138 $(DISTNAME)/doc/recipe1 \
139 $(DISTNAME)/doc/recipe2 \
140 $(DISTNAME)/doc/recipe3 \
141 $(DISTNAME)/etc/$(project)rc.in \
142 $(DISTNAME)/src/qi.in
143 rm -f $(DISTNAME)
144 sha256sum $(DISTNAME).tar.lz > $(DISTNAME).tar.lz.sha256
146 distclean : clean
147 -rm -f *.tar *.tar.lz *.tar.lz.*
149 clean :
150 -rm -f src/$(project) etc/$(project)rc config.mak
152 install : all install-info install-man
154 @echo ""
155 @echo "* Checking required directories ..."
156 if [ ! -d "$(DESTDIR)${bindir}" ] ; then \
157 $(INSTALL_DIR) "$(DESTDIR)${bindir}" ; \
159 if [ ! -d "$(DESTDIR)${sysconfdir}" ] ; then \
160 $(INSTALL_DIR) "$(DESTDIR)${sysconfdir}" ; \
163 @echo ""
164 @echo "* Installing on $(DESTDIR)${bindir} ..."
165 $(INSTALL_PROGRAM) src/$(project) "$(DESTDIR)${bindir}/$(project)"
167 @echo ""
168 @echo "* Installing config file on $(DESTDIR)${sysconfdir} ..."
169 $(INSTALL_DATA) etc/$(project)rc "$(DESTDIR)${sysconfdir}/$(project)rc"
171 @echo ""
172 @echo "* Creating package and target directory (if needed) ..."
173 if [ ! -d "$(DESTDIR)${packagedir}" ] ; then \
174 $(INSTALL_DIR) "$(DESTDIR)${packagedir}" ; \
176 if [ ! -d "$(DESTDIR)${targetdir}" ] ; then \
177 $(INSTALL_DIR) "$(DESTDIR)${targetdir}" ; \
179 @echo ""
180 @echo "Done."
182 install-info :
184 @echo ""
185 @echo "* Installing Info document on $(DESTDIR)${infodir} ..."
186 if [ ! -d "$(DESTDIR)${infodir}" ] ; then \
187 $(INSTALL_DIR) "$(DESTDIR)${infodir}" ; \
190 $(INSTALL_DATA) doc/$(project).info \
191 "$(DESTDIR)${infodir}/$(project).info"
193 -install-info --info-dir="$(DESTDIR)${infodir}" \
194 "$(DESTDIR)${infodir}/$(project).info"
196 install-man :
198 @echo ""
199 @echo "* Installing manual pages on $(DESTDIR)${mandir}/man1 ..."
200 if [ ! -d "$(DESTDIR)${mandir}/man1" ] ; then \
201 $(INSTALL_DIR) "$(DESTDIR)${mandir}/man1" ; \
204 $(INSTALL_DATA) doc/qi.1 "$(DESTDIR)${mandir}/man1"
206 uninstall : uninstall-info uninstall-man
208 @echo ""
209 @echo "* Uninstalling from $(DESTDIR)${bindir} ..."
210 -rm -f "$(DESTDIR)${bindir}/$(project)"
212 -rm -f "$(DESTDIR)${sysconfdir}/$(project)rc"
214 uninstall-info :
216 -install-info \
217 --info-dir="$(DESTDIR)${infodir}" \
218 --remove "$(DESTDIR)${infodir}/$(project).info"
220 -rm -f "$(DESTDIR)${infodir}/$(project).info"
222 uninstall-man :
224 -rm -f "$(DESTDIR)${mandir}/man1/qi.1"