summaryrefslogtreecommitdiff
path: root/data/Makefile.am
blob: ce1b8fc38d0ec6b5c60144fe3a9470d9fbc96176 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
libmateweatherdtddir = $(pkgdatadir)
libmateweatherdtd_DATA = locations.dtd

libmateweatherlocationsdir = $(pkgdatadir)
libmateweatherlocations_in_files = Locations.xml.in

if USE_ONE_BIG_XML

LOCATIONS_STAMP = 

libmateweatherlocations_DATA = $(libmateweatherlocations_in_files:.xml.in=.xml$(COMPRESS_EXT))

%.xml$(COMPRESS_EXT): %.xml.in $(wildcard $(top_srcdir)/po-locations/*.po)
	$(AM_V_GEN)LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po-locations/.intltool-merge-cache $(top_srcdir)/po-locations $< `echo $@ | sed "s/.xml$(COMPRESS_EXT)/.xml/"` && \
	if test "x$(COMPRESS_EXT)" = "x.gz"; then				\
		gzip -n --force `echo $@ | sed "s/.xml$(COMPRESS_EXT)/.xml/"`;	\
	fi

else # USE_ONE_BIG_XML

LOCATIONS_STAMP = stamp-Locations.xml

PO_LOCATIONS = $(shell if test -n "$(LINGUAS)"; then for lang in $(LINGUAS); do if test -f "$(top_srcdir)/po-locations/$$lang.po"; then echo "$(top_srcdir)/po-locations/$$lang.po "; fi; done; else for pofile in $(top_srcdir)/po-locations/*.po; do echo $$pofile; done; fi)

# Helper variable
libmateweatherlocations_data = $(libmateweatherlocations_in_files:.xml.in=.xml)

libmateweatherlocations_DATA = $(shell echo $(PO_LOCATIONS) | sed "s|$(top_srcdir)/po-locations/|Locations.|g;s|\.po|.xml$(COMPRESS_EXT)|g") $(libmateweatherlocations_data)$(COMPRESS_EXT)

# We need this step so that we merge all the make Locations.xy.xml destinations
# into one unique destination. This makes -j2 work. (Else, we end up with
# multiple and conflicting calls to intltool-merge)
$(libmateweatherlocations_DATA): $(LOCATIONS_STAMP)

$(LOCATIONS_STAMP): $(libmateweatherlocations_in_files) $(PO_LOCATIONS) Makefile
	$(AM_V_at)LC_ALL=C $(INTLTOOL_MERGE) --multiple-output --xml-style --utf8 --cache=$(top_builddir)/po-locations/.intltool-merge-cache $(top_srcdir)/po-locations $< $(libmateweatherlocations_data) && \
	for pofile in $(PO_LOCATIONS); do \
		locale=`echo $$pofile | sed "s;$(top_srcdir)/po-locations/\(.*\)\.po;\1;"`;	\
		xmllint --noblanks -o Locations.$$locale.xml $$locale/$(libmateweatherlocations_data); \
		rm -f $$locale/$(libmateweatherlocations_data);		\
		test -d $$locale && rmdir $$locale;			\
		if test "x$(COMPRESS_EXT)" = "x.gz"; then		\
			gzip -n --force Locations.$$locale.xml;		\
		fi;							\
	done &&								\
	xmllint --noblanks -o Locations.xml C/$(libmateweatherlocations_data) && \
	rm -f C/$(libmateweatherlocations_data) &&				\
	test -d C && rmdir C &&						\
	if test "x$(COMPRESS_EXT)" = "x.gz"; then			\
		gzip -n --force Locations.xml;				\
	fi &&								\
	touch $@

endif # USE_ONE_BIG_XML

check:
	xmllint --valid --noout $(top_srcdir)/data/Locations.xml.in
	$(srcdir)/check-timezones.sh $(srcdir)/Locations.xml.in

### Locations.xml.in rebuild
rebuild-locations: locationdb.sqlite update-locations.py
	$(AM_V_GEN)($(srcdir)/update-locations.py > Locations.xml.in.new && mv Locations.xml.in.new Locations.xml.in) || rm -f Locations.xml.in.new

locationdb.sqlite: build-locationdb.pl major-cities.txt sources/nsd_cccc.txt sources/POP_PLACES.txt sources/US_CONCISE.txt sources/geonames_dd_dms_date_*.txt city-fixups.pl station-fixups.pl
	$(AM_V_GEN)$(srcdir)/build-locationdb.pl

EXTRA_DIST =	\
	$(libmateweatherlocations_in_files)	\
	$(libmateweatherdtd_DATA)			\
	check-timezones.sh			\
	README					\
	README.timezones

CLEANFILES =	\
	$(libmateweatherlocations_DATA)		\
	$(LOCATIONS_STAMP)

-include $(top_srcdir)/git.mk