-
Notifications
You must be signed in to change notification settings - Fork 108
/
Makefile
52 lines (40 loc) · 1.17 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
# Usage:
# Default config:
# make
# Use a specific php-config:
# PHPCFG=/usr/bin/php-config72 make
# Disable zend log (<error):
# CGO_CFLAGS="-DLOGLEVEL=error" make
ifeq ($(PHPCFG),)
PHPCFG=/usr/bin/php-config
endif
ifeq ($(APP),)
APP=examples
endif
PHPEXE := $(shell $(PHPCFG) --php-binary)
PHPDIR := $(shell $(PHPCFG) --prefix)
export PATH := $(PHPDIR)/bin:$(PATH)
export CFLAGS := $(shell $(PHPCFG) --includes)
export LDFLAGS := -L$(shell $(PHPCFG) --prefix)/lib/
export CGO_CFLAGS := $(CFLAGS) $(CGO_CFLAGS)
export CGO_LDFLAGS := $(LDFLAGS) $(CGO_LDFLAGS)
GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
all:
go install ./zend
go install ./phpgo
go build -buildmode=c-shared -o $(APP).so $(APP)/main.go
# $(PHPEXE) -d extension=./$(APP).so $(APP)/main.php
zdlib:
go install -v -x ./zend
pglib:
go install -v -x ./phpgo
test:
$(PHPEXE) -d extension=./hello.so examples/hello.php
# quickly build check syntax errors
quickbc:
go build -v -x -buildmode=c-archive -o php-grpc.c.a examples/hello.go
clean:
rm -f $(GOPATH)/pkg/$(GOOS)_$(GOARCH)/github.com/kitech/php-go/zend.a
rm -f $(GOPATH)/pkg/$(GOOS)_$(GOARCH)/github.com/kitech/php-go/phpgo.a
rm -f hello.so