qi: add external option to skip completed recipes when build
[dragora.git] / qi / Makefile
blobf9b06b73da820c89c499429260abd9d0594cce0e
1 # Makefile for Qi.
3 # Copyright (c) 2015-2018 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.0-rc44
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 = $(prefix)/pkg
35 targetdir = /
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 = ${INSTALL} -d -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 'package manager' -o $@ src/qi
107 html : doc/$(project).html
109 doc/$(project).html : doc/$(project).texi
110 cd doc && LC_ALL=C $(MAKEINFO) --html --no-split \
111 --css-ref=document-1.0.1.css $(project).texi
113 dist : doc
114 ln -sf . $(DISTNAME)
115 tar -Hustar -cvf $(DISTNAME).tar \
116 $(DISTNAME)/AUTHORS \
117 $(DISTNAME)/COPYING \
118 $(DISTNAME)/CREDITS \
119 $(DISTNAME)/Makefile \
120 $(DISTNAME)/NEWS \
121 $(DISTNAME)/README \
122 $(DISTNAME)/configure \
123 $(DISTNAME)/doc/recipe \
124 $(DISTNAME)/doc/document*.css \
125 $(DISTNAME)/doc/example.order \
126 $(DISTNAME)/doc/fdl.texi \
127 $(DISTNAME)/doc/qi.1 \
128 $(DISTNAME)/doc/$(project).html \
129 $(DISTNAME)/doc/$(project).info \
130 $(DISTNAME)/doc/$(project).texi \
131 $(DISTNAME)/etc/$(project)rc.in \
132 $(DISTNAME)/src/qi.in
133 rm -f $(DISTNAME)
134 lzip -v -9 $(DISTNAME).tar
136 distclean : clean
137 -rm -f *.tar *.tar.lz
139 clean :
140 -rm -f src/$(project) etc/$(project)rc config.mak
142 install : all install-info install-man
144 @echo "*** Checking required directories ..."
146 if [ ! -d "$(DESTDIR)${bindir}" ] ; then \
147 $(INSTALL_DIR) "$(DESTDIR)${bindir}" ; \
149 if [ ! -d "$(DESTDIR)${sysconfdir}" ] ; then \
150 $(INSTALL_DIR) "$(DESTDIR)${sysconfdir}" ; \
153 @echo "*** Installing on $(DESTDIR)${bindir} ..."
155 $(INSTALL_PROGRAM) src/$(project) "$(DESTDIR)${bindir}/$(project)"
157 @echo "*** Installing config file on $(DESTDIR)${sysconfdir} ..."
158 $(INSTALL_DATA) etc/$(project)rc "$(DESTDIR)${sysconfdir}/$(project)rc"
160 install-info :
162 @echo "*** Checking required directory ..."
164 if [ ! -d "$(DESTDIR)${infodir}" ] ; then \
165 $(INSTALL_DIR) "$(DESTDIR)${infodir}" ; \
168 @echo "*** Installing Info document on $(DESTDIR)${infodir} ..."
170 $(INSTALL_DATA) doc/$(project).info \
171 "$(DESTDIR)${infodir}/$(project).info"
173 -install-info --info-dir="$(DESTDIR)${infodir}" \
174 "$(DESTDIR)${infodir}/$(project).info"
176 install-man :
178 if [ ! -d "$(DESTDIR)${mandir}/man1" ] ; then \
179 $(INSTALL_DIR) "$(DESTDIR)${mandir}/man1" ; \
182 @echo "*** Installing manual pages on $(DESTDIR)${mandir}/man1 ..."
184 $(INSTALL_DATA) doc/qi.1 "$(DESTDIR)${mandir}/man1"
186 uninstall : uninstall-info uninstall-man
188 @echo "*** Uninstalling from $(DESTDIR)${bindir} ..."
190 -rm -f "$(DESTDIR)${bindir}/$(project)"
192 -rm -f "$(DESTDIR)${sysconfdir}/$(project)rc"
194 uninstall-info :
196 -install-info \
197 --info-dir="$(DESTDIR)${infodir}" \
198 --remove "$(DESTDIR)${infodir}/$(project).info"
200 -rm -f "$(DESTDIR)${infodir}/$(project).info"
202 uninstall-man :
204 -rm -f "$(DESTDIR)${mandir}/man1/qi.1"