-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
88 lines (72 loc) · 2.06 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
# The command line passed variable VERSION is used to set the version string
# in the metadata and in the generated zip-file. If no VERSION is passed, the
# version string in the debian control metadata is used.
#
ifndef VERSION
VERSION = $(shell cat deb/debian/control | grep Standards-Version | cut -d' ' -f2)
endif
ifndef RPM_SPEC
RPM_SPEC = kubescape_full.spec
endif
ifndef PACK_GO
PACK_GO = YES
endif
ifndef GOVERSION
GOVERSION = 1.20.12
endif
export GOCACHE=$(PWD)/cache
clean:
-rm -fR rpmbuild
-rm -fR *.deb
-rm -fR *.rpm
-rm -fR *.src.tar.gz
-rm -fR *.tar.xz
-rm -fR *.dsc
-rm -fR *.changes
-rm -fR *.buildinfo
-rm -fR deb/completion
-rm -fR deb/kubescape
-rm -fR deb/go-go*
-rm -fR deb/golang
-rm -fR deb/debian/kubescape*
-rm -fR deb/debian/debhelper-build-stamp
-rm -fR deb/debian/files
-rm -fR deb/debian/.debhelper
-rm -fR *.snap
-rm -fR *.upload
prepare:
rm -rf $(path)/kubescape
curl --output kubescape.src.tar.gz -L https://github.com/kubescape/kubescape/archive/v$(VERSION)/kubescape-$(VERSION).tar.gz
cd $(path); tar -xf ../kubescape.src.tar.gz
mv $(path)/kubescape-$(VERSION) $(path)/kubescape
prepare-go-$(GOVERSION):
if [ "$(PACK_GO)" = "YES" ]; then \
rm -rf $(path)/golang $(path)/go-go*; \
curl --output go.src.tar.gz -L https://github.com/golang/go/archive/refs/tags/go$(GOVERSION).tar.gz; \
cd $(path); tar -xf ../go.src.tar.gz; mv go-go$(GOVERSION) golang; \
fi
vendor: clean prepare prepare-go-$(GOVERSION)
cd $(path)/kubescape; go mod vendor; go generate -mod vendor ./...
deb-ready:
cd $(path); dpkg-buildpackage -F -d;
deb: path:=deb
deb: vendor deb-ready
pack: path:=deb
pack: vendor
tar -cJf kubescape_$(VERSION).tar.xz $(path)
dsc: path:=deb
dsc: vendor
cd $(path); \
dpkg-buildpackage -S -d;
ppa: dsc
dput kubescape *source.changes
snap:
snapcraft --use-lxd
rpmdir:
mkdir -p rpmbuild/BUILD
mkdir -p rpmbuild/RPMS
mkdir -p rpmbuild/SOURCES
mkdir -p rpmbuild/SPECS
mkdir -p rpmbuild/SRPMS
rpm: rpmdir
rpmbuild --undefine=_disable_source_fetch -ba $(RPM_SPEC) -D "_topdir $(PWD)/rpmbuild" -D 'debug_package %{nil}'