TODO.md: Updated
[dragora.git] / qi / Makefile
blob9924745e5dacc2699714828c30c43c7c7aefc272
1 # Makefile for Qi.
3 # Copyright (c) 2015-2022 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.10
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 arch = $(shell uname -m)
35 packagedir = $(prefix)/pkgs
36 targetdir = $(prefix)
37 outdir = $(localstatedir)/cache/qi/packages
39 DISTNAME = ${project}-${version}
41 MAKEINFO = makeinfo
42 INSTALL = install
43 INSTALL_PROGRAM = ${INSTALL} -p -m 755
44 INSTALL_DATA = ${INSTALL} -p -m 644
45 INSTALL_DIR = mkdir -p -m 755
46 HELP2MAN_OPTS = --locale=C --version-string=${version}
48 .PHONY: all \
49 doc info man html \
50 dist distclean clean \
51 install install-info \
52 uninstall uninstall-info
54 -include config.mak
57 all : $(project) $(project)rc
59 $(project) : src/$(project)
61 src/$(project) : src/$(project).in
63 @echo "Making src/$(project) ..."
64 @echo ""
65 sed -e "s|@VERSION@|$(version)|g" \
66 -e "s|@PREFIX@|$(prefix)|g" \
67 -e "s|@BINDIR@|$(bindir)|g" \
68 -e "s|@SBINDIR@|$(sbindir)|g" \
69 -e "s|@LIBEXECDIR@|$(libexecdir)|g" \
70 -e "s|@SYSCONFDIR@|$(sysconfdir)|g" \
71 -e "s|@LOCALSTATEDIR@|$(localstatedir)|g" \
72 -e "s|@INFODIR@|$(infodir)|g" \
73 -e "s|@MANDIR@|$(mandir)|g" \
74 -e "s|@DOCDIR@|$(docdir)|g" \
75 -e "s|@ARCH@|$(arch)|g" \
76 -e "s|@PACKAGEDIR@|$(packagedir)|g" \
77 -e "s|@TARGETDIR@|$(targetdir)|g" \
78 -e "s|@OUTDIR@|$(outdir)|g" \
79 $< > $@ && \
80 chmod 755 $@
82 $(project)rc : etc/$(project)rc
84 etc/$(project)rc : etc/$(project)rc.in
86 @echo "Making config: etc/$(project)rc ..."
87 @echo ""
88 sed -e "s|@PREFIX@|$(prefix)|g" \
89 -e "s|@BINDIR@|$(bindir)|g" \
90 -e "s|@SBINDIR@|$(sbindir)|g" \
91 -e "s|@LIBEXECDIR@|$(libexecdir)|g" \
92 -e "s|@SYSCONFDIR@|$(sysconfdir)|g" \
93 -e "s|@LOCALSTATEDIR@|$(localstatedir)|g" \
94 -e "s|@INFODIR@|$(infodir)|g" \
95 -e "s|@MANDIR@|$(mandir)|g" \
96 -e "s|@DOCDIR@|$(docdir)|g" \
97 -e "s|@ARCH@|$(arch)|g" \
98 -e "s|@PACKAGEDIR@|$(packagedir)|g" \
99 -e "s|@TARGETDIR@|$(targetdir)|g" \
100 -e "s|@OUTDIR@|$(outdir)|g" \
101 $< > $@ && \
102 chmod 644 $@
104 doc : info man html
106 info : doc/$(project).info
108 doc/$(project).info : doc/$(project)-header.texi doc/$(project)-content.texi
109 cd doc && env LANG=C $(MAKEINFO) $(project)-header.texi -o $(project).info
111 man : doc/$(project).1
113 doc/qi.1 : doc/$(project).1.in src/$(project).in
114 env LANG=C help2man ${HELP2MAN_OPTS} \
115 --name="a simple but well-integrated package manager" \
116 --info-page=qi \
117 --output=$@ doc/$(project).1.in
118 sed -e "s#QI.1.IN#QI#g" -e "s#qi.1.in#qi#g" -i $@
120 html : doc/$(project).html
122 doc/$(project).html : doc/$(project)-header.texi doc/$(project)-content.texi
123 cd doc && env LANG=C $(MAKEINFO) --html --no-split \
124 $(project)-header.texi -o $(project).html
126 dist : doc
127 rm -f $(DISTNAME)
128 ln -sf . $(DISTNAME)
129 tarlz --solid -9 -cvf $(DISTNAME).tar.lz \
130 $(DISTNAME)/AUTHORS \
131 $(DISTNAME)/COPYING \
132 $(DISTNAME)/CREDITS \
133 $(DISTNAME)/Makefile \
134 $(DISTNAME)/NEWS \
135 $(DISTNAME)/README.md \
136 $(DISTNAME)/configure \
137 $(DISTNAME)/doc/example.order \
138 $(DISTNAME)/doc/fdl.txt \
139 $(DISTNAME)/doc/qi.1 \
140 $(DISTNAME)/doc/qi.1.in \
141 $(DISTNAME)/doc/$(project).html \
142 $(DISTNAME)/doc/$(project).info \
143 $(DISTNAME)/doc/$(project)-header.texi \
144 $(DISTNAME)/doc/$(project)-content.texi \
145 $(DISTNAME)/doc/recipe1 \
146 $(DISTNAME)/doc/recipe2 \
147 $(DISTNAME)/doc/recipe3 \
148 $(DISTNAME)/etc/$(project)rc.in \
149 $(DISTNAME)/src/qi.in
150 rm -f $(DISTNAME)
151 sha256sum $(DISTNAME).tar.lz > $(DISTNAME).tar.lz.sha256
153 distclean : clean
154 -rm -f *.tar *.tar.lz *.tar.lz.*
156 clean :
157 -rm -f src/$(project) etc/$(project)rc config.mak
159 install : all install-info install-man
161 @echo ""
162 @echo "* Checking required directories ..."
163 if [ ! -d "$(DESTDIR)${bindir}" ] ; then \
164 $(INSTALL_DIR) "$(DESTDIR)${bindir}" ; \
166 if [ ! -d "$(DESTDIR)${sysconfdir}" ] ; then \
167 $(INSTALL_DIR) "$(DESTDIR)${sysconfdir}" ; \
170 @echo ""
171 @echo "* Installing on $(DESTDIR)${bindir} ..."
172 $(INSTALL_PROGRAM) src/$(project) "$(DESTDIR)${bindir}/$(project)"
174 @echo ""
175 @echo "* Installing config file on $(DESTDIR)${sysconfdir} ..."
176 $(INSTALL_DATA) etc/$(project)rc "$(DESTDIR)${sysconfdir}/$(project)rc"
178 @echo ""
179 @echo "* Creating package and target directory (if needed) ..."
180 if [ ! -d "$(DESTDIR)${packagedir}" ] ; then \
181 $(INSTALL_DIR) "$(DESTDIR)${packagedir}" ; \
183 if [ ! -d "$(DESTDIR)${targetdir}" ] ; then \
184 $(INSTALL_DIR) "$(DESTDIR)${targetdir}" ; \
186 @echo ""
187 @echo "Done."
189 install-info :
191 @echo ""
192 @echo "* Installing Info document on $(DESTDIR)${infodir} ..."
193 if [ ! -d "$(DESTDIR)${infodir}" ] ; then \
194 $(INSTALL_DIR) "$(DESTDIR)${infodir}" ; \
197 $(INSTALL_DATA) doc/$(project).info \
198 "$(DESTDIR)${infodir}/$(project).info"
200 -install-info --info-dir="$(DESTDIR)${infodir}" \
201 "$(DESTDIR)${infodir}/$(project).info"
203 install-man :
205 @echo ""
206 @echo "* Installing manual pages on $(DESTDIR)${mandir}/man1 ..."
207 if [ ! -d "$(DESTDIR)${mandir}/man1" ] ; then \
208 $(INSTALL_DIR) "$(DESTDIR)${mandir}/man1" ; \
211 $(INSTALL_DATA) doc/$(project).1 "$(DESTDIR)${mandir}/man1"
213 uninstall : uninstall-info uninstall-man
215 @echo ""
216 @echo "* Uninstalling from $(DESTDIR)${bindir} ..."
217 -rm -f "$(DESTDIR)${bindir}/$(project)"
219 -rm -f "$(DESTDIR)${sysconfdir}/$(project)rc"
221 uninstall-info :
223 -install-info \
224 --info-dir="$(DESTDIR)${infodir}" \
225 --remove "$(DESTDIR)${infodir}/$(project).info"
227 -rm -f "$(DESTDIR)${infodir}/$(project).info"
229 uninstall-man :
231 -rm -f "$(DESTDIR)${mandir}/man1/$(project).1"