-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (36 loc) · 1.12 KB
/
Makefile
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
PLOT_OWNERS_COUNT=20
PLOT_COUNTRIES_COUNT=20
# Create plot: owners/companies
companies: plot-owners
owners: plot-owners
plot-owners: cidrs-oneline.txt
@sort plot/cidrs-oneline.txt | uniq -c | sort -nr | head -n ${PLOT_OWNERS_COUNT} > plot/owners.txt
@GNUPLOT_LIB="plot" gnuplot plot/owners.gnu
@echo "owners.png"
cidrs-oneline.txt:
@awk '{print $$2}' CIDRs.txt > plot/cidrs-oneline.txt
# Create plot: countries
countries: plot-countries
plot-countries: countries-list.txt
@sort plot/countries-list.txt | uniq -c | sort -nr | head -n ${PLOT_COUNTRIES_COUNT} > plot/countries.txt
@GNUPLOT_LIB="plot" gnuplot plot/countries.gnu
@echo "countries.png"
countries-list.txt:
plot/fetch_countries.sh
# Create plot: world map
map: plot-map
plot-map: points.txt
@GNUPLOT_LIB="plot" gnuplot plot/world_map.gnu
@echo "world_map.png"
points.txt:
plot/fetch_ip_locations.sh
# Clean stuff
clean:
rm -f *.png
rm -f plot/cidrs-oneline.txt
rm -f plot/countries-list.txt
rm -f plot/countries.txt
rm -f plot/country.txt
rm -f plot/owners.txt
rm -f plot/points.txt
.PHONY: companies plot-owners countries plot-countries map plot-map clean