php-parser/Makefile

54 lines
1.2 KiB
Makefile
Raw Normal View History

PHPFILE=example.php
2017-11-07 06:21:38 +00:00
2018-02-23 22:17:51 +00:00
all: compile fmt build run
2018-02-06 10:39:42 +00:00
2018-02-23 22:17:51 +00:00
fmt:
find . -type f -iregex '.*\.go' -exec gofmt -l -s -w '{}' +
2018-02-23 22:17:51 +00:00
build:
go generate ./...
2017-11-07 06:21:38 +00:00
go build
2018-02-23 22:17:51 +00:00
run:
2018-06-30 21:35:32 +00:00
./php-parser -d go $(PHPFILE)
2017-11-07 06:21:38 +00:00
2018-02-06 17:11:47 +00:00
test:
2018-04-09 20:26:44 +00:00
go test ./...
cover:
2018-01-12 23:59:24 +00:00
go test ./... --cover
2017-12-04 10:40:36 +00:00
2018-02-18 12:25:20 +00:00
bench:
go test -benchmem -bench=. ./php5
go test -benchmem -bench=. ./php7
2018-06-30 21:38:31 +00:00
compile: ./php5/php5.go ./php7/php7.go ./scanner/scanner.go fmt
2018-06-06 16:47:28 +00: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 10:39:42 +00:00
rm -f y.output
2019-03-10 21:37:01 +00:00
./scanner/scanner.go: ./scanner/scanner.rl
ragel -Z -G2 -o $@ $<
2017-11-23 15:33:47 +00:00
2018-01-26 13:24:56 +00:00
./php5/php5.go: ./php5/php5.y
goyacc -o $@ $<
./php7/php7.go: ./php7/php7.y
2017-11-23 15:33:47 +00:00
goyacc -o $@ $<
2018-06-04 21:09:21 +00:00
cpu_pprof:
2018-06-30 21:35:32 +00:00
go test -cpuprofile cpu.pprof -bench=. -benchtime=20s ./php7
2018-06-21 17:37:34 +00:00
go tool pprof ./php7.test cpu.pprof
2018-06-04 21:09:21 +00:00
mem_pprof:
2018-06-30 21:35:32 +00:00
go test -memprofile mem.pprof -bench=. -benchtime=20s -benchmem ./php7
2018-06-21 17:37:34 +00:00
go tool pprof -alloc_objects ./php7.test mem.pprof
2018-06-04 22:20:57 +00:00
cpu_pprof_php5:
2018-06-30 21:35:32 +00:00
go test -cpuprofile cpu.prof -bench=. -benchtime=20s ./php5
2018-06-04 22:20:57 +00:00
go tool pprof ./php5.test cpu.prof
mem_pprof_php5:
2018-06-30 21:35:32 +00:00
go test -memprofile mem.prof -bench=. -benchtime=20s -benchmem ./php5
2018-06-04 22:20:57 +00:00
go tool pprof -alloc_objects ./php5.test mem.prof