Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (49 loc) · 1.45 KB
/
Copy pathMakefile
File metadata and controls
63 lines (49 loc) · 1.45 KB
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
60
61
62
63
export GOPATH=$(CURDIR)
GOARCH := $(shell go env GOARCH)
GOOS := $(shell go env GOOS)
all : padron parser
$(S) echo Done.
padron_SRC := $(addprefix src/padron/,local.go model/model.go server/server.go)
parser_SRC := $(addprefix src/padron/,model/model.go parser/main.go)
PKG := \
code.google.com/p/go-charset/charset \
code.google.com/p/go-charset/data \
github.com/coopernurse/gorp \
github.com/gorilla/context \
github.com/gorilla/mux \
github.com/mattn/go-sqlite3 \
LIBS := $(addprefix pkg/$(GOOS)_$(GOARCH)/,$(addsuffix .a,$(PKG)))
padron : $(padron_SRC) $(LIBS)
$(T) GO '$@'
$(Q) go build padron
parser : $(parser_SRC) $(LIBS)
$(T) GO '$@'
$(Q) go build padron/parser
src/%/.__pkg_src__ :
$(T) GOGET '$*'
$(Q) go get '$*'
$(Q) touch '$@'
$(LIBS) : pkg/$(GOOS)_$(GOARCH)/%.a : src/%/.__pkg_src__
$(T) GOLIB '$@'
$(Q) go install $(patsubst pkg/$(GOOS)_$(GOARCH)/%.a,%,$@)
pkgs :
clean :
$(Q) $(RM) padron parser
datos.tar.xz :
mkdir -p datos
test -e padron_completo.zip || \
wget -N http://www.tse.go.cr/zip/padron/padron_completo.zip
cd datos && unzip ../padron_completo.zip
tar cvJf $@ datos/
datos/PADRON_COMPLETO.txt datos/Distelec.txt : datos.tar.xz
$(T) TXT '$@ <= $^'
$(Q) tar xf $^ $@
$(Q) touch $@
padron.db : parser schema.sql datos/PADRON_COMPLETO.txt datos/Distelec.txt
$(T) DB '$@ <= $^'
rm -f padron.db
sqlite3 $@ < schema.sql
./parser datos/PADRON_COMPLETO.txt datos/Distelec.txt
S := @
Q := @
T = $(S) printf '%8s %s\n'