Bug 18886 installation crashes if fontconfig already installed
[platform/upstream/fontconfig.git] / Makefile.am
1
2 #  fontconfig/Makefile.am
3
4 #  Copyright © 2003 Keith Packard
5
6 #  Permission to use, copy, modify, distribute, and sell this software and its
7 #  documentation for any purpose is hereby granted without fee, provided that
8 #  the above copyright notice appear in all copies and that both that
9 #  copyright notice and this permission notice appear in supporting
10 #  documentation, and that the name of Keith Packard not be used in
11 #  advertising or publicity pertaining to distribution of the software without
12 #  specific, written prior permission.  Keith Packard makes no
13 #  representations about the suitability of this software for any purpose.  It
14 #  is provided "as is" without express or implied warranty.
15
16 #  THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 #  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 #  EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 #  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 #  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 #  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 #  PERFORMANCE OF THIS SOFTWARE.
23
24 DOCSRC=@DOCSRC@
25 SUBDIRS=fontconfig fc-case fc-lang fc-glyphname fc-arch src \
26         fc-cache fc-cat fc-list fc-match fc-query fc-scan conf.d $(DOCSRC) test
27          
28 EXTRA_DIST = \
29         fontconfig.pc.in \
30         fonts.conf.in \
31         fonts.dtd \
32         fontconfig.spec.in \
33         fontconfig.spec \
34         fontconfig-zip.in
35 CLEANFILES = fonts.conf
36 DISTCLEANFILES = config.cache doltcompile
37 MAINTAINERCLEANFILES = \
38         $(srcdir)/aclocal.m4 \
39         $(srcdir)/autoscan.log \
40         $(srcdir)/compile \
41         $(srcdir)/config.guess \
42         $(srcdir)/config.h.in \
43         $(srcdir)/config.sub \
44         $(srcdir)/configure.scan \
45         $(srcdir)/depcomp \
46         $(srcdir)/install-sh \
47         $(srcdir)/ltmain.sh \
48         $(srcdir)/missing \
49         $(srcdir)/mkinstalldirs \
50         `find "$(srcdir)" -type f -name Makefile.in -print`
51
52 pkgconfigdir=$(libdir)/pkgconfig
53 pkgconfig_DATA = fontconfig.pc
54
55 configdir=$(CONFDIR)
56 config_DATA=fonts.dtd
57
58 if CROSS_COMPILING
59   RUN_FC_CACHE_TEST=false
60 else
61   RUN_FC_CACHE_TEST=test -z "$(DESTDIR)"
62 endif
63
64 # Creating ChangeLog from git log:
65
66 MAINTAINERCLEANFILES += $(srcdir)/ChangeLog
67 EXTRA_DIST += ChangeLog
68 ChangeLog: $(srcdir)/ChangeLog
69 $(srcdir)/ChangeLog:
70         if test -d "$(srcdir)/.git"; then \
71           (GIT_DIR=$(top_srcdir)/.git ./missing --run git log --stat) | fmt --split-only > $@.tmp \
72           && mv -f $@.tmp $@ \
73           || ($(RM) $@.tmp; \
74               echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \
75               (test -f $@ || echo git-log is required to generate this file >> $@)); \
76         else \
77           test -f $@ || \
78           (echo A git checkout and git-log is required to generate ChangeLog >&2 && \
79           echo A git checkout and git-log is required to generate this file >> $@); \
80         fi
81
82 .PHONY: ChangeLog
83
84 fonts.conf: fonts.conf.in Makefile
85         sed \
86                 -e 's,@FC_CACHEDIR\@,$(FC_CACHEDIR),g' \
87                 -e 's,@FC_DEFAULT_FONTS\@,$(FC_DEFAULT_FONTS),g' \
88                 -e 's,@FC_FONTPATH\@,$(FC_FONTPATH),g' \
89                 -e 's,@PACKAGE\@,$(PACKAGE),g' \
90                 -e 's,@VERSION\@,$(VERSION),g' \
91                 $< > $@.tmp && \
92         mv $@.tmp $@
93
94 install-data-local: fonts.conf
95         $(mkinstalldirs) $(DESTDIR)$(configdir) $(DESTDIR)$(fc_cachedir)
96         if [ -f $(DESTDIR)$(configdir)/fonts.conf ]; then \
97           echo "backing up existing $(DESTDIR)$(configdir)/fonts.conf"; \
98           mv $(DESTDIR)$(configdir)/fonts.conf $(DESTDIR)$(configdir)/fonts.conf.bak; \
99         fi
100         if [ -f $(srcdir)/fonts.conf ]; then \
101           echo " $(INSTALL_DATA) $(srcdir)/fonts.conf $(DESTDIR)$(configdir)/fonts.conf"; \
102           $(INSTALL_DATA) $(srcdir)/fonts.conf $(DESTDIR)$(configdir)/fonts.conf; \
103         else if [ -f fonts.conf ]; then \
104           echo " $(INSTALL_DATA) fonts.conf $(DESTDIR)$(configdir)/fonts.conf"; \
105           $(INSTALL_DATA) fonts.conf $(DESTDIR)$(configdir)/fonts.conf; \
106         fi; fi
107         @(if $(RUN_FC_CACHE_TEST); then \
108             echo "fc-cache$(EXEEXT) -s -f -v"; \
109             fc-cache/fc-cache$(EXEEXT) -s -f -v; \
110         else \
111             echo "***"; \
112             echo "*** Warning: fonts.cache not built"; \
113             echo "***"; \
114             echo "*** Generate this file manually on host system using fc-cache"; \
115             echo "***"; \
116         fi)
117
118 uninstall-local:
119         if [ -f $(srcdir)/fonts.conf ]; then \
120           if cmp -s $(srcdir)/fonts.conf $(DESTDIR)$(configdir)/fonts.conf; then \
121              echo " uninstall standard $(DESTDIR)$(configdir)/fonts.conf"; \
122              rm -f $(DESTDIR)$(configdir)/fonts.conf; \
123           fi; \
124         else if [ -f fonts.conf ]; then \
125           if cmp -s fonts.conf $(DESTDIR)$(configdir)/fonts.conf; then \
126              echo " uninstall standard $(DESTDIR)$(configdir)/fonts.conf"; \
127              rm -f $(DESTDIR)$(configdir)/fonts.conf; \
128           fi; \
129         fi; fi
130
131 debuild debuild-signed: debuild-dirs
132         (cd $(distdir)/debian && debuild)
133
134 debuild-unsigned: debuild-dirs
135         (cd $(distdir)/debian && debuild -us -uc)
136
137 debuild-dirs: distdir
138         rm -f $(PACKAGE)_$(VERSION).orig.tar.gz
139         rm -rf $(distdir).orig
140         cp -a $(distdir) $(distdir).orig
141         rm -rf $(distdir).orig/debian