summaryrefslogtreecommitdiffhomepage
path: root/auto/modules
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--auto/modules/go40
1 files changed, 18 insertions, 22 deletions
diff --git a/auto/modules/go b/auto/modules/go
index c31dbe94..68eb7d4a 100644
--- a/auto/modules/go
+++ b/auto/modules/go
@@ -85,41 +85,37 @@ fi
cat << END >> $NXT_MAKEFILE
-.PHONY: ${NXT_GO} ${NXT_GO}-install ${NXT_GO}-uninstall
-
-all: ${NXT_GO}
-
-NXT_ROOT = `pwd`
+.PHONY: ${NXT_GO}
+.PHONY: ${NXT_GO}-install
+.PHONY: ${NXT_GO}-install-src
+.PHONY: ${NXT_GO}-install-build
+.PHONY: ${NXT_GO}-uninstall
GOPATH = $NXT_GO_PATH
GOOS = `${NXT_GO} env GOOS`
GOARCH = `${NXT_GO} env GOARCH`
-${NXT_GO}: $NXT_BUILD_DIR/nxt_go_gen.h
+NXT_GO_DST = ${NXT_GO_PATH%%:*}
-$NXT_BUILD_DIR/nxt_go_gen.h: src/go/unit/*.go
- GOPATH=`pwd` \\
- CGO_CPPFLAGS="-DNXT_CONFIGURE \\
- -I`pwd`/src" \\
- ${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
+${NXT_GO}-install: ${NXT_GO}-install-build
+
+${NXT_GO}-install-src:
+ install -d \$(DESTDIR)\$(NXT_GO_DST)/src/nginx/unit
+ install -p -m644 ./src/*.h ./build/*.h ./src/go/unit/* \
+ \$(DESTDIR)\$(NXT_GO_DST)/src/nginx/unit/
-${NXT_GO}-install: ${NXT_GO}
- install -d \$(DESTDIR)\$(GOPATH)/src/unit
- install -p -m644 ./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=\$(DESTDIR)\$(GOPATH) \\
- ${NXT_GO} install -v unit
+${NXT_GO}-install-build: ${NXT_GO}-install-src
+ GOPATH=\$(DESTDIR)\$(GOPATH) ${NXT_GO} build nginx/unit
uninstall: ${NXT_GO}-uninstall
${NXT_GO}-uninstall:
- rm -rf \$(DESTDIR)\$(GOPATH)/src/unit
- rm -f \$(DESTDIR)\$(GOPATH)/pkg/\$(GOOS)_\$(GOARCH)/unit.a
+ rm -rf \$(DESTDIR)\$(NXT_GO_DST)/src/nginx/unit
+ rm -rf \$(DESTDIR)\$(NXT_GO_DST)/pkg/\$(GOOS)_\$(GOARCH)/nginx/unit
END