-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
51 lines (39 loc) · 1.43 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
SUBDIRS := bench src test tools
SOURCES := $(shell find $(SUBDIRS) -type f) dist/setup-config
ifneq ($(shell which nproc),)
PROCS := $(shell nproc)
else
PROCS := $(shell sysctl -n hw.ncpu)
endif
SCALAR_NUMERIC := fixed32|fixed64|int32|int64|uint32|uint64|float|bool
.PHONY: run
run: dist/build/pokemon/pokemon
cabal run pokemon --jobs=$(PROCS)
.PHONY: bench
bench: dist/build/pokemon/pokemon
cabal bench --jobs=$(PROCS)
.PHONY: check
check: test
hlint $(SUBDIRS)
stylish-haskell -i `find $(SUBDIRS) -name "*.hs"`
.PHONY: test
test: dist/build/pokemon/pokemon
cabal test --jobs=$(PROCS) | grep -v '^Writing: '
dist/build/pokemon/pokemon: $(SOURCES)
cabal build --jobs=$(PROCS)
dist/setup-config: pokemon.cabal protos/src/Pokemon.proto src/encrypt.c src/encrypt_clean.c
cabal update
cabal install --only-dependencies --enable-tests --enable-benchmarks
cabal configure --disable-profiling --enable-tests --enable-benchmarks --enable-coverage
protos/src/Pokemon.proto: $(shell find protos/src/POGOProtos -name "*.proto")
echo 'syntax = "proto3";' > $@
(for i in $^; do cat $$i; echo; done) \
| egrep -v '^(syntax|package|import)' \
| sed -E -e 's/\.POGOProtos\.[^ ]+\.//g' \
| sed -E -e 's/(repeated (${SCALAR_NUMERIC}) [a-z_]+ = [0-9]+);/\1 [packed=true];/' \
>> $@
src/encrypt.c:
curl http://pgoapi.com/pgoencrypt.tar.gz \
| tar zx --strip-components 1 "pgoencrypt/src/encrypt.c"
src/encrypt_clean.c: src/simplify src/encrypt.c
$+ $@