IP to Geo

IP to Geo Git Source Tree

Root/data/Makefile

1IP_DATA = ../src/ip_data.c
2PROVIDERS = afrinic arin apnic lacnic ripencc
3DEST = prefix_res
4MD5 = $(addsuffix .md5,$(PROVIDERS))
5
6all: clean_md5 $(MD5) $(IP_DATA)
7
8clean_md5:
9@rm -f $(MD5)
10
11$(PROVIDERS):
12@$(foreach provider, $(PROVIDERS),\
13wget "ftp://ftp.ripe.net/pub/stats/${provider}/delegated-${provider}-extended-latest" -O $(provider);)
14
15%.md5:%
16@wget -q "ftp://ftp.ripe.net/pub/stats/$(basename $@)/delegated-$(basename $@)-extended-latest.md5" -O $@
17@cat $@ | grep -oP '[0-9a-f]{32}' | tr -d '\n' > $@.tmp
18@echo " $(basename $@)" >> $@.tmp
19@rm -f $@
20@mv $@.tmp $@
21@md5sum -c $@ || wget "ftp://ftp.ripe.net/pub/stats/$(basename $@)/delegated-$(basename $@)-extended-latest" -O $(basename $@) ; true
22
23$(DEST): $(PROVIDERS)
24@cat $(PROVIDERS) | grep -v asn | grep -v summary | grep -v '#' | grep ipv[46] | sort -n -k 4 -t '|' > $(DEST)
25
26$(IP_DATA): $(DEST)
27@echo "Rebuild ip_data.c"
28@./build_c_array.py > ../src/ip_data.c
29
30clean:
31rm -f $(PROVIDERS) $(DEST) $(SHA1_FILE) $(MD5)

Archive Download this file

Branches

Tags