-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
101 lines (83 loc) · 2.53 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
GIT = git
INSTALLFILES=.installfiles
PYTHON ?= python3
LINSTORAPI = ../linstor-api-py
override GITHEAD := $(shell test -e .git && $(GIT) rev-parse HEAD)
U := $(shell $(PYTHON) ./setup.py versionup2date >/dev/null 2>&1; echo $$?;)
TESTS = $(wildcard unit-tests/*_test.py)
DOCKERREGISTRY := drbd.io
ARCH ?= amd64
ifneq ($(strip $(ARCH)),)
DOCKERREGISTRY := $(DOCKERREGISTRY)/$(ARCH)
endif
DOCKERREGPATH = $(DOCKERREGISTRY)/linstor-client
DOCKER_TAG ?= latest
NO_DOC ?=
all: doc
$(PYTHON) setup.py build
doc:
PYTHONPATH=$(LINSTORAPI):. $(PYTHON) setup.py build_man
install:
$(PYTHON) setup.py install --record $(INSTALLFILES)
uninstall:
test -f $(INSTALLFILES) && cat $(INSTALLFILES) | xargs rm -rf || true
rm -f $(INSTALLFILES)
ifneq ($(U),0)
up2date:
$(error "Update your Version strings/Changelogs")
else
up2date: linstor_client/consts_githash.py
$(info "Version strings/Changelogs up to date")
endif
release: doc
make release-no-doc
release-no-doc: up2date clean
$(PYTHON) setup.py sdist
@echo && echo "Did you run distclean?"
debrelease:
echo 'recursive-include debian *' >> MANIFEST.in
dh_clean || true
make release$(NO_DOC)
git checkout MANIFEST.in
ifneq ($(FORCE),1)
dockerimage: debrelease
cd $(LINSTORAPI) && make debrelease
cp $(LINSTORAPI)/dist/*.tar.gz dist/
else
dockerimage:
endif
docker build -t $(DOCKERREGPATH):$(DOCKER_TAG) $(EXTRA_DOCKER_BUILDARGS) .
docker tag $(DOCKERREGPATH):$(DOCKER_TAG) $(DOCKERREGPATH):latest
@echo && echo "Did you run distclean?"
.PHONY: dockerpath
dockerpath:
@echo $(DOCKERREGPATH):latest $(DOCKERREGPATH):$(DOCKER_TAG)
# no gensrc here, that is in debian/rules
deb: up2date
[ -d ./debian ] || (echo "Your checkout/tarball does not contain a debian directory" && false)
debuild -i -us -uc -b
# it is up to you (or the buildenv) to provide a distri specific setup.cfg
rpm: up2date
$(PYTHON) setup.py bdist_rpm --python /usr/bin/$(PYTHON)
.PHONY: linstor_client/consts_githash.py
ifdef GITHEAD
override GITDIFF := $(shell $(GIT) diff --name-only HEAD 2>/dev/null | \
grep -vxF "MANIFEST.in" | \
tr -s '\t\n' ' ' | \
sed -e 's/^/ /;s/ *$$//')
linstor_client/consts_githash.py:
@echo "GITHASH = 'GIT-hash: $(GITHEAD)$(GITDIFF)'" > $@
else
linstor_client/consts_githash.py:
@echo >&2 "Need a git checkout to regenerate $@"; test -s $@
endif
md5sums:
CURDATE=$$(date +%s); for i in $$(${GIT} ls-files | sort); do md5sum $$i >> md5sums.$${CURDATE}; done
clean:
$(PYTHON) setup.py clean
rm -f man-pages/*.gz
distclean: clean
git clean -d -f || true
check:
# currently none
# $(PYTHON) $(TESTS)