1#
2#  atheme buildsys.mk
3#  Copyright (c) 2012 William Pitcock <nenolod@dereferenced.org>
4#
5#  Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012
6#  Jonathan Schleifer <js@webkeks.org>
7#
8#  Based on buildsys.mk:
9#  https://webkeks.org/git/?p=buildsys.git
10#
11#  Permission to use, copy, modify, and/or distribute this software for any
12#  purpose with or without fee is hereby granted, provided that the above
13#  copyright notice and this permission notice is present in all copies.
14#
15#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25#  POSSIBILITY OF SUCH DAMAGE.
26#
27
28#V=1
29PACKAGE_NAME = @PACKAGE_NAME@
30PACKAGE_VERSION = @PACKAGE_VERSION@
31AS = @AS@
32CC = @CC@
33CXX = @CXX@
34CPP = @CPP@
35DC = @DC@
36ERLC = @ERLC@
37OBJC = @OBJC@
38OBJCXX = @OBJCXX@
39AR = @AR@
40LD = ${CC}
41RANLIB = @RANLIB@
42PYTHON = @PYTHON@
43ASFLAGS = @ASFLAGS@
44CFLAGS = @CFLAGS@
45CXXFLAGS = @CXXFLAGS@
46CPPFLAGS = @CPPFLAGS@
47DFLAGS = @DFLAGS@
48ERLCFLAGS = @ERLCFLAGS@
49OBJCFLAGS = @OBJCFLAGS@
50OBJCXXFLAGS = @OBJCXXFLAGS@
51LDFLAGS = @LDFLAGS@
52LDFLAGS_RPATH = @LDFLAGS_RPATH@
53LIBS = @LIBS@
54PYTHON_FLAGS = @PYTHON_FLAGS@
55PROG_IMPLIB_NEEDED = @PROG_IMPLIB_NEEDED@
56PROG_IMPLIB_LDFLAGS = @PROG_IMPLIB_LDFLAGS@
57PROG_SUFFIX = @EXEEXT@
58LIB_CFLAGS = @LIB_CFLAGS@
59LIB_LDFLAGS = @LIB_LDFLAGS@
60LIB_PREFIX = @LIB_PREFIX@
61LIB_SUFFIX = @LIB_SUFFIX@
62PLUGIN_CFLAGS = @PLUGIN_CFLAGS@
63PLUGIN_LDFLAGS = @PLUGIN_LDFLAGS@
64PLUGIN_SUFFIX = @PLUGIN_SUFFIX@
65INSTALL_LIB = @INSTALL_LIB@
66UNINSTALL_LIB = @UNINSTALL_LIB@
67CLEAN_LIB = @CLEAN_LIB@
68LN_S = @LN_S@
69MKDIR_P = mkdir -p
70INSTALL = @INSTALL@
71SHELL = @SHELL@
72MSGFMT = @MSGFMT@
73JAVAC = @JAVAC@
74JAVACFLAGS = @JAVACFLAGS@
75JAR = @JAR@
76WINDRES = @WINDRES@
77prefix = @prefix@
78exec_prefix = @exec_prefix@
79bindir = @bindir@
80libdir = @libdir@
81plugindir ?= ${libdir}/${PACKAGE_NAME}
82datarootdir = @datarootdir@
83datadir = @datadir@
84includedir = @includedir@
85includesubdir ?= ${PACKAGE_NAME}
86localedir = @localedir@
87localename ?= ${PACKAGE_NAME}
88mandir = @mandir@
89mansubdir ?= man1
90
91OBJS1 = ${SRCS:.c=.o}
92OBJS2 = ${OBJS1:.cc=.o}
93OBJS3 = ${OBJS2:.cxx=.o}
94OBJS4 = ${OBJS3:.d=.o}
95OBJS5 = ${OBJS4:.erl=.beam}
96OBJS6 = ${OBJS5:.java=.class}
97OBJS7 = ${OBJS6:.m=.o}
98OBJS8 = ${OBJS7:.mm=.o}
99OBJS9 = ${OBJS8:.py=.pyc}
100OBJS10 = ${OBJS9:.rc=.o}
101OBJS11 = ${OBJS10:.S=.o}
102OBJS += ${OBJS11:.xpm=.o}
103
104LIB_OBJS = ${OBJS:.o=.lib.o}
105PLUGIN_OBJS = ${OBJS:.o=.plugin.o}
106
107MO_FILES = ${LOCALES:.po=.mo}
108DEPFLAGS = -MMD -MP
109
110.SILENT:
111.SUFFIXES:
112.SUFFIXES: .beam .c .cc .class .cxx .d .erl .lib.o .java .mo .m .mm .mm.d .o .plugin.o .po .py .pyc .rc .S .xpm
113.PHONY: all subdirs ${SUBDIRS} pre-depend depend install install-extra uninstall uninstall-extra clean distclean locales
114
115all: subdirs depend ${STATIC_LIB} ${STATIC_LIB_NOINST} ${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST} ${SHARED_LIB} ${SHARED_LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${PROG} ${PROG_NOINST} ${JARFILE} locales
116
117pre-recurse:
118subdirs: pre-recurse ${SUBDIRS}
119${SUBDIRS}:
120	${MAKE} -C $@ ${MFLAGS}
121
122depend: pre-depend
123pre-depend:
124
125echo-cmd = $(if $($(QUIET)$(1)),$(info $(phase_$(1)): $($(QUIET)$(1))))
126
127${PROG} ${PROG_NOINST}: ${EXT_DEPS} ${OBJS} ${OBJS_EXTRA}
128	LDOBJS="${OBJS} ${OBJS_EXTRA}"; \
129	${LINK_STATUS}; \
130	if ${LD} -o $@ ${OBJS} ${OBJS_EXTRA} ${LDFLAGS} ${LIBS}; then \
131		${LINK_OK}; \
132	else \
133		${LINK_FAILED}; \
134	fi
135
136${JARFILE}: ${EXT_DEPS} ${JAR_MANIFEST} ${OBJS} ${OBJS_EXTRA}
137	${LINK_STATUS}
138	if test x"${JAR_MANIFEST}" != x""; then \
139		if ${JAR} cfm ${JARFILE} ${JAR_MANIFEST} ${OBJS} ${OBJS_EXTRA}; then \
140			${LINK_OK}; \
141		else \
142			${LINK_FAILED}; \
143		fi \
144	else \
145		if ${JAR} cf ${JARFILE} ${OBJS} ${OBJS_EXTRA}; then \
146			${LINK_OK}; \
147		else \
148			${LINK_FAILED}; \
149		fi \
150	fi
151
152${SHARED_LIB} ${SHARED_LIB_NOINST}: ${EXT_DEPS} ${LIB_OBJS} ${LIB_OBJS_EXTRA}
153	LDOBJS="${LIB_OBJS} ${LIB_OBJS_EXTRA}"; \
154	${LINK_STATUS}; \
155	objs=""; \
156	ars=""; \
157	for i in ${LIB_OBJS} ${LIB_OBJS_EXTRA}; do \
158		case $$i in \
159			*.a) \
160				ars="$$ars $$i" \
161				;; \
162			*.o) \
163				objs="$$objs $$i" \
164				;; \
165		esac \
166	done; \
167	for i in $$ars; do \
168		dir=".$$(echo $$i | sed 's/\//_/g').objs"; \
169		rm -fr $$dir; \
170		mkdir -p $$dir; \
171		cd $$dir; \
172		${AR} x ../$$i; \
173		for j in *.o; do \
174			objs="$$objs $$dir/$$j"; \
175		done; \
176		cd ..; \
177	done; \
178	if ${LD} -o $@ $$objs ${LIB_LDFLAGS} ${LDFLAGS} ${LIBS}; then \
179		${LINK_OK}; \
180	else \
181		${LINK_FAILED}; \
182	fi; \
183	for i in $$ars; do \
184		dir=".$$(echo $$i | sed 's/\//_/g').objs"; \
185		rm -fr $$dir; \
186	done
187
188${PLUGIN} ${PLUGIN_NOINST}: ${EXT_DEPS} ${PLUGIN_OBJS}
189	LDOBJS="${PLUGIN_OBJS}"; \
190	${LINK_STATUS}; \
191	objs=""; \
192	ars=""; \
193	for i in ${PLUGIN_OBJS}; do \
194		case $$i in \
195			*.a) \
196				ars="$$ars $$i" \
197				;; \
198			*.o) \
199				objs="$$objs $$i" \
200				;; \
201		esac \
202	done; \
203	for i in $$ars; do \
204		dir=".$$(echo $$i | sed 's/\//_/g').objs"; \
205		rm -fr $$dir; \
206		mkdir -p $$dir; \
207		cd $$dir; \
208		${AR} x ../$$i; \
209		for j in *.o; do \
210			objs="$$objs $$dir/$$j"; \
211		done; \
212		cd ..; \
213	done; \
214	if ${LD} -o $@ $$objs ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}; then \
215		${LINK_OK}; \
216	else \
217		${LINK_FAILED}; \
218	fi; \
219	for i in $$ars; do \
220		dir=".$$(echo $$i | sed 's/\//_/g').objs"; \
221		rm -fr $$dir; \
222	done
223
224${STATIC_LIB} ${STATIC_LIB_NOINST}: ${EXT_DEPS} ${OBJS} ${OBJS_EXTRA}
225	LDOBJS="${OBJS} ${OBJS_EXTRA}"; \
226	${LINK_STATUS}; \
227	rm -f $@; \
228	objs=""; \
229	ars=""; \
230	for i in ${OBJS} ${OBJS_EXTRA}; do \
231		case $$i in \
232			*.a) \
233				ars="$$ars $$i" \
234				;; \
235			*.o) \
236				objs="$$objs $$i" \
237				;; \
238		esac \
239	done; \
240	for i in $$ars; do \
241		dir=".$$(echo $$i | sed 's/\//_/g').objs"; \
242		rm -fr $$dir; \
243		mkdir -p $$dir; \
244		cd $$dir; \
245		${AR} x ../$$i; \
246		for j in *.o; do \
247			objs="$$objs $$dir/$$j"; \
248		done; \
249		cd ..; \
250	done; \
251	if ${AR} cr $@ $$objs && ${RANLIB} $@; then \
252		${LINK_OK}; \
253	else \
254		${LINK_FAILED}; \
255		rm -f $@; \
256	fi; \
257	for i in $$ars; do \
258		dir=".$$(echo $$i | sed 's/\//_/g').objs"; \
259		rm -fr $$dir; \
260	done
261
262${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST}: ${EXT_DEPS} ${LIB_OBJS} ${LIB_OBJS_EXTRA}
263	LDOBJS="${LIB_OBJS} ${LIB_OBJS_EXTRA}"; \
264	${LINK_STATUS}; \
265	rm -f $@
266	objs=""; \
267	ars=""; \
268	for i in ${LIB_OBJS} ${LIB_OBJS_EXTRA}; do \
269		case $$i in \
270			*.a) \
271				ars="$$ars $$i" \
272				;; \
273			*.o) \
274				objs="$$objs $$i" \
275				;; \
276		esac \
277	done; \
278	for i in $$ars; do \
279		dir=".$$(echo $$i | sed 's/\//_/g').objs"; \
280		rm -fr $$dir; \
281		mkdir -p $$dir; \
282		cd $$dir; \
283		${AR} x ../$$i; \
284		for j in *.o; do \
285			objs="$$objs $$dir/$$j"; \
286		done; \
287		cd ..; \
288	done; \
289	if ${AR} cr $@ $$objs && ${RANLIB} $@; then \
290		${LINK_OK}; \
291	else \
292		${LINK_FAILED}; \
293		rm -f $@; \
294	fi; \
295	for i in $$ars; do \
296		dir=".$$(echo $$i | sed 's/\//_/g').objs"; \
297		rm -fr $$dir; \
298	done
299
300locales: ${MO_FILES}
301
302phase_cmd_cc = CompileExe
303quiet_cmd_cc = $@
304      cmd_cc = ${CC} ${DEPFLAGS} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
305
306phase_cmd_cc_lib = CompileLib
307quiet_cmd_cc_lib = $@
308      cmd_cc_lib = ${CC} ${DEPFLAGS} ${LIB_CFLAGS} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
309
310phase_cmd_cc_plugin = CompilePlugin
311quiet_cmd_cc_plugin = $@
312      cmd_cc_plugin = ${CC} ${DEPFLAGS} ${PLUGIN_CFLAGS} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
313
314.c.o:
315	$(call echo-cmd,cmd_cc)
316	$(cmd_cc)
317
318.c.lib.o:
319	$(call echo-cmd,cmd_cc_lib)
320	$(cmd_cc_lib)
321
322.c.plugin.o:
323	$(call echo-cmd,cmd_cc_plugin)
324	$(cmd_cc_plugin)
325
326phase_cmd_cxx = CompileExe
327quiet_cmd_cxx = $@
328      cmd_cxx = ${CXX} ${DEPFLAGS} ${CXXFLAGS} ${CPPFLAGS} -c -o $@ $<
329
330phase_cmd_cxx_lib = CompileLib
331quiet_cmd_cxx_lib = $@
332      cmd_cxx_lib = ${CXX} ${DEPFLAGS} ${LIB_CFLAGS} ${CXXFLAGS} ${CPPFLAGS} -c -o $@ $<
333
334phase_cmd_cxx_plugin = CompilePlugin
335quiet_cmd_cxx_plugin = $@
336      cmd_cxx_plugin = ${CXX} ${DEPFLAGS} ${PLUGIN_CFLAGS} ${CXXFLAGS} ${CPPFLAGS} -c -o $@ $<
337
338.cc.o .cxx.o:
339	$(call echo-cmd,cmd_cxx)
340	$(cmd_cxx)
341
342.cc.lib.o .cxx.lib.o:
343	$(call echo-cmd,cmd_cxx_lib)
344	$(cmd_cxx_lib)
345
346.cc.plugin.o .cxx.plugin.o:
347	$(call echo-cmd,cmd_cxx_plugin)
348	$(cmd_cxx_plugin)
349
350phase_cmd_dc = CompileExe
351quiet_cmd_dc = $@
352
353ifeq ($(basename ${DC}),dmd)
354      cmd_dc = ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c -of$@ $<
355else
356      cmd_dc = ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c -o $@ $<
357endif
358
359.d.o:
360	$(call echo-cmd,cmd_dc)
361	$(cmd_dc)
362
363phase_cmd_erlc = CompileErlang
364quiet_cmd_erlc = $@
365      cmd_erlc = ${ERLC} ${ERLCFLAGS} -o $@ $<
366
367.erl.beam:
368	$(call echo-cmd,cmd_erlc)
369	$(cmd_erlc)
370
371phase_cmd_javac = CompileJava
372quiet_cmd_javac = $@
373      cmd_javac = ${JAVAC} ${JAVACFLAGS} $<
374
375.java.class:
376	$(call echo-cmd,cmd_javac)
377	$(cmd_javac)
378
379phase_cmd_objc = CompileExe
380quiet_cmd_objc = $@
381      cmd_objc = ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c -o $@ $<
382
383phase_cmd_objc_lib = CompileLib
384quiet_cmd_objc_lib = $@
385      cmd_objc_lib = ${OBJC} ${LIB_CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -c -o $@ $<
386
387phase_cmd_objc_plugin = CompilePlugin
388quiet_cmd_objc_plugin = $@
389      cmd_objc_plugin = ${OBJC} ${PLUGIN_CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -c -o $@ $<
390
391.m.o:
392	$(call echo-cmd,cmd_objc)
393	$(cmd_objc)
394
395.m.lib.o:
396	$(call echo-cmd,cmd_objc_lib)
397	$(cmd_objc_lib)
398
399.m.plugin.o:
400	$(call echo-cmd,cmd_objc_plugin)
401	$(cmd_objc_plugin)
402
403phase_cmd_objcxx = CompileExe
404quiet_cmd_objcxx = $@
405      cmd_objcxx = ${OBJCXX} ${OBJCXXFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -c -o $@ $<
406
407phase_cmd_objcxx_lib = CompileLib
408quiet_cmd_objcxx_lib = $@
409      cmd_objcxx_lib = ${OBJCXX} ${LIB_CFLAGS} ${OBJCXXFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -c -o $@ $<
410
411phase_cmd_objcxx_plugin = CompilePlugin
412quiet_cmd_objcxx_plugin = $@
413      cmd_objcxx_plugin = ${OBJCXX} ${PLUGIN_CFLAGS} ${OBJCXXFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -c -o $@ $<
414
415.mm.o:
416	$(call echo-cmd,cmd_objcxx)
417	$(cmd_objcxx)
418
419.mm.lib.o:
420	$(call echo-cmd,cmd_objcxx_lib)
421	$(cmd_objcxx_lib)
422
423.mm.plugin.o:
424	$(call echo-cmd,cmd_objcxx_plugin)
425	$(cmd_objcxx_plugin)
426
427phase_cmd_msgfmt = CompileResource
428quiet_cmd_msgfmt = $@
429      cmd_msgfmt = ${MSGFMT} -c -o $@ $<
430
431.po.mo:
432	$(call echo-cmd,cmd_msgfmt)
433	$(cmd_msgfmt)
434
435phase_cmd_pythonc = CompilePython
436quiet_cmd_pythonc = $@
437      cmd_pythonc = ${PYTHON} ${PYTHON_FLAGS} -c "import py_compile; py_compile.compile('$<')"
438
439.py.pyc:
440	$(call echo-cmd,cmd_pythonc)
441	$(cmd_pythonc)
442
443phase_cmd_windres = CompileResource
444quiet_cmd_windres = $@
445      cmd_windres = ${WINDRES} ${CPPFLAGS} -J rc -O coff -o $@ $<
446
447.rc.o .rc.lib.o .rc.plugin.o:
448	$(call echo-cmd,cmd_windres)
449	$(cmd_windres)
450
451phase_cmd_as = CompileExe
452quiet_cmd_as = $@
453      cmd_as = ${AS} ${ASFLAGS} ${CPPFLAGS} -c -o $@ $<
454
455phase_cmd_as_lib = CompileLib
456quiet_cmd_as_lib = $@
457      cmd_as_lib = ${AS} ${LIB_CFLAGS} ${ASFLAGS} ${CPPFLAGS} -c -o $@ $<
458
459phase_cmd_as_plugin = CompilePlugin
460quiet_cmd_as_plugin = $@
461      cmd_as_plugin = ${AS} ${PLUGIN_CFLAGS} ${ASFLAGS} ${CPPFLAGS} -c -o $@ $<
462
463.S.o:
464	$(call echo-cmd,cmd_as)
465	$(cmd_as)
466
467.S.lib.o:
468	$(call echo-cmd,cmd_as_lib)
469	$(cmd_as_lib)
470
471.S.plugin.o:
472	$(call echo-cmd,cmd_as_plugin)
473	$(cmd_as_plugin)
474
475phase_cmd_xpm = CompileExe
476quiet_cmd_xpm = $@
477      cmd_xpm = ${CC} ${CFLAGS} ${CPPFLAGS} -x c -c -o $@ $<
478
479phase_cmd_xpm_lib = CompileLib
480quiet_cmd_xpm_lib = $@
481      cmd_xpm_lib = ${CC} ${LIB_CFLAGS} ${CFLAGS} ${CPPFLAGS} -x c -c -o $@ $<
482
483phase_cmd_xpm_plugin = CompilePlugin
484quiet_cmd_xpm_plugin = $@
485      cmd_xpm_plugin = ${CC} ${PLUGIN_CFLAGS} ${CFLAGS} ${CPPFLAGS} -x c -c -o $@ $<
486
487.xpm.o:
488	$(call echo-cmd,cmd_xpm)
489	$(cmd_xpm)
490
491.xpm.lib.o:
492	$(call echo-cmd,cmd_xpm_lib)
493	$(cmd_xpm_lib)
494
495.xpm.plugin.o:
496	$(call echo-cmd,cmd_xpm_plugin)
497	$(cmd_xpm_plugin)
498
499install: ${SHARED_LIB} ${STATIC_LIB} ${STATIC_PIC_LIB} ${PLUGIN} ${PROG} install-extra
500	for i in ${SUBDIRS}; do \
501		${MAKE} -C $$i ${MFLAGS} install || exit $$?; \
502	done
503
504	for i in ${SHARED_LIB}; do \
505		${INSTALL_STATUS}; \
506		if ${MKDIR_P} ${DESTDIR}${libdir} ${INSTALL_LIB}; then \
507			${INSTALL_OK}; \
508		else \
509			${INSTALL_FAILED}; \
510		fi \
511	done
512
513	for i in ${STATIC_LIB} ${STATIC_PIC_LIB}; do \
514		${INSTALL_STATUS}; \
515		if ${MKDIR_P} ${DESTDIR}${libdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${libdir}/$$i; then \
516			${INSTALL_OK}; \
517		else \
518			${INSTALL_FAILED}; \
519		fi \
520	done
521
522	for i in ${PLUGIN}; do \
523		${INSTALL_STATUS}; \
524		if ${MKDIR_P} ${DESTDIR}${plugindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i; then \
525			${INSTALL_OK}; \
526		else \
527			${INSTALL_FAILED}; \
528		fi \
529	done
530
531	for i in ${DATA}; do \
532		${INSTALL_STATUS}; \
533		if ${MKDIR_P} $$(dirname ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i) && ${INSTALL} -m 644 $$i ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i; then \
534			${INSTALL_OK}; \
535		else \
536			${INSTALL_FAILED}; \
537		fi \
538	done
539
540	for i in ${PROG}; do \
541		${INSTALL_STATUS}; \
542		if ${MKDIR_P} ${DESTDIR}${bindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${bindir}/$$i; then \
543			${INSTALL_OK}; \
544		else \
545			${INSTALL_FAILED}; \
546		fi \
547	done
548
549	for i in ${INCLUDES}; do \
550		${INSTALL_STATUS}; \
551		if ${MKDIR_P} ${DESTDIR}${includedir}/${includesubdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${includedir}/${includesubdir}/$$i; then \
552			${INSTALL_OK}; \
553		else \
554			${INSTALL_FAILED}; \
555		fi \
556	done
557
558	for i in ${MO_FILES}; do \
559		${INSTALL_STATUS}; \
560		if ${MKDIR_P} ${DESTDIR}${localedir}/$${i%.mo}/LC_MESSAGES && ${INSTALL} -m 644 $$i ${DESTDIR}${localedir}/$${i%.mo}/LC_MESSAGES/${localename}.mo; then \
561			${INSTALL_OK}; \
562		else \
563			${INSTALL_FAILED}; \
564		fi \
565	done
566
567	for i in ${MAN}; do \
568		${INSTALL_STATUS}; \
569		if ${MKDIR_P} ${DESTDIR}${mandir}/${mansubdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${mandir}/${mansubdir}/$$i; then \
570			${INSTALL_OK}; \
571		else \
572			${INSTALL_FAILED}; \
573		fi \
574	done
575
576install-extra:
577
578uninstall: uninstall-extra
579	for i in ${SUBDIRS}; do \
580		${MAKE} -C $$i ${MFLAGS} uninstall || exit $$?; \
581	done
582
583	for i in ${SHARED_LIB}; do \
584		if test -f ${DESTDIR}${libdir}/$$i; then \
585			if : ${UNINSTALL_LIB}; then \
586				${DELETE_OK}; \
587			else \
588				${DELETE_FAILED}; \
589			fi \
590		fi; \
591	done
592
593	for i in ${STATIC_LIB} ${STATIC_PIC_LIB}; do \
594		if test -f ${DESTDIR}${libdir}/$$i; then \
595			if rm -f ${DESTDIR}${libdir}/$$i; then \
596				${DELETE_OK}; \
597			else \
598				${DELETE_FAILED}; \
599			fi \
600		fi \
601	done
602
603	for i in ${PLUGIN}; do \
604		if test -f ${DESTDIR}${plugindir}/$$i; then \
605			if rm -f ${DESTDIR}${plugindir}/$$i; then \
606				${DELETE_OK}; \
607			else \
608				${DELETE_FAILED}; \
609			fi \
610		fi \
611	done
612	-rmdir ${DESTDIR}${plugindir} >/dev/null 2>&1
613
614	for i in ${DATA}; do \
615		if test -f ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i; then \
616			if rm -f ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i; then \
617				${DELETE_OK}; \
618			else \
619				${DELETE_FAILED}; \
620			fi \
621		fi; \
622		rmdir "$$(dirname ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i)" >/dev/null 2>&1 || true; \
623	done
624	-rmdir ${DESTDIR}${datadir}/${PACKAGE_NAME} >/dev/null 2>&1
625
626	for i in ${PROG}; do \
627		if test -f ${DESTDIR}${bindir}/$$i; then \
628			if rm -f ${DESTDIR}${bindir}/$$i; then \
629				${DELETE_OK}; \
630			else \
631				${DELETE_FAILED}; \
632			fi \
633		fi \
634	done
635
636	for i in ${INCLUDES}; do \
637		if test -f ${DESTDIR}${includedir}/${includesubdir}/$$i; then \
638			if rm -f ${DESTDIR}${includedir}/${includesubdir}/$$i; then \
639				${DELETE_OK}; \
640			else \
641				${DELETE_FAILED}; \
642			fi \
643		fi \
644	done
645	-rmdir ${DESTDIR}${includedir}/${includesubdir} >/dev/null 2>&1
646
647	for i in ${MO_FILES}; do \
648		if test -f ${DESTDIR}${localedir}/$${i%.mo}/LC_MESSAGES/${localename}.mo; then \
649			if rm -f ${DESTDIR}${localedir}/$${i%.mo}/LC_MESSAGES/${localename}.mo; then \
650				${DELETE_OK}; \
651			else \
652				${DELETE_FAILED}; \
653			fi \
654		fi \
655	done
656
657	for i in ${MAN}; do \
658		if test -f ${DESTDIR}${mandir}/${mansubdir}/$$i; then \
659			if rm -f ${DESTDIR}${mandir}/${mansubdir}/$$i; then \
660				${DELETE_OK}; \
661			else \
662				${DELETE_FAILED}; \
663			fi \
664		fi \
665	done
666
667uninstall-extra:
668
669clean:
670	for i in ${SUBDIRS}; do \
671		${MAKE} -C $$i ${MFLAGS} clean || exit $$?; \
672	done
673
674	for i in ${DEPS} ${OBJS} ${OBJS_EXTRA} ${LIB_OBJS} ${LIB_OBJS_EXTRA} ${PLUGIN_OBJS} ${PROG} ${PROG_NOINST} ${SHARED_LIB} ${SHARED_LIB_NOINST} ${STATIC_LIB} ${STATIC_LIB_NOINST} ${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${CLEAN_LIB} ${MO_FILES} ${CLEAN}; do \
675		if test -f $$i -o -d $$i; then \
676			if rm -fr $$i; then \
677				${DELETE_OK}; \
678			else \
679				${DELETE_FAILED}; \
680			fi \
681		fi \
682	done
683
684distclean: clean
685	for i in ${SUBDIRS}; do \
686		${MAKE} -C $$i ${MFLAGS} distclean || exit $$?; \
687	done
688
689	for i in ${DISTCLEAN} *.d *~; do \
690		if test -f $$i -o -d $$i; then \
691			if rm -fr $$i; then \
692				${DELETE_OK}; \
693			else \
694				${DELETE_FAILED}; \
695			fi \
696		fi \
697	done
698
699ifndef V
700
701QUIET = quiet_
702LINK_STATUS = printf "Link: $@\n"
703LINK_OK = true
704LINK_FAILED = exit $$?
705INSTALL_STATUS = printf "Install: $$i\n"
706INSTALL_OK = true
707INSTALL_FAILED = exit $$?
708DELETE_OK = printf "Delete: $$i\n"
709DELETE_FAILED = exit $$?
710
711else
712
713QUIET =
714LINK_STATUS = printf "Link: ${LD} $@ $$LDOBJS ${LDFLAGS} ${LIBS}\n"
715LINK_OK = true
716LINK_FAILED = exit $$?
717INSTALL_STATUS = printf "Install: $$i\n"
718INSTALL_OK = true
719INSTALL_FAILED = exit $$?
720DELETE_OK = printf "Delete: $$i\n"
721DELETE_FAILED = exit $$?
722
723endif
724
725-include *.d
726