github.com/rogpeppe/juju@v0.0.0-20140613142852-6337964b789e/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 := github.com/juju/juju 10 PROJECT_DIR := $(shell go list -e -f '{{.Dir}}' $(PROJECT)) 11 12 ifeq ($(shell uname -p | sed -r 's/.*(x86|armel|armhf).*/golang/'), golang) 13 GO_C := golang 14 INSTALL_FLAGS := 15 else 16 GO_C := gccgo-4.9 gccgo-go 17 INSTALL_FLAGS := -gccgoflags=-static-libgo 18 endif 19 20 define DEPENDENCIES 21 build-essential 22 bzr 23 distro-info-data 24 git-core 25 mercurial 26 juju-local 27 zip 28 $(GO_C) 29 endef 30 31 default: build 32 33 # Start of GOPATH-dependent targets. Some targets only make sense - 34 # and will only work - when this tree is found on the GOPATH. 35 ifeq ($(CURDIR),$(PROJECT_DIR)) 36 37 build: 38 go build $(PROJECT)/... 39 40 check: 41 go test $(PROJECT)/... 42 43 install: 44 go install $(INSTALL_FLAGS) -v $(PROJECT)/... 45 46 clean: 47 go clean $(PROJECT)/... 48 49 else # -------------------------------- 50 51 build: 52 $(error Cannot $@; $(CURDIR) is not on GOPATH) 53 54 check: 55 $(error Cannot $@; $(CURDIR) is not on GOPATH) 56 57 install: 58 $(error Cannot $@; $(CURDIR) is not on GOPATH) 59 60 clean: 61 $(error Cannot $@; $(CURDIR) is not on GOPATH) 62 63 endif 64 # End of GOPATH-dependent targets. 65 66 # Reformat source files. 67 format: 68 gofmt -w -l . 69 70 # Reformat and simplify source files. 71 simplify: 72 gofmt -w -l -s . 73 74 # Install packages required to develop Juju and run tests. The stable 75 # PPA includes the required mongodb-server binaries. However, neither 76 # PPA works on Saucy just yet. 77 install-dependencies: 78 ifeq ($(shell lsb_release -cs|sed -r 's/precise|quantal|raring/old/'),old) 79 @echo Adding juju PPAs for golang and mongodb-server 80 @sudo apt-add-repository --yes ppa:juju/golang 81 @sudo apt-add-repository --yes ppa:juju/stable 82 @sudo apt-get update 83 endif 84 @echo Installing dependencies 85 @sudo apt-get --yes install $(strip $(DEPENDENCIES)) \ 86 $(shell apt-cache madison juju-mongodb mongodb-server | head -1 | cut -d '|' -f1) 87 88 # Install bash_completion 89 install-etc: 90 @echo Installing bash completion 91 @sudo install -o root -g root -m 644 etc/bash_completion.d/juju-core /etc/bash_completion.d 92 93 .PHONY: build check install 94 .PHONY: clean format simplify 95 .PHONY: install-dependencies