2018-01-05 13:17:59 +02:00
|
|
|
PHPFILE=example.php
|
2017-11-07 08:21:38 +02:00
|
|
|
|
2018-02-24 00:17:51 +02:00
|
|
|
all: compile fmt build run
|
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 ./...
|
2017-11-07 08:21:38 +02:00
|
|
|
go build
|
|
|
|
|
2018-02-24 00:17:51 +02:00
|
|
|
run:
|
2018-07-01 00:35:32 +03:00
|
|
|
./php-parser -d go $(PHPFILE)
|
2017-11-07 08:21:38 +02:00
|
|
|
|
2018-02-06 19:11:47 +02:00
|
|
|
test:
|
2018-04-09 23:26:44 +03:00
|
|
|
go test ./...
|
|
|
|
|
|
|
|
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:
|
|
|
|
go test -benchmem -bench=. ./php5
|
|
|
|
go test -benchmem -bench=. ./php7
|
|
|
|
|
2018-07-01 00:38:31 +03:00
|
|
|
compile: ./php5/php5.go ./php7/php7.go ./scanner/scanner.go fmt
|
2018-06-06 19:47:28 +03:00
|
|
|
sed -i '' -e 's/yyErrorVerbose = false/yyErrorVerbose = true/g' ./php7/php7.go
|
|
|
|
sed -i '' -e 's/yyErrorVerbose = false/yyErrorVerbose = true/g' ./php5/php5.go
|
2018-02-06 12:39:42 +02:00
|
|
|
rm -f y.output
|
|
|
|
|
2018-01-24 18:42:23 +02:00
|
|
|
./scanner/scanner.go: ./scanner/scanner.l
|
2017-11-23 17:33:47 +02:00
|
|
|
golex -o $@ $<
|
|
|
|
|
2018-01-26 15:24:56 +02:00
|
|
|
./php5/php5.go: ./php5/php5.y
|
|
|
|
goyacc -o $@ $<
|
|
|
|
|
|
|
|
./php7/php7.go: ./php7/php7.y
|
2017-11-23 17:33:47 +02:00
|
|
|
goyacc -o $@ $<
|
2018-06-05 00:09:21 +03:00
|
|
|
|
|
|
|
cpu_pprof:
|
2018-07-01 00:35:32 +03:00
|
|
|
go test -cpuprofile cpu.pprof -bench=. -benchtime=20s ./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:
|
2018-07-01 00:35:32 +03:00
|
|
|
go test -memprofile mem.pprof -bench=. -benchtime=20s -benchmem ./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:
|
2018-07-01 00:35:32 +03:00
|
|
|
go test -cpuprofile cpu.prof -bench=. -benchtime=20s ./php5
|
2018-06-05 01:20:57 +03:00
|
|
|
go tool pprof ./php5.test cpu.prof
|
|
|
|
|
|
|
|
mem_pprof_php5:
|
2018-07-01 00:35:32 +03:00
|
|
|
go test -memprofile mem.prof -bench=. -benchtime=20s -benchmem ./php5
|
2018-06-05 01:20:57 +03:00
|
|
|
go tool pprof -alloc_objects ./php5.test mem.prof
|