2018-01-05 13:17:59 +02:00
|
|
|
PHPFILE=example.php
|
2017-11-07 08:21:38 +02:00
|
|
|
|
2020-12-08 02:08:59 +02:00
|
|
|
all: compile fmt build
|
2018-02-06 12:39:42 +02:00
|
|
|
|
2018-02-24 00:17:51 +02:00
|
|
|
fmt:
|
2018-02-19 13:00:58 +02:00
|
|
|
find . -type f -iregex '.*\.go' -exec gofmt -l -s -w '{}' +
|
2018-02-24 00:17:51 +02:00
|
|
|
|
|
|
|
build:
|
2018-07-02 20:48:55 +03:00
|
|
|
go generate ./...
|
2020-05-13 21:05:15 +03:00
|
|
|
go build ./cmd/...
|
2017-11-07 08:21:38 +02:00
|
|
|
|
2018-02-06 19:11:47 +02:00
|
|
|
test:
|
2021-07-31 20:01:44 +03:00
|
|
|
go test -v ./...
|
2018-04-09 23:26:44 +03:00
|
|
|
|
|
|
|
cover:
|
2018-01-13 01:59:24 +02:00
|
|
|
go test ./... --cover
|
2017-12-04 12:40:36 +02:00
|
|
|
|
2018-02-18 14:25:20 +02:00
|
|
|
bench:
|
2020-05-18 22:36:39 +03:00
|
|
|
go test -benchmem -bench=. ./internal/php5
|
|
|
|
go test -benchmem -bench=. ./internal/php7
|
2018-02-18 14:25:20 +02:00
|
|
|
|
2021-07-30 20:53:27 +03:00
|
|
|
compile: ./internal/php5/php5.go ./internal/php7/php7.go ./internal/php8/php8.go ./internal/php8/scanner.go ./internal/scanner/scanner.go
|
|
|
|
sed -i -e 's/yyErrorVerbose = false/yyErrorVerbose = true/g' ./internal/php5/php5.go
|
|
|
|
sed -i -e 's/yyErrorVerbose = false/yyErrorVerbose = true/g' ./internal/php7/php7.go
|
|
|
|
sed -i -e 's/yyErrorVerbose = false/yyErrorVerbose = true/g' ./internal/php8/php8.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/php8/php8.go
|
|
|
|
sed -i -e 's/\/\/line/\/\/ line/g' ./internal/scanner/scanner.go
|
|
|
|
sed -i -e 's/\/\/line/\/\/ line/g' ./internal/php8/scanner.go
|
2018-02-06 12:39:42 +02:00
|
|
|
rm -f y.output
|
|
|
|
|
2020-05-13 00:16:36 +03:00
|
|
|
./internal/scanner/scanner.go: ./internal/scanner/scanner.rl
|
2019-03-10 23:37:01 +02:00
|
|
|
ragel -Z -G2 -o $@ $<
|
2017-11-23 17:33:47 +02:00
|
|
|
|
2020-05-13 00:16:36 +03:00
|
|
|
./internal/php5/php5.go: ./internal/php5/php5.y
|
2018-01-26 15:24:56 +02:00
|
|
|
goyacc -o $@ $<
|
|
|
|
|
2020-05-13 00:16:36 +03:00
|
|
|
./internal/php7/php7.go: ./internal/php7/php7.y
|
2017-11-23 17:33:47 +02:00
|
|
|
goyacc -o $@ $<
|
2018-06-05 00:09:21 +03:00
|
|
|
|
2021-07-30 20:53:27 +03:00
|
|
|
./internal/php8/php8.go: ./internal/php8/php8.y
|
|
|
|
goyacc -o $@ $<
|
|
|
|
|
|
|
|
./internal/php8/scanner.go: ./internal/php8/scanner.rl
|
|
|
|
ragel -Z -G2 -o $@ $<
|
|
|
|
|
2018-06-05 00:09:21 +03:00
|
|
|
cpu_pprof:
|
2020-05-18 22:36:39 +03:00
|
|
|
go test -cpuprofile cpu.pprof -bench=. -benchtime=20s ./internal/php7
|
2018-06-21 20:37:34 +03:00
|
|
|
go tool pprof ./php7.test cpu.pprof
|
2018-06-05 00:09:21 +03:00
|
|
|
|
|
|
|
mem_pprof:
|
2020-05-18 22:36:39 +03:00
|
|
|
go test -memprofile mem.pprof -bench=. -benchtime=20s -benchmem ./internal/php7
|
2018-06-21 20:37:34 +03:00
|
|
|
go tool pprof -alloc_objects ./php7.test mem.pprof
|
2018-06-05 01:20:57 +03:00
|
|
|
|
|
|
|
cpu_pprof_php5:
|
2020-05-18 22:36:39 +03:00
|
|
|
go test -cpuprofile cpu.prof -bench=. -benchtime=20s ./internal/php5
|
2018-06-05 01:20:57 +03:00
|
|
|
go tool pprof ./php5.test cpu.prof
|
|
|
|
|
|
|
|
mem_pprof_php5:
|
2020-05-18 22:36:39 +03:00
|
|
|
go test -memprofile mem.prof -bench=. -benchtime=20s -benchmem ./internal/php5
|
2018-06-05 01:20:57 +03:00
|
|
|
go tool pprof -alloc_objects ./php5.test mem.prof
|