Makefile.am 6.52 KB
Newer Older
1
SUBDIRS=po .
2

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

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

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

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

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

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

27
ITS_FILES = data/its/shared-mime-info.loc data/its/shared-mime-info.its
28

29
EXTRA_DIST = \
30 31
	data/shared-mime-info-spec.xml	\
	data/freedesktop.org.xml.in	\
32
	src/test-tree-magic.c		\
33 34
	$(packages_DATA) 		\
	README				\
35
	HACKING				\
36
	$(man_MANS)			\
37
	$(ITS_FILES)			\
38 39
	shared-mime-info.pc.in		\
	data/freedesktop_generate.sh
40

41
CLEANFILES = freedesktop.org.xml po/stamp-it
42

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

$(pkgconfig_DATA): config.status

48 49
freedesktop.org.xml: data/freedesktop.org.xml.in $(top_srcdir)/po/*.po data/its/shared-mime-info.its data/freedesktop_generate.sh
	$(top_srcdir)/data/freedesktop_generate.sh "$(top_srcdir)" "$(top_builddir)"
50

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

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

uninstall-hook:
Bastien Nocera's avatar
Bastien Nocera committed
63
	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
64 65 66 67 68
	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
69
	rm -f "$(DESTDIR)$(datadir)/mime/mime.cache"
70
	rm -f "$(DESTDIR)$(datadir)/mime/XMLnamespaces"
Bastien Nocera's avatar
Bastien Nocera committed
71 72 73 74
	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"
75 76
	rm -f "$(DESTDIR)$(datadir)/mime/treemagic"
	rm -f "$(DESTDIR)$(datadir)/mime/types"
77
	rm -f "$(DESTDIR)$(datadir)/mime/version"
78

79
all: $(defaultmakedeps)
80

81 82
XDGMIME_PATH=@XDGMIME_PATH@

83
po/shared-mime-info.pot: data/freedesktop.org.xml.in $(top_srcdir)/po/*.po
84 85
	make -C po shared-mime-info.pot

86
local-test: po/shared-mime-info.pot freedesktop.org.xml update-mime-database$(EXEEXT)
87 88 89 90
if CROSS_COMPILING
	@echo "Cross compiling: Skipping checks"
else
	@if ! test -d staging-tests/ ; then \
91
		echo "***************************************************************************" ; \
92
		echo "*** Add your file to process to staging-tests/ and run local-test again ***" ; \
93
		echo "***************************************************************************" ; \
94 95
		exit 1 ; \
	fi
96
	if test -d $(top_srcdir)/.git/ ; then \
97 98 99
		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/" ; \
100
		XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" XDG_DATA_HOME="$(top_builddir)/temp-mime-dir/" $(XDGMIME_PATH)/src/print-mime-data$(EXEEXT) staging-tests/; \
101 102 103 104
		rm -rf "$(top_builddir)/temp-mime-dir/" ; \
	fi
endif

105
check: po/shared-mime-info.pot freedesktop.org.xml update-mime-database$(EXEEXT) check-translations
Hib Eris's avatar
Hib Eris committed
106 107 108
if CROSS_COMPILING
	@echo "Cross compiling: Skipping checks"
else
109
	xmllint --noout --valid $(top_builddir)/freedesktop.org.xml || exit 1;	\
110
	if test -d $(top_srcdir)/.git/ ; then \
111
		$(top_builddir)/update-mime-database$(EXEEXT) $(top_srcdir)/tests/mime-db-tests/ ; \
112
	fi
113 114
	@if test -d $(top_srcdir)/.git/ ; then \
		if test ! -x $(XDGMIME_PATH)/src/test-mime-data$(EXEEXT) || test ! -x $(top_builddir)/test-tree-magic$(EXEEXT) ; then \
115 116 117 118 119 120 121 122
			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/" ; \
123
			XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" XDG_DATA_HOME="$(top_builddir)/temp-mime-dir/" $(XDGMIME_PATH)/src/test-mime-data$(EXEEXT) -v $(top_srcdir)/tests/mime-detection/list || exit 1; \
124
			XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" XDG_DATA_HOME="$(top_builddir)/temp-mime-dir/" $(XDGMIME_PATH)/src/test-mime$(EXEEXT) || exit 1; \
125
			XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" $(top_builddir)/test-tree-magic$(EXEEXT) $(top_srcdir)/tests/mime-detection/tree-list || exit 1; \
126 127
			rm -rf "$(top_builddir)/temp-mime-dir/" ; \
		fi; \
128
	fi
129
	@if test x`grep '<mime-type' $(srcdir)/data/freedesktop.org.xml.in | tr -d '[:blank:]' | sort | uniq -d` != "x"; then \
130 131 132
		echo "*************************************************************" ; \
		echo "*** Some mime-types are duplicated, fix before committing ***" ; \
		echo "*************************************************************" ; \
133 134
		exit 1 ; \
	fi
135 136
	@echo Number of mime-types that might need generic-icon: `grep "mime-type type=" $(srcdir)/data/freedesktop.org.xml.in | grep -v video/ | grep -v image/ | grep -v text/ | grep -v audio/ | grep -v "octet-stream" | wc -l` ; \
	echo Number of mime-types with a generic icon: `grep "generic-icon name=" $(srcdir)/data/freedesktop.org.xml.in | wc -l` ;
Hib Eris's avatar
Hib Eris committed
137
endif
138

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

148
update-translations: po/shared-mime-info.pot
149 150
	@tx pull --all --force --skip
	@tx push --source
151

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

dist: ChangeLog

.PHONY: ChangeLog

162 163

ACLOCAL_AMFLAGS = -I m4