forked from AiflooAB/hawkbitctl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (59 loc) · 1.91 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
.POSIX:
.SUFFIXES:
NAME=hawkbitctl
VERSION=$(shell git describe --always --match v[0-9]* HEAD)
VERSION_NUMBER=$(shell echo $(VERSION) | cut -c2- )
OUT_DIR=build
PACKAGE_DIR=$(OUT_DIR)/$(NAME)-$(VERSION)
$(OUT_DIR):
@mkdir -p "$@"
$(PACKAGE_DIR): \
$(PACKAGE_DIR)/DEBIAN \
$(PACKAGE_DIR)/usr/lib/$(NAME)/config.sh \
$(PACKAGE_DIR)/usr/lib/$(NAME)/delete \
$(PACKAGE_DIR)/usr/lib/$(NAME)/get \
$(PACKAGE_DIR)/usr/lib/$(NAME)/post \
$(PACKAGE_DIR)/usr/lib/$(NAME)/upload \
$(PACKAGE_DIR)/usr/lib/$(NAME)/rollouts.sh \
$(PACKAGE_DIR)/usr/lib/$(NAME)/tags.sh \
$(PACKAGE_DIR)/usr/lib/$(NAME)/targets.sh \
$(PACKAGE_DIR)/usr/lib/$(NAME)/softwaremodules.sh \
$(PACKAGE_DIR)/usr/lib/$(NAME)/distributionsets.sh \
$(PACKAGE_DIR)/usr/lib/$(NAME)/hawkbitctl \
$(PACKAGE_DIR)/etc/bash_completion.d/$(NAME) \
$(PACKAGE_DIR)/usr/bin/$(NAME) \
@touch "$@"
$(PACKAGE_DIR)/DEBIAN: \
$(PACKAGE_DIR)/DEBIAN/conffile \
$(PACKAGE_DIR)/DEBIAN/control \
$(PACKAGE_DIR)/DEBIAN/postinst \
$(PACKAGE_DIR)/DEBIAN/postrm \
$(PACKAGE_DIR)/DEBIAN/prerm \
@touch "$@"
$(PACKAGE_DIR)/DEBIAN/control: debian/control
(cat debian/control && echo -n 'Version: ' && echo "${VERSION_NUMBER}") > "$@"
$(PACKAGE_DIR)/DEBIAN/%: debian/%
@mkdir -p "$(dir $@)"
cp -p "debian/$*" "$@"
$(PACKAGE_DIR)/usr/bin/$(NAME): $(NAME)
@mkdir -p "$(dir $@)"
ln -fs /usr/lib/$(NAME)/$(NAME) "$@"
$(PACKAGE_DIR)/usr/lib/$(NAME)/%: src/%
@mkdir -p "$(dir $@)"
cp -p "$<" "$@"
$(PACKAGE_DIR)/etc/bash_completion.d/$(NAME): completion.sh
@mkdir -p "$(dir $@)"
cp -p "$<" "$@"
.PHONY: deb
deb: $(PACKAGE_DIR).deb
$(PACKAGE_DIR).deb: $(PACKAGE_DIR)
chmod 755 $(PACKAGE_DIR)/DEBIAN/postinst
chmod 755 $(PACKAGE_DIR)/DEBIAN/postrm
chmod 755 $(PACKAGE_DIR)/DEBIAN/prerm
fakeroot dpkg-deb --build "${PACKAGE_DIR}"
.PHONY: release
release: clean $(PACKAGE_DIR).deb
hub release create --attach="$(PACKAGE_DIR).deb" "$(VERSION)"
.PHONY: clean
clean:
rm -rf "$(OUT_DIR)"