summaryrefslogtreecommitdiffhomepage
path: root/auto/modules/go
diff options
context:
space:
mode:
Diffstat (limited to 'auto/modules/go')
-rw-r--r--auto/modules/go18
1 files changed, 12 insertions, 6 deletions
diff --git a/auto/modules/go b/auto/modules/go
index 2076a0bd..847938ea 100644
--- a/auto/modules/go
+++ b/auto/modules/go
@@ -85,7 +85,7 @@ fi
cat << END >> $NXT_MAKEFILE
-.PHONY: ${NXT_GO}
+.PHONY: ${NXT_GO} ${NXT_GO}-install ${NXT_GO}-uninstall
all: ${NXT_GO}
@@ -104,16 +104,22 @@ $NXT_BUILD_DIR/nxt_go_gen.h: src/go/unit/*.go
${NXT_GO} build -o $NXT_BUILD_DIR/nxt_go_gen.a \\
--buildmode=c-archive go/unit
+
+install: ${NXT_GO}-install
+
${NXT_GO}-install: ${NXT_GO}
- install -d \$(GOPATH)/src/unit
- install -p ./src/go/unit/* \$(GOPATH)/src/unit/
+ install -d \$(DESTDIR)\$(GOPATH)/src/unit
+ install -p ./src/go/unit/* \$(DESTDIR)\$(GOPATH)/src/unit/
CGO_CFLAGS="-I\$(NXT_ROOT)/$NXT_BUILD_DIR -I\$(NXT_ROOT)/src" \\
CGO_LDFLAGS="-L\$(NXT_ROOT)/$NXT_BUILD_DIR ${NXT_LIBRT}" \\
- GOPATH=$NXT_GO_PATH \\
+ GOPATH=\$(DESTDIR)\$(GOPATH) \\
${NXT_GO} install -v unit
+
+uninstall: ${NXT_GO}-uninstall
+
${NXT_GO}-uninstall:
- rm -rf \$(GOPATH)/src/unit
- rm -f \$(GOPATH)/pkg/\$(GOOS)_\$(GOARCH)/unit.a
+ rm -rf \$(DESTDIR)\$(GOPATH)/src/unit
+ rm -f \$(DESTDIR)\$(GOPATH)/pkg/\$(GOOS)_\$(GOARCH)/unit.a
END