-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
74 lines (58 loc) · 1.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
include /usr/share/dpkg/default.mk
include defines.mk
PACKAGE=proxmox-firewall
BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
CARGO ?= cargo
DEB=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_HOST_ARCH).deb
DBG_DEB=$(PACKAGE)-dbgsym_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_HOST_ARCH).deb
DSC=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc
DEBS = $(DEB) $(DBG_DEB)
ifeq ($(BUILD_MODE), release)
CARGO_BUILD_ARGS += --release
COMPILEDIR := target/release
else
COMPILEDIR := target/debug
endif
all: cargo-build
.PHONY: cargo-build
cargo-build:
$(CARGO) build $(CARGO_BUILD_ARGS)
.PHONY: build
build: $(BUILDDIR)
$(BUILDDIR):
rm -rf $@ [email protected]; mkdir [email protected]
cp -a proxmox-firewall proxmox-nftables proxmox-ve-config debian Cargo.toml Makefile defines.mk [email protected]/
mv [email protected] $@
.PHONY: deb
deb: $(DEB)
$(DBG_DEB): $(DEB)
$(DEB): $(BUILDDIR)
cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
lintian $(DEB)
.PHONY: test
test:
$(CARGO) test
.PHONY: dsc
dsc:
rm -rf $(BUILDDIR) $(DSC)
$(MAKE) $(DSC)
lintian $(DSC)
$(DSC): $(BUILDDIR)
cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
sbuild: $(DSC)
sbuild $<
.PHONY: dinstall
dinstall: $(DEB)
dpkg -i $(DEB)
.PHONY: distclean
distclean: clean
.PHONY: clean
clean:
$(CARGO) clean
rm -f *.deb *.build *.buildinfo *.changes *.dsc $(PACKAGE)*.tar*
rm -rf $(PACKAGE)-[0-9]*/
find . -name '*~' -exec rm {} ';'
.PHONY: upload
upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
upload: $(DEB) $(DBG_DEB)
tar cf - $(DEB) $(DBG_DEB) | ssh -X [email protected] -- upload --product pve --dist $(UPLOAD_DIST)