forked from ttacon/libphonenumber
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
22 lines (17 loc) · 984 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
WHOAMI=$(shell whoami)
SED_I = sed -i
ifeq ($(shell uname -s), Darwin)
SED_I = sed -i ''
endif
nothing:
generate_proto:
docker run --rm -v $(PWD):$(PWD) -w $(PWD) znly/protoc -I. --go_out=Mgoogle/protobuf/field_mask.proto=github.com/google/go-genproto/protobuf/field_mask,plugins=grpc:./ ./google_libphonenumber/resources/*.proto
mv ./google_libphonenumber/resources/*.pb.go ./
sudo chown -R $(WHOAMI) *
$(SED_I) -E 's/package i18n_phonenumbers/package libphonenumber/g' $(shell ls *.pb.go)
awk '/static const unsigned char/ { show=1 } show; /}/ { show=0 }' ./google_libphonenumber/cpp/src/phonenumbers/metadata.cc | tail -n +2 | sed '$$d' | sed -E 's/([^,])$$/\1,/g' | awk 'BEGIN{print "package libphonenumber\nvar metaData = []byte{"}; {print}; END{print "}"}' > metagen.go
go fmt ./metagen.go
distupdate:
rm -rf ./google_libphonenumber
git clone --depth 1 https://github.com/googlei18n/libphonenumber.git ./google_libphonenumber/
update: distupdate generate_proto