Makefile.am 6.3 KB
Newer Older
Bastien Nocera's avatar
Bastien Nocera committed
1
SUBDIRS=. po
2

vtorri's avatar
vtorri committed
3
AM_CPPFLAGS = $(ALL_CFLAGS)
4

5
packagesdir = $(datadir)/mime/packages
6
packages_DATA = freedesktop.org.xml
Thomas Leonard's avatar
Thomas Leonard committed
7

8 9
bin_PROGRAMS = update-mime-database
update_mime_database_SOURCES = update-mime-database.c
10 11
update_mime_database_CFLAGS = $(ALL_CFLAGS)
update_mime_database_LDADD = $(ALL_LIBS)
12

13 14 15 16 17
noinst_PROGRAMS = test-subclassing
test_subclassing_SOURCES = test-subclassing.c
test_subclassing_CFLAGS = $(ALL_CFLAGS)
test_subclassing_LDADD = $(ALL_LIBS)

18 19 20 21 22 23 24
if HAVE_GIO
noinst_PROGRAMS += test-tree-magic
test_tree_magic_SOURCES = test-tree-magic.c
test_tree_magic_CFLAGS = $(GIO_CFLAGS)
test_tree_magic_LDADD = $(GIO_LIBS)
endif

Thomas Leonard's avatar
Thomas Leonard committed
25 26
man_MANS = update-mime-database.1

27 28 29
EXTRA_DIST = \
	shared-mime-info-spec.xml	\
	freedesktop.org.xml.in		\
30
	test-tree-magic.c		\
31 32
	$(packages_DATA) 		\
	README				\
33
	HACKING				\
34
	$(man_MANS)			\
35 36
	shared-mime-info.pc.in		\
	po/shared-mime-info.pot
37

38
CLEANFILES = freedesktop.org.xml po/stamp-it
39
DISTCLEANFILES = intltool-extract intltool-merge intltool-update
40

41
pkgconfigdir = $(datadir)/pkgconfig
42 43 44 45
pkgconfig_DATA = shared-mime-info.pc

$(pkgconfig_DATA): config.status

46 47 48
@INTLTOOL_XML_RULE@
@INTLTOOL_DESKTOP_RULE@

49 50 51 52 53 54
if CROSS_COMPILING
  update_mime_database=$(UPDATE_MIME_DATABASE)
else
  update_mime_database="$(top_builddir)/update-mime-database$(EXEEXT)"
endif

55
install-data-hook: install-binPROGRAMS
56
if ENABLE_UPDATE_MIMEDB
57
	$(update_mime_database) -V "$(DESTDIR)$(datadir)/mime"
58
endif
Thomas Leonard's avatar
Thomas Leonard committed
59 60

uninstall-hook:
Bastien Nocera's avatar
Bastien Nocera committed
61
	for media in text application image audio inode video message model multipart x-epoc x-content font; do rm -f "$(DESTDIR)$(datadir)/mime/$${media}/"*.xml; done
62 63 64 65 66
	rm -f "$(DESTDIR)$(datadir)/mime/globs"
	rm -f "$(DESTDIR)$(datadir)/mime/magic"
	rm -f "$(DESTDIR)$(datadir)/mime/aliases"
	rm -f "$(DESTDIR)$(datadir)/mime/subclasses"
	rm -f "$(DESTDIR)$(datadir)/mime/XMLnamespaces"
Bastien Nocera's avatar
Bastien Nocera committed
67
	rm -f "$(DESTDIR)$(datadir)/mime/mime.cache"
68
	rm -f "$(DESTDIR)$(datadir)/mime/XMLnamespaces"
Bastien Nocera's avatar
Bastien Nocera committed
69 70 71 72
	rm -f "$(DESTDIR)$(datadir)/mime/mime.cache"
	rm -f "$(DESTDIR)$(datadir)/mime/icons"
	rm -f "$(DESTDIR)$(datadir)/mime/generic-icons"
	rm -f "$(DESTDIR)$(datadir)/mime/globs2"
73 74
	rm -f "$(DESTDIR)$(datadir)/mime/treemagic"
	rm -f "$(DESTDIR)$(datadir)/mime/types"
75
	rm -f "$(DESTDIR)$(datadir)/mime/version"
76

77 78 79
defaultmakedeps=create-pot

all: $(defaultmakedeps)
80 81

create-pot:
Bastien Nocera's avatar
Bastien Nocera committed
82
	$(AM_V_GEN) $(MAKE) -C po shared-mime-info.pot
83

84 85 86 87 88
local-test: create-pot freedesktop.org.xml update-mime-database$(EXEEXT)
if CROSS_COMPILING
	@echo "Cross compiling: Skipping checks"
else
	@if ! test -d staging-tests/ ; then \
89
		echo "***************************************************************************" ; \
90
		echo "*** Add your file to process to staging-tests/ and run local-test again ***" ; \
91
		echo "***************************************************************************" ; \
92 93 94 95 96 97 98 99 100 101 102
		exit 1 ; \
	fi
	if test -d .git/ && test -x ../xdgmime/src/print-mime-data$(EXEEXT) ; then \
		mkdir -p $(top_builddir)/temp-mime-dir/mime/packages ; \
		cp -a $(top_builddir)/freedesktop.org.xml $(top_builddir)/temp-mime-dir/mime/packages/ ; \
		XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" $(top_builddir)/update-mime-database$(EXEEXT) "$(top_builddir)/temp-mime-dir/mime/" ; \
		XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" XDG_DATA_HOME="$(top_builddir)/temp-mime-dir/" ../xdgmime/src/print-mime-data$(EXEEXT) staging-tests/; \
		rm -rf "$(top_builddir)/temp-mime-dir/" ; \
	fi
endif

103
check: create-pot freedesktop.org.xml update-mime-database$(EXEEXT) check-translations
Hib Eris's avatar
Hib Eris committed
104 105 106
if CROSS_COMPILING
	@echo "Cross compiling: Skipping checks"
else
107
	xmllint --noout --valid $(top_builddir)/freedesktop.org.xml || exit 1;	\
108 109
	if test -d .git/ && test -x $(top_builddir)/update-mime-database$(EXEEXT) && test -d $(top_srcdir)/mime-db-tests ; then \
		$(top_builddir)/update-mime-database$(EXEEXT) mime-db-tests/ ; \
110
	fi
111 112 113 114 115 116 117 118 119 120 121 122 123 124
	@if test -d .git/ ; then \
		if test ! -x ../xdgmime/src/test-mime-data$(EXEEXT) || test ! -x $(top_builddir)/test-tree-magic$(EXEEXT) ; then \
			echo "***************************************************************************" ; \
			echo "*** xdgmime not compiled, test suite cannot run. Check HACKING for info ***" ; \
			echo "***************************************************************************" ; \
			exit 1 ; \
		else \
			mkdir -p $(top_builddir)/temp-mime-dir/mime/packages ; \
			cp -a $(top_builddir)/freedesktop.org.xml $(top_builddir)/temp-mime-dir/mime/packages/ ; \
			XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" $(top_builddir)/update-mime-database$(EXEEXT) "$(top_builddir)/temp-mime-dir/mime/" ; \
			XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" XDG_DATA_HOME="$(top_builddir)/temp-mime-dir/" ../xdgmime/src/test-mime-data$(EXEEXT) -v tests/list || XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" XDG_DATA_HOME="$(top_builddir)/temp-mime-dir/" ../xdgmime/src/test-mime$(EXEEXT) || (XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" ../xdgmime/src/test-mime-data$(EXEEXT) -v -v tests/list ; exit 1); \
			XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" $(top_builddir)/test-tree-magic$(EXEEXT) tests/tree-list || exit 1; \
			rm -rf "$(top_builddir)/temp-mime-dir/" ; \
		fi; \
125
	fi
126 127 128 129
	@if `grep comment $(srcdir)/freedesktop.org.xml.in | grep -v _comment | grep -q -v '<!'` ; then \
		echo "***************************************************************************" ; \
		echo "*** Some comments are not marked as translatable, fix before committing ***" ; \
		echo "***************************************************************************" ; \
130 131
		exit 1 ; \
	fi
132
	@echo Number of mime-types that might need generic-icon: `grep "mime-type type=" $(srcdir)/freedesktop.org.xml.in | grep -v video/ | grep -v image/ | grep -v text/ | grep -v audio/ | grep -v "octet-stream" | wc -l` ; \
133
	echo Number of mime-types with a generic icon: `grep "generic-icon name=" $(srcdir)/freedesktop.org.xml.in | wc -l` ;
Hib Eris's avatar
Hib Eris committed
134
endif
135

Bastien Nocera's avatar
Bastien Nocera committed
136
check-translations:
137
	@export RET=0 ; for i in $(top_srcdir)/po/*.po ; do						\
138
		if ! grep -q ^`basename $$i | sed 's,.po,,'`$$ $(top_srcdir)/po/LINGUAS ; then		\
139
			echo '***' `basename $$i | sed 's,.po,,'` missing from po/LINGUAS '***' ;	\
140
			RET=1;										\
141
		fi;											\
142 143
	done;												\
	if [ $$RET == 1 ] ; then exit 1; fi
144

145 146 147 148
update-translations: create-pot
	@tx pull --all --force --skip
	@tx push --source

149 150 151 152 153 154 155 156 157 158
# Build ChangeLog from GIT history
ChangeLog:
	@if test -f $(top_srcdir)/.git/HEAD; then \
		git log --stat --after="Tue Oct 6 14:46:33 2009 +0000" > $@; \
	fi

dist: ChangeLog

.PHONY: ChangeLog