-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
59 lines (45 loc) · 1.23 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
49
50
51
52
53
54
55
56
57
58
59
default: all
DUMPFILE := artifacts/fcc-license-view-data-csv-format.zip
BOLTDB := artifacts/fcc.db
FCC2BOLT := bin/fcc2bolt
FCCD := bin/fccd
FCCDB := bin/fccdb
DBDIR := /usr/share/fccdb
.PHONY: all
all: binaries | ingest
.PHONY: help
help:
@echo
@echo "all: build binaries and ingest database (default)"
@echo "binaries: build fccdb and fcc2bolt"
@echo "ingest: download FCC database and insert relevant records into boltdb"
@echo "install: copy db file to $(DBDIR) and fcc binary to /usr/local/bin"
@echo "download: download FCC dataset"
@echo
.PHONY: binaries
binaries: $(FCC2BOLT) $(FCCDB) $(FCCD)
.PHONY: ingest
ingest: $(BOLTDB)
.PHONY: clean
clean:
rm -f $(DUMPFILE) $(BOLTDB) $(FCC2BOLT) $(FCCDB) $(FCCD)
.PHONY: download
download: $(DUMPFILE)
.PHONY: install
install: all $(DBDIR)
cp $(FCCDB) /usr/local/bin/fccdb
cp $(FCCD) /usr/local/bin/fccd
cp $(BOLTDB) $(DBDIR)
$(DUMPFILE):
curl -k "https://data.fcc.gov/download/license-view/fcc-license-view-data-csv-format.zip" \
> $(DUMPFILE)
$(BOLTDB): $(DUMPFILE) | $(FCC2BOLT)
$(FCC2BOLT) -dump $(DUMPFILE) -db $(BOLTDB)
$(FCC2BOLT):
go build -o $@ cmd/fcc2bolt/main.go
$(FCCDB):
go build -o $@ cmd/fccdb/main.go
$(FCCD):
go build -o $@ cmd/fccd/main.go
$(DBDIR):
mkdir -p $@