astrognome/data/geonames/Makefile.am

71 lines
2.3 KiB
Makefile

geodatadir = $(pkgdatadir)
geodata_DATA = geodata.xml
EXTRA_DIST = geodata.xml
MAINTAINERCLEANFILES = geodata.xml
countryInfoURL = "http://download.geonames.org/export/dump/countryInfo.txt"
timeZonesURL = "http://download.geonames.org/export/dump/timeZones.txt"
allCountriesURL = "http://download.geonames.org/export/dump/allCountries.zip"
countryInfo.txt:
@-if test -x $(WGET); then \
$(WGET) $(countryInfoURL); \
else \
if test -x $(CURL); then \
$(CURL) $(countryInfoURL) > "$@" ; \
else \
echo "wget and curl could not be found in your PATH."; \
echo "One of them is needed to create geodata.xml!"; \
fi; \
fi
timeZones.txt:
@-if test -x $(WGET); then \
$(WGET) $(timeZonesURL); \
else \
if test -x $(CURL); then \
$(CURL) $(timeZonesURL) > "$@" ; \
else \
echo "wget and curl could not be found in your PATH."; \
echo "One of them is needed to create geodata.xml!"; \
fi; \
fi
allCountries.zip:
@-if test -x $(WGET); then \
$(WGET) $(allCountriesURL); \
else \
if test -x $(CURL); then \
$(CURL) $(allCountriesURL) > "$@" ; \
else \
echo "wget and curl could not be found in your PATH."; \
echo "One of them is needed to create geodata.xml!"; \
fi; \
fi;
allCountries.txt: allCountries.zip
$(AM_V_GEN) if test -x $(UNZIP); then \
$(UNZIP) -o allCountries.zip && test -f allCountries.txt && touch allCountries.txt; \
else \
echo "unzip could not be found in your PATH."; \
echo "It is needed to create geodata.xml!"; \
fi;
cities.txt: allCountries.txt
$(AM_V_GEN) $(AWK) -f $(VPATH)/geonames_process.awk allCountries.txt > $@
geodata.xml: countryInfo.txt timeZones.txt cities.txt
$(AM_V_GEN) if test -x "$(PERL)"; then \
if test "x$(have_geonames_perl_modules)" = "xyes" -o "x$(I_HAVE_PERL_MODULES)" = "xyes"; then \
$(PERL) $(VPATH)/geonames_process.pl; \
else \
echo "XML::Writer and IO::File perl modules are required to process geonames data."; \
echo "configure reported they are not installed. If you are sure they are,"; \
echo "set the I_HAVE_PERL_MODULES environment variable to yes"; \
fi; \
else \
echo "perl5 is required to create geodata.xml!"; \
fi