iptogeo/data/Makefile

34 lines
1.1 KiB
Makefile
Raw Permalink Normal View History

2016-02-04 20:39:50 +01:00
IP_DATA = ../src/ip_data.c
PROVIDERS = afrinic arin apnic lacnic ripencc
2016-02-06 14:24:26 +01:00
DEST = prefix_res
2016-02-04 20:39:50 +01:00
MD5 = $(addsuffix .md5,$(PROVIDERS))
all: clean_md5 $(MD5) $(IP_DATA)
clean_md5:
@rm -f $(MD5)
$(PROVIDERS):
@$(foreach provider, $(PROVIDERS),\
wget "ftp://ftp.ripe.net/pub/stats/${provider}/delegated-${provider}-extended-latest" -O $(provider);)
%.md5:%
@wget -q "ftp://ftp.ripe.net/pub/stats/$(basename $@)/delegated-$(basename $@)-extended-latest.md5" -O $@
@cat $@ | grep -oP '[0-9a-f]{32}' | tr -d '\n' > $@.tmp
@echo " $(basename $@)" >> $@.tmp
@rm -f $@
@mv $@.tmp $@
@md5sum -c $@ || wget "ftp://ftp.ripe.net/pub/stats/$(basename $@)/delegated-$(basename $@)-extended-latest" -O $(basename $@) ; true
$(DEST): $(PROVIDERS)
@cat $(PROVIDERS) | grep -v asn | grep -v summary | grep -v '#' | grep ipv[46] | grep -v reserved | sort -n -k 4 -t '|' > $(DEST)
2016-02-04 20:39:50 +01:00
$(IP_DATA): $(DEST)
@echo "Rebuild ip_data.c"
@./build_c_array.py > ../src/ip_data.c
force_ip_data:
@echo "Force rebuild ip_data.c"
@./build_c_array.py > ../src/ip_data.c
2016-02-04 20:39:50 +01:00
clean:
rm -f $(PROVIDERS) $(DEST) $(SHA1_FILE) $(MD5)