[PATCH 4/5] go: update the build system

Justus Winter 4winter at informatik.uni-hamburg.de
Mon Apr 30 12:55:43 PDT 2012


Signed-off-by: Justus Winter <4winter at informatik.uni-hamburg.de>
---
 bindings/go/Makefile      |   51 ++++++++++++++++++++++++++-------------------
 bindings/go/cmds/Makefile |   11 ----------
 bindings/go/pkg/Makefile  |   17 ---------------
 3 files changed, 30 insertions(+), 49 deletions(-)
 delete mode 100644 bindings/go/cmds/Makefile
 delete mode 100644 bindings/go/pkg/Makefile

diff --git a/bindings/go/Makefile b/bindings/go/Makefile
index aba2d59..c9a8dba 100644
--- a/bindings/go/Makefile
+++ b/bindings/go/Makefile
@@ -1,30 +1,39 @@
-# 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.
+# Makefile for the go bindings of notmuch
 
-include ${GOROOT}/src/Make.inc
+GOPATH     ?= $(shell pwd)
+export GOPATH
 
-all: install
+GO         ?= go
+GOFMT      ?= gofmt
 
-DIRS=\
-        pkg\
-        cmds\
+all: notmuch notmuch-addrlookup
 
+.PHONY: notmuch
+notmuch:
+	$(GO) install notmuch
 
-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))
+.PHONY: goconfig
+goconfig:
+	if [ ! -d src/github.com/kless/goconfig/config ]; then \
+	    $(GO) get github.com/kless/goconfig/config; \
+	fi
 
-%.clean:
-	+cd $* && $(QUOTED_GOBIN)/gomake clean
+.PHONY: notmuch-addrlookup
+notmuch-addrlookup: notmuch goconfig
+	$(GO) install notmuch-addrlookup
 
-%.install:
-	+cd $* && $(QUOTED_GOBIN)/gomake install
+.PHONY: format
+format:
+	$(GOFMT) -w=true $(GOFMT_OPTS) src/notmuch
+	$(GOFMT) -w=true $(GOFMT_OPTS) src/notmuch-addrlookup
 
-clean: clean.dirs
+.PHONY: check-format
+check-format:
+	$(GOFMT) -d=true $(GOFMT_OPTS) src/notmuch
+	$(GOFMT) -d=true $(GOFMT_OPTS) src/notmuch-addrlookup
 
-install: install.dirs
-
-#-include ${GOROOT}/src/Make.deps
+.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 afbc6d2..0000000
--- 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 de89dbc..0000000
--- 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
-- 
1.7.10



More information about the notmuch mailing list