aboutsummaryrefslogtreecommitdiffhomepage
path: root/bindings/go
diff options
context:
space:
mode:
authorGravatar Justus Winter <4winter@informatik.uni-hamburg.de>2012-05-09 13:15:19 +0200
committerGravatar David Bremner <bremner@debian.org>2012-05-11 08:36:30 -0300
commit3113731713ac49142c86c934906d0f5a1e6f3eb8 (patch)
tree4684f6df5e70812d57904c5c53b193f182fa73e5 /bindings/go
parent9bf6eec1a51c49f025454fdfc709b4d29142f84c (diff)
go: update the build system
The new "go" utility does not require any Makefiles to compile go packages and programs. Remove the old Makefiles and replace the top level Makefile with one defining some convenience targets for compiling the notmuch bindings and the notmuch-addrlookup utility. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Diffstat (limited to 'bindings/go')
-rw-r--r--bindings/go/Makefile70
-rw-r--r--bindings/go/cmds/Makefile11
-rw-r--r--bindings/go/pkg/Makefile17
3 files changed, 40 insertions, 58 deletions
diff --git a/bindings/go/Makefile b/bindings/go/Makefile
index aba2d595..c38f2340 100644
--- a/bindings/go/Makefile
+++ b/bindings/go/Makefile
@@ -1,30 +1,40 @@
-# Copyright 2009 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-include ${GOROOT}/src/Make.inc
-
-all: install
-
-DIRS=\
- pkg\
- cmds\
-
-
-clean.dirs: $(addsuffix .clean, $(DIRS))
-install.dirs: $(addsuffix .install, $(DIRS))
-nuke.dirs: $(addsuffix .nuke, $(DIRS))
-test.dirs: $(addsuffix .test, $(TEST))
-bench.dirs: $(addsuffix .bench, $(BENCH))
-
-%.clean:
- +cd $* && $(QUOTED_GOBIN)/gomake clean
-
-%.install:
- +cd $* && $(QUOTED_GOBIN)/gomake install
-
-clean: clean.dirs
-
-install: install.dirs
-
-#-include ${GOROOT}/src/Make.deps
+# Makefile for the go bindings of notmuch
+
+export GOPATH ?= $(shell pwd)
+export CGO_CFLAGS ?= -I../../../../lib
+export CGO_LDFLAGS ?= -L../../../../lib
+
+GO ?= go
+GOFMT ?= gofmt
+
+all: notmuch notmuch-addrlookup
+
+.PHONY: notmuch
+notmuch:
+ $(GO) install notmuch
+
+.PHONY: goconfig
+goconfig:
+ if [ ! -d src/github.com/kless/goconfig/config ]; then \
+ $(GO) get github.com/kless/goconfig/config; \
+ fi
+
+.PHONY: notmuch-addrlookup
+notmuch-addrlookup: notmuch goconfig
+ $(GO) install notmuch-addrlookup
+
+.PHONY: format
+format:
+ $(GOFMT) -w=true $(GOFMT_OPTS) src/notmuch
+ $(GOFMT) -w=true $(GOFMT_OPTS) src/notmuch-addrlookup
+
+.PHONY: check-format
+check-format:
+ $(GOFMT) -d=true $(GOFMT_OPTS) src/notmuch
+ $(GOFMT) -d=true $(GOFMT_OPTS) src/notmuch-addrlookup
+
+.PHONY: clean
+clean:
+ $(GO) clean notmuch
+ $(GO) clean notmuch-addrlookup
+ rm -rf pkg bin
diff --git a/bindings/go/cmds/Makefile b/bindings/go/cmds/Makefile
deleted file mode 100644
index afbc6d22..00000000
--- a/bindings/go/cmds/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright 2009 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-include ${GOROOT}/src/Make.inc
-
-TARG=notmuch-addrlookup
-GOFILES=\
- notmuch-addrlookup.go
-
-include ${GOROOT}/src/Make.cmd
diff --git a/bindings/go/pkg/Makefile b/bindings/go/pkg/Makefile
deleted file mode 100644
index de89dbc9..00000000
--- a/bindings/go/pkg/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright 2009 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-include $(GOROOT)/src/Make.inc
-
-TARG=notmuch
-CGOFILES=notmuch.go
-CGO_LDFLAGS=-lnotmuch
-
-CLEANFILES+=notmuch_test
-
-include $(GOROOT)/src/Make.pkg
-
-%: install %.go
- $(GC) $*.go
- $(LD) -o $@ $*.$O