-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
30 lines (22 loc) · 864 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
BUILDPATH=$(CURDIR)
MANPATH="/usr/local/share/man/man1"
GO=$(shell which go)
# Compile time values
PROGRAM=beanstalkd-cli
VERSION=$(shell printf "%s [%s]" `git describe --abbrev=0 --tags` `git rev-parse --verify HEAD`)
# Interpolate the variable values using go link flags
LDFLAGS=-ldflags "-X 'main.Name=${PROGRAM}' -X 'main.Version=${VERSION}'"
build:
@if [ ! -d $(BUILDPATH)/bin ] ; then mkdir -p $(BUILDPATH)/bin ; fi
$(GO) build ${LDFLAGS} -o $(BUILDPATH)/bin/$(PROGRAM)
install:
@if [ ! -d $(MANPATH) ] ; then mkdir -p $(MANPATH) ; fi
cp $(BUILDPATH)/bin/$(PROGRAM) /usr/bin/$(PROGRAM)
gzip -c $(PROGRAM).man | tee $(MANPATH)/$(PROGRAM).1.gz > /dev/null
ci-test:
ifeq ($(GIMME_OS),linux)
shelltest --with ./bin/beanstalkd-cli_$(GIMME_OS)_$(GIMME_ARCH)$(EXT) --diff --color --all tests
endif
clean:
rm -f $(BUILDPATH)/bin/$(PROGRAM)
all: build