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>
This commit is contained in:
Justus Winter 2012-05-09 13:15:19 +02:00 committed by David Bremner
parent 9bf6eec1a5
commit 3113731713
3 changed files with 31 additions and 49 deletions

View file

@ -1,30 +1,40 @@
# Copyright 2009 The Go Authors. All rights reserved. # Makefile for the go bindings of notmuch
# 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 export GOPATH ?= $(shell pwd)
export CGO_CFLAGS ?= -I../../../../lib
export CGO_LDFLAGS ?= -L../../../../lib
all: install GO ?= go
GOFMT ?= gofmt
DIRS=\ all: notmuch notmuch-addrlookup
pkg\
cmds\
.PHONY: notmuch
notmuch:
$(GO) install notmuch
clean.dirs: $(addsuffix .clean, $(DIRS)) .PHONY: goconfig
install.dirs: $(addsuffix .install, $(DIRS)) goconfig:
nuke.dirs: $(addsuffix .nuke, $(DIRS)) if [ ! -d src/github.com/kless/goconfig/config ]; then \
test.dirs: $(addsuffix .test, $(TEST)) $(GO) get github.com/kless/goconfig/config; \
bench.dirs: $(addsuffix .bench, $(BENCH)) fi
%.clean: .PHONY: notmuch-addrlookup
+cd $* && $(QUOTED_GOBIN)/gomake clean notmuch-addrlookup: notmuch goconfig
$(GO) install notmuch-addrlookup
%.install: .PHONY: format
+cd $* && $(QUOTED_GOBIN)/gomake install 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 .PHONY: clean
clean:
#-include ${GOROOT}/src/Make.deps $(GO) clean notmuch
$(GO) clean notmuch-addrlookup
rm -rf pkg bin

View file

@ -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

View file

@ -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