php-parser/Makefile

51 lines
1.0 KiB
Makefile
Raw Normal View History

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:
find . -type f -iregex '.*\.go' -exec gofmt -l -s -w '{}' +
2018-02-24 00:17:51 +02:00
build:
2017-11-07 08:21:38 +02:00
go build
2018-02-24 00:17:51 +02:00
run:
./php-parser $(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-02-06 12:39:42 +02:00
compile: ./php5/php5.go ./php7/php7.go ./scanner/scanner.go
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-06-05 01:20:57 +03:00
GOGC=off go test -cpuprofile cpu.prof -bench=. -benchtime=20s ./php7
go tool pprof ./php7.test cpu.prof
2018-06-05 00:09:21 +03:00
mem_pprof:
2018-06-05 01:20:57 +03:00
GOGC=off go test -memprofile mem.prof -bench=. -benchtime=20s -benchmem ./php7
go tool pprof -alloc_objects ./php7.test mem.prof
cpu_pprof_php5:
GOGC=off go test -cpuprofile cpu.prof -bench=. -benchtime=20s ./php5
go tool pprof ./php5.test cpu.prof
mem_pprof_php5:
GOGC=off go test -memprofile mem.prof -bench=. -benchtime=20s -benchmem ./php5
go tool pprof -alloc_objects ./php5.test mem.prof