forked from z7zmey/php-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (39 loc) · 1.5 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
PHPFILE=example.php
all: compile fmt build
fmt:
find . -type f -iregex '.*\.go' -exec gofmt -l -s -w '{}' +
build:
go generate ./...
go build ./cmd/...
test:
go test ./...
cover:
go test ./... --cover
bench:
go test -benchmem -bench=. ./internal/php5
go test -benchmem -bench=. ./internal/php7
compile: ./internal/php5/php5.go ./internal/php7/php7.go ./internal/scanner/scanner.go
sed -i '' -e 's/yyErrorVerbose = false/yyErrorVerbose = true/g' ./internal/php7/php7.go
sed -i '' -e 's/yyErrorVerbose = false/yyErrorVerbose = true/g' ./internal/php5/php5.go
sed -i '' -e 's/\/\/line/\/\/ line/g' ./internal/php5/php5.go
sed -i '' -e 's/\/\/line/\/\/ line/g' ./internal/php7/php7.go
sed -i '' -e 's/\/\/line/\/\/ line/g' ./internal/scanner/scanner.go
rm -f y.output
./internal/scanner/scanner.go: ./internal/scanner/scanner.rl
ragel -Z -G2 -o $@ $<
./internal/php5/php5.go: ./internal/php5/php5.y
goyacc -o $@ $<
./internal/php7/php7.go: ./internal/php7/php7.y
goyacc -o $@ $<
cpu_pprof:
go test -cpuprofile cpu.pprof -bench=. -benchtime=20s ./internal/php7
go tool pprof ./php7.test cpu.pprof
mem_pprof:
go test -memprofile mem.pprof -bench=. -benchtime=20s -benchmem ./internal/php7
go tool pprof -alloc_objects ./php7.test mem.pprof
cpu_pprof_php5:
go test -cpuprofile cpu.prof -bench=. -benchtime=20s ./internal/php5
go tool pprof ./php5.test cpu.prof
mem_pprof_php5:
go test -memprofile mem.prof -bench=. -benchtime=20s -benchmem ./internal/php5
go tool pprof -alloc_objects ./php5.test mem.prof