launchpad.net/~rogpeppe/juju-core/500-errgo-fix@v0.0.0-20140213181702-000000002356/Makefile (about) 1 # 2 # Makefile for juju-core. 3 # 4 5 ifndef GOPATH 6 $(warning You need to set up a GOPATH. See the README file.) 7 endif 8 9 PROJECT := launchpad.net/juju-core 10 PROJECT_DIR := $(shell go list -e -f '{{.Dir}}' $(PROJECT)) 11 12 define DEPENDENCIES 13 build-essential 14 bzr 15 distro-info-data 16 git-core 17 golang 18 mercurial 19 mongodb-server 20 zip 21 endef 22 23 default: build 24 25 # Start of GOPATH-dependent targets. Some targets only make sense - 26 # and will only work - when this tree is found on the GOPATH. 27 ifeq ($(CURDIR),$(PROJECT_DIR)) 28 29 build: 30 go build $(PROJECT)/... 31 32 check: 33 go test $(PROJECT)/... 34 35 install: 36 go install -v $(PROJECT)/... 37 38 clean: 39 go clean $(PROJECT)/... 40 41 else # -------------------------------- 42 43 build: 44 $(error Cannot $@; $(CURDIR) is not on GOPATH) 45 46 check: 47 $(error Cannot $@; $(CURDIR) is not on GOPATH) 48 49 install: 50 $(error Cannot $@; $(CURDIR) is not on GOPATH) 51 52 clean: 53 $(error Cannot $@; $(CURDIR) is not on GOPATH) 54 55 endif 56 # End of GOPATH-dependent targets. 57 58 # Reformat source files. 59 format: 60 gofmt -w -l . 61 62 # Reformat and simplify source files. 63 simplify: 64 gofmt -w -l -s . 65 66 # Install packages required to develop Juju and run tests. The stable 67 # PPA includes the required mongodb-server binaries. However, neither 68 # PPA works on Saucy just yet. 69 install-dependencies: 70 ifeq ($(shell lsb_release -cs|sed -r 's/precise|quantal|raring/old/'),old) 71 @echo Adding juju PPAs for golang and mongodb-server 72 @sudo apt-add-repository --yes ppa:juju/golang 73 @sudo apt-add-repository --yes ppa:juju/stable 74 @sudo apt-get update 75 endif 76 @echo Installing dependencies 77 @sudo apt-get --yes install $(strip $(DEPENDENCIES)) 78 79 80 .PHONY: build check install 81 .PHONY: clean format simplify 82 .PHONY: install-dependencies