# # Project Home: # ============ # https://mailfud.org/geoip-legacy/ # url = https://mailfud.org/geoip-legacy date = $(shell date +'%Y%m%d') suffix = tar.xz pkg_name = geoip-db-$(date) package = $(addsuffix .$(suffix), $(pkg_name)) sha1s = $(addsuffix .sha1sum, $(package)) files = GeoIP GeoIPv6 GeoIPCity GeoIPCityv6 GeoIPASNum GeoIPASNumv6 GeoIPISP GeoIPOrg tarballs = $(addprefix $(pkg_name)/, $(addsuffix .dat.gz, $(files))) script = $(pkg_name)/geoip_update.sh TARGETS = $(package) $(sha1s) all: $(TARGETS) .PHONY: downloads_clean $(tarballs): @echo -e "\n======= Downloading source tarballs =======\n" @mkdir -p $(pkg_name) @( cd $(pkg_name) ; \ for tarball in $(tarballs) ; do \ wget -N $(url)/`basename $$tarball` ; \ done ; \ ) $(script): @( cd $(pkg_name) ; \ wget -N $(url)/`basename $(script)` ; \ ) $(package): $(tarballs) $(script) @echo -e "\n======= Create $(package) tarball =======\n" @tar -cJvf $(package) $(pkg_name)/ @rm -rf $(pkg_name)/ $(sha1s): %.$(suffix).sha1sum : %.$(suffix) @for tarball in $< ; do \ echo -e "\n======= Calculation the '$$tarball' sha1sum =======\n" ; \ sha1sum --binary $$tarball > $$tarball.sha1sum ; \ done downloads_clean: @rm -rf $(package) $(sha1s)