forked from skyrings/skyring
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
106 lines (87 loc) · 2.84 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# store the current working directory
CWD := $(shell pwd)
PRINT_STATUS = export EC=$$?; cd $(CWD); if [ "$$EC" -eq "0" ]; then printf "SUCCESS!\n"; else exit $$EC; fi
VERSION := 0.0.1
RELEASE := 1
TARDIR := ../skyring-$(VERSION)
RPMBUILD := $(HOME)/rpmbuild
SKYRING_BUILD := $(HOME)/.skyring_build
SKYRING_BUILD_SRC := $(SKYRING_BUILD)/golang/gopath/src/github.com/skyrings/skyring
SKYRING_BUILD_TARDIR := $(SKYRING_BUILD)/golang/gopath/src/github.com/skyrings/skyring/$(TARDIR)
all: install
checkdeps:
@echo "Doing $@"
@bash $(PWD)/build-aux/checkdeps.sh
getversion:
@echo "Doing $@"
@bash $(PWD)/build-aux/pkg-version.sh $(PWD)/version.go
getdeps: checkdeps getversion
@echo "Doing $@"
@go get github.com/golang/lint/golint
@go get github.com/Masterminds/glide
verifiers: getdeps vet fmt lint
vet:
@echo "Doing $@"
@bash $(PWD)/build-aux/run-vet.sh
fmt:
@echo "Doing $@"
@bash $(PWD)/build-aux/gofmt.sh
lint:
@echo "Doing $@"
@golint .
test:
@echo "Doing $@"
@GO15VENDOREXPERIMENT=1 go test $$(GO15VENDOREXPERIMENT=1 glide nv)
pybuild:
@echo "Doing $@"
@cd backend/salt/python; python setup.py build
vendor-update:
@echo "Updating vendored packages"
@GO15VENDOREXPERIMENT=1 glide -q up 2> /dev/null
build: verifiers vendor-update pybuild test
@echo "Doing $@"
@GO15VENDOREXPERIMENT=1 go build
build-special:
rm -fr $(SKYRING_BUILD_SRC) $(SKYRING_BUILD)
mkdir $(SKYRING_BUILD_SRC) -p
cp -ai $(CWD)/* $(SKYRING_BUILD_SRC)/
cd $(SKYRING_BUILD_SRC); \
export GOROOT=/usr/lib/golang/; \
export GOPATH=$(SKYRING_BUILD)/golang/gopath; \
cp -r $(SKYRING_BUILD_SRC)/vendor/* $(SKYRING_BUILD)/golang/gopath/src/ ; \
export PATH=$(PATH):$(GOPATH)/bin:$(GOROOT)/bin; \
go build
cp $(SKYRING_BUILD_SRC)/skyring $(CWD)
pyinstall:
@echo "Doing $@"
@cd backend/salt/python; python setup.py --quiet install --user
@echo "INFO: You should set PYTHONPATH make it into effect"
@echo "INFO: or run skyring by \`PYTHONPATH=~/.local/lib/python2.7/site-packages skyring\`"
saltinstall:
@echo "Doing $@"
@if ! cp -f salt/* /srv/salt/ 2>/dev/null; then \
echo "ERROR: unable to install salt files. Install them manually by"; \
echo "sudo cp -f backend/salt/sls/* /srv/salt/"; \
fi
install: build pyinstall saltinstall
@echo "Doing $@"
@GO15VENDOREXPERIMENT=1 go install
dist:
@echo "Doing $@"
rm -fr $(TARDIR)
mkdir -p $(TARDIR)
rsync -r --exclude .git/ $(CWD)/ $(TARDIR)
tar -zcf $(TARDIR).tar.gz $(TARDIR);
rpm: dist
@echo "Doing $@"
rm -rf $(RPMBUILD)/SOURCES
mkdir -p $(RPMBUILD)/SOURCES
cp ../skyring-$(VERSION).tar.gz $(RPMBUILD)/SOURCES; \
rpmbuild -ba skyring.spec
$(PRINT_STATUS); \
if [ "$$EC" -eq "0" ]; then \
FILE=$$(readlink -f $$(find $(RPMBUILD)/RPMS -name skyring-$(VERSION)*.rpm)); \
cp -f $$FILE $(SKYRING_BUILD)/; \
printf "\nThe Skyring RPMs are located at:\n\n"; \
printf " $(SKYRING_BUILD)/\n\n\n\n"; \
fi