-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (42 loc) · 1.02 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
VER=0.3.0
SHELL=/bin/sh
HGREV=$(shell hg id)
SRC_DIR=src/tmsu
BIN_DIR=bin
DIST_DIR=tmsu-$(VER)
INSTALL_DIR=/usr/bin
ZSH_COMP=misc/zsh/_tmsu
ZSH_COMP_INSTALL_DIR=/usr/share/zsh/site-functions
BIN_FILE=tmsu
VER_FILE=version.gen.go
ARCH=$(shell uname -m)
DIST_FILE=tmsu-$(ARCH)-$(VER).tgz
export GOPATH=$(PWD)
all: clean generate compile dist test
clean:
go clean tmsu
rm -f $(SRC_DIR)/common/$(VER_FILE)
rm -Rf $(BIN_DIR)
rm -Rf $(DIST_DIR)
rm -f $(DIST_FILE)
generate:
echo "package common; var Version = \"$(VER) ($(HGREV))\"" >$(SRC_DIR)/common/$(VER_FILE)
compile: generate
go build -o $(BIN_FILE) tmsu
@mkdir -p $(BIN_DIR)
mv $(BIN_FILE) $(BIN_DIR)
test: compile
go test tmsu/...
dist: compile
@mkdir -p $(DIST_DIR)
cp -R $(BIN_DIR) $(DIST_DIR)
cp README.md $(DIST_DIR)
cp COPYING $(DIST_DIR)
tar czf $(DIST_FILE) $(DIST_DIR)
rm -Rf $(DIST_DIR)
install:
cp $(BIN_DIR)/$(BIN_FILE) $(INSTALL_DIR)
@mkdir -p $(ZSH_COMP_INSTALL_DIR)
cp $(ZSH_COMP) $(ZSH_COMP_INSTALL_DIR)
uninstall:
rm $(INSTALL_DIR)/$(BIN_NAME)