qi: make release of qi 1.1
[dragora.git] / qi / Makefile
blob1240f29538878f419c773f2867e8e86dcb4c60b9
1 # Makefile for Qi.
3 # Copyright (c) 2015-2019 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 = 1.1
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
37 DISTNAME = ${project}-${version}
39 MAKEINFO = makeinfo
40 INSTALL = install
41 INSTALL_PROGRAM = ${INSTALL} -p -m 755
42 INSTALL_DATA = ${INSTALL} -p -m 644
43 INSTALL_DIR = mkdir -p -m 755
44 HELP2MAN_OPTS = --version-option=-V
46 .PHONY: all \
47 doc info man html \
48 dist distclean clean \
49 install install-info \
50 uninstall uninstall-info
52 -include config.mak
55 all : $(project) $(project)rc
57 $(project) : src/$(project)
59 src/$(project) : src/$(project).in
60 @echo "Making tool: src/$(project) ..."
61 @sed -e "s|@VERSION@|$(version)|g" \
62 -e "s|@PREFIX@|$(prefix)|g" \
63 -e "s|@BINDIR@|$(bindir)|g" \
64 -e "s|@SBINDIR@|$(sbindir)|g" \
65 -e "s|@LIBEXECDIR@|$(libexecdir)|g" \
66 -e "s|@SYSCONFDIR@|$(sysconfdir)|g" \
67 -e "s|@LOCALSTATEDIR@|$(localstatedir)|g" \
68 -e "s|@INFODIR@|$(infodir)|g" \
69 -e "s|@MANDIR@|$(mandir)|g" \
70 -e "s|@DOCDIR@|$(docdir)|g" \
71 -e "s|@PACKAGEDIR@|$(packagedir)|g" \
72 -e "s|@TARGETDIR@|$(targetdir)|g" \
73 $< > $@ && \
74 chmod 755 $@
76 $(project)rc : etc/$(project)rc
78 etc/$(project)rc : etc/$(project)rc.in
79 @echo "Making config: etc/$(project)rc ..."
80 @sed -e "s|@PREFIX@|$(prefix)|g" \
81 -e "s|@BINDIR@|$(bindir)|g" \
82 -e "s|@SBINDIR@|$(sbindir)|g" \
83 -e "s|@LIBEXECDIR@|$(libexecdir)|g" \
84 -e "s|@SYSCONFDIR@|$(sysconfdir)|g" \
85 -e "s|@LOCALSTATEDIR@|$(localstatedir)|g" \
86 -e "s|@INFODIR@|$(infodir)|g" \
87 -e "s|@MANDIR@|$(mandir)|g" \
88 -e "s|@DOCDIR@|$(docdir)|g" \
89 -e "s|@PACKAGEDIR@|$(packagedir)|g" \
90 -e "s|@TARGETDIR@|$(targetdir)|g" \
91 $< > $@ && \
92 chmod 644 $@
94 doc : info man html
96 info : doc/$(project).info
98 doc/$(project).info : doc/$(project).texi
99 cd doc && LC_ALL=C $(MAKEINFO) $(project).texi
101 man : doc/qi.1
103 doc/qi.1 : src/qi
104 LC_ALL=C help2man ${HELP2MAN_OPTS} \
105 -n 'a simple but well-integrated package manager' \
106 -o $@ src/qi
108 html : doc/$(project).html
110 doc/$(project).html : doc/$(project).texi
111 cd doc && LC_ALL=C $(MAKEINFO) --html --no-split \
112 $(project).texi
114 dist : doc
115 ln -sf . $(DISTNAME)
116 tarlz --solid -9 -cvf $(DISTNAME).tar.lz \
117 $(DISTNAME)/AUTHORS \
118 $(DISTNAME)/COPYING \
119 $(DISTNAME)/CREDITS \
120 $(DISTNAME)/Makefile \
121 $(DISTNAME)/NEWS \
122 $(DISTNAME)/README \
123 $(DISTNAME)/configure \
124 $(DISTNAME)/doc/example.order \
125 $(DISTNAME)/doc/fdl.txt \
126 $(DISTNAME)/doc/qi.1 \
127 $(DISTNAME)/doc/$(project).html \
128 $(DISTNAME)/doc/$(project).info \
129 $(DISTNAME)/doc/$(project).texi \
130 $(DISTNAME)/doc/recipe1 \
131 $(DISTNAME)/doc/recipe2 \
132 $(DISTNAME)/doc/recipe3 \
133 $(DISTNAME)/etc/$(project)rc.in \
134 $(DISTNAME)/src/qi.in
135 rm -f $(DISTNAME)
136 sha256sum $(DISTNAME).tar.lz > $(DISTNAME).tar.lz.sha256
138 distclean : clean
139 -rm -f *.tar *.tar.lz *.tar.lz.*
141 clean :
142 -rm -f src/$(project) etc/$(project)rc config.mak
144 install : all install-info install-man
146 @echo "*** Checking required directories ..."
148 if [ ! -d "$(DESTDIR)${bindir}" ] ; then \
149 $(INSTALL_DIR) "$(DESTDIR)${bindir}" ; \
151 if [ ! -d "$(DESTDIR)${sysconfdir}" ] ; then \
152 $(INSTALL_DIR) "$(DESTDIR)${sysconfdir}" ; \
155 @echo "*** Installing on $(DESTDIR)${bindir} ..."
157 $(INSTALL_PROGRAM) src/$(project) "$(DESTDIR)${bindir}/$(project)"
159 @echo "*** Installing config file on $(DESTDIR)${sysconfdir} ..."
160 $(INSTALL_DATA) etc/$(project)rc "$(DESTDIR)${sysconfdir}/$(project)rc"
162 @echo "Done."
164 install-info :
166 @echo "*** Checking required directory ..."
168 if [ ! -d "$(DESTDIR)${infodir}" ] ; then \
169 $(INSTALL_DIR) "$(DESTDIR)${infodir}" ; \
172 @echo "*** Installing Info document on $(DESTDIR)${infodir} ..."
174 $(INSTALL_DATA) doc/$(project).info \
175 "$(DESTDIR)${infodir}/$(project).info"
177 -install-info --info-dir="$(DESTDIR)${infodir}" \
178 "$(DESTDIR)${infodir}/$(project).info"
180 install-man :
182 if [ ! -d "$(DESTDIR)${mandir}/man1" ] ; then \
183 $(INSTALL_DIR) "$(DESTDIR)${mandir}/man1" ; \
186 @echo "*** Installing manual pages on $(DESTDIR)${mandir}/man1 ..."
188 $(INSTALL_DATA) doc/qi.1 "$(DESTDIR)${mandir}/man1"
190 uninstall : uninstall-info uninstall-man
192 @echo "*** Uninstalling from $(DESTDIR)${bindir} ..."
194 -rm -f "$(DESTDIR)${bindir}/$(project)"
196 -rm -f "$(DESTDIR)${sysconfdir}/$(project)rc"
198 uninstall-info :
200 -install-info \
201 --info-dir="$(DESTDIR)${infodir}" \
202 --remove "$(DESTDIR)${infodir}/$(project).info"
204 -rm -f "$(DESTDIR)${infodir}/$(project).info"
206 uninstall-man :
208 -rm -f "$(DESTDIR)${mandir}/man1/qi.1"