]> git.proxmox.com Git - pve-installer.git/blob - Makefile
makefile: convert to use simple parenthesis
[pve-installer.git] / Makefile
1 include /usr/share/dpkg/default.mk
2
3 PACKAGE = proxmox-installer
4 DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
5
6 CARGO ?= cargo
7 ifeq ($(BUILD_MODE), release)
8 CARGO_BUILD_ARGS += --release
9 CARGO_COMPILEDIR := target/release
10 else
11 CARGO_COMPILEDIR := target/debug
12 endif
13
14 INSTALLER_SOURCES=$(shell git ls-files) country.dat
15
16 PREFIX = /usr
17 BINDIR = $(PREFIX)/bin
18 USR_BIN := proxmox-tui-installer
19
20 COMPILED_BINS := \
21 $(addprefix $(CARGO_COMPILEDIR)/,$(USR_BIN))
22
23 all:
24
25 country.dat: country.pl
26 ./country.pl > country.dat.tmp
27 mv country.dat.tmp country.dat
28
29 deb: $(DEB)
30 $(DEB): $(INSTALLER_SOURCES)
31 rsync --exclude='test*.img' -a * build
32 cd build; dpkg-buildpackage -b -us -uc
33 lintian $(DEB)
34
35 test-$(DEB): $(INSTALLER_SOURCES)
36 rsync --exclude='test*.img' -a * build
37 cd build; dpkg-buildpackage -b -us -uc -nc
38 mv $(DEB) test-$(DEB)
39
40 DESTDIR=
41 VARLIBDIR=$(DESTDIR)/var/lib/proxmox-installer
42 HTMLDIR=$(VARLIBDIR)/html/common
43
44 .PHONY: install
45 install: $(INSTALLER_SOURCES) $(CARGO_COMPILEDIR)/proxmox-tui-installer
46 $(MAKE) -C banner install
47 $(MAKE) -C Proxmox install
48 install -D -m 644 interfaces $(DESTDIR)/etc/network/interfaces
49 install -D -m 755 fake-start-stop-daemon $(VARLIBDIR)/fake-start-stop-daemon
50 install -D -m 755 policy-disable-rc.d $(VARLIBDIR)/policy-disable-rc.d
51 install -D -m 644 country.dat $(VARLIBDIR)/country.dat
52 install -D -m 755 unconfigured.sh $(DESTDIR)/sbin/unconfigured.sh
53 install -D -m 755 proxinstall $(DESTDIR)/usr/bin/proxinstall
54 install -D -m 755 proxmox-low-level-installer $(DESTDIR)/$(BINDIR)/proxmox-low-level-installer
55 $(foreach i,$(USR_BIN), install -m755 $(CARGO_COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/)
56 install -D -m 755 checktime $(DESTDIR)/usr/bin/checktime
57 install -D -m 644 xinitrc $(DESTDIR)/.xinitrc
58 install -D -m 755 spice-vdagent.sh $(DESTDIR)/.spice-vdagent.sh
59 install -D -m 644 Xdefaults $(DESTDIR)/.Xdefaults
60
61 $(COMPILED_BINS):
62 $(CARGO) build --package proxmox-tui-installer --bin proxmox-tui-installer $(CARGO_BUILD_ARGS)
63
64 %-banner.png: %-banner.svg
65 rsvg-convert -o $@ $<
66
67 .PHONY: upload
68 upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
69 upload: $(DEB)
70 tar cf - $(DEB) | ssh -X repoman@repo.proxmox.com -- upload --product pve,pmg,pbs --dist $(UPLOAD_DIST)
71
72 %.img:
73 truncate -s 2G $@
74
75 %.big.img:
76 truncate -s 8G $@
77
78 .PHONY: prepare-check-env
79 prepare-check-env: test-$(DEB)
80 umount -Rd testdir || true
81 rm -rf testdir
82 dpkg -X test-$(DEB) testdir
83
84 cd-info.test: PRODUCT ?= pve
85 cd-info.test:
86 printf '%s\n' "PRODUCT='$(or $(PRODUCT), pve)'" >$@.tmp
87 printf '%s\n' "PRODUCTLONG='$(or $(PRODUCTLONG), Proxmox VE)'" >>$@.tmp
88 printf '%s\n' "RELEASE='$(or $(RELEASE), 42.1)'" >>$@.tmp
89 printf '%s\n' "ISORELEASE='$(or $(ISORELEASE), 1)'" >>$@.tmp
90 printf '%s\n' "ISONAME='$(or $(ISONAME), proxmox-ve)'" >>$@.tmp
91 mv $@.tmp $@
92
93 check-pve: prepare-check-env test.img
94 rm -f cd-info.test; $(MAKE) cd-info.test
95 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
96
97 check-pve-multidisks: prepare-check-env test.img test2.img test3.img test4.img test5.big.img
98 rm -f cd-info.test; $(MAKE) cd-info.test
99 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img,test2.img,test3.img,test4.img,test5.big.img
100
101 check-pve-tui: prepare-check-env test.img
102 rm -f cd-info.test; $(MAKE) cd-info.test
103 ./proxmox-low-level-installer dump-env -t
104 testdir/usr/bin/proxmox-tui-installer -t test.img
105
106 check-pmg: prepare-check-env test.img
107 rm -f cd-info.test; $(MAKE) \
108 PRODUCT=pmg \
109 PRODUCTLONG="Proxmox Mail Gateway" \
110 ISONAME='proxmox-mail-gateway' \
111 cd-info.test
112 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
113
114 check-pbs: prepare-check-env test.img
115 rm -f cd-info.test; $(MAKE) \
116 PRODUCT='pbs' \
117 PRODUCTLONG='Proxmox Backup Server' \
118 ISONAME='proxmox-backup-server' \
119 cd-info.test
120 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
121
122
123 .phony: clean
124 clean:
125 umount -Rd testdir || true
126 rm -rf *~ *.deb target build packages packages.tmp testdir test*.img pve-final.pkglist \
127 *.buildinfo *.changes country.dat final.pkglist cd-info.test
128 find . -name '*~' -exec rm {} ';'