blob: ebacf0df8b611efbe6d8ae80de2fadae07c1de73 (
plain) (
blame)
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
|
# Copyright (C) Max Romanov
# Copyright (C) NGINX, Inc.
$echo >> $NXT_MAKEFILE
$echo >> $NXT_MAKEFILE
# The go module object files.
for nxt_src in $NXT_GO_MODULE_SRCS
do
nxt_obj=`$echo $nxt_src | sed -e "s/\.c$/\.o/"`
cat << END >> $NXT_MAKEFILE
$NXT_BUILD_DIR/$nxt_obj: $nxt_src
\$(CC) -c \$(CFLAGS) \$(NXT_INCS) \\
$NXT_LIB_AUX_CFLAGS \\
-o $NXT_BUILD_DIR/$nxt_obj \\
$nxt_src
END
done
cat << END >> $NXT_MAKEFILE
.PHONY: golang-nginext-install
NXT_ROOT = \$(shell pwd)
GOPATH = \$(shell go env GOPATH)
GOOS = \$(shell go env GOOS)
GOARCH = \$(shell go env GOARCH)
golang-nginext-install:
install -d \$(GOPATH)/src/nginext
install -p ./src/nginext/*.c ./src/nginext/*.h ./src/nginext/*.go \$(GOPATH)/src/nginext/
CGO_CFLAGS="-I\$(NXT_ROOT)/build -I\$(NXT_ROOT)/src" CGO_LDFLAGS="-L\$(NXT_ROOT)/build" go install -v nginext
golang-nginext-uninstall:
rm -rf \$(GOPATH)/src/nginext
rm -f \$(GOPATH)/pkg/\$(GOOS)_\$(GOARCH)/nginext.a
END
|