buildsys: use dpkg-dev makefile helpers for pkg info
[vncterm.git] / Makefile
1 include /usr/share/dpkg/pkg-info.mk
2 include /usr/share/dpkg/architecture.mk
3
4 PACKAGE=vncterm
5 GITVERSION:=$(shell cat .git/refs/heads/master)
6
7 VNCVER=0.9.11
8 VNCREL=LibVNCServer-${VNCVER}
9 VNCDIR=libvncserver-${VNCREL}
10 VNCSRC=${VNCREL}.tar.gz
11 VNCLIB=${VNCDIR}/libvncserver/.libs/libvncserver.a
12
13 DEB=${PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_${DEB_BUILD_ARCH}.deb
14
15 CPPFLAGS += -O2 -g -Wall -Wno-deprecated-declarations -D_GNU_SOURCE -I $(VNCDIR)
16
17 VNC_LIBS := -lnsl -lpthread -lz -ljpeg -lutil -lgnutls -lpng
18
19 all: vncterm
20
21 font.data: genfont2
22         ./genfont2 -o font.data.tmp -i /usr/share/unifont/unifont.hex
23         mv font.data.tmp font.data
24
25 genfont2: genfont2.c
26         gcc -g -O2 -o $@ genfont2.c -Wall -Wextra -D_GNU_SOURCE -lz
27
28 .PHONY: vnc
29 vnc: ${VNCLIB}
30 ${VNCLIB}: ${VNCSRC}
31         rm -rf ${VNCDIR}
32         tar xf ${VNCSRC}
33         ln -s ../vncpatches ${VNCDIR}/patches
34         cd ${VNCDIR}; quilt push -a
35         cd ${VNCDIR}; ./autogen.sh --without-ssl --without-websockets --without-tightvnc-filetransfer;
36         cd ${VNCDIR}; $(MAKE)
37
38 vncterm: vncterm.c wchardata.c $(VNCLIB)
39         $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(VNC_LIBS)
40
41 wchardata.c:
42         cp /usr/share/unifont/$@ $@
43
44 .PHONY: install
45 install: vncterm vncterm.1 font.data
46         mkdir -p ${DESTDIR}/usr/share/doc/${PACKAGE}
47         install -m 0644 copyright ${DESTDIR}/usr/share/doc/${PACKAGE}
48         mkdir -p ${DESTDIR}/usr/share/${PACKAGE}
49         install -m 0644 font.data ${DESTDIR}/usr/share/${PACKAGE}
50         mkdir -p ${DESTDIR}/usr/share/man/man1
51         install -m 0644 vncterm.1 ${DESTDIR}/usr/share/man/man1
52         mkdir -p ${DESTDIR}/usr/bin
53         install -s -m 0755 vncterm ${DESTDIR}/usr/bin
54
55 .PHONY: dinstall
56 dinstall: ${DEB}
57         dpkg -i ${DEB}
58
59 vncterm.1: vncterm.pod
60         rm -f $@
61         pod2man -n $< -s 1 -r ${DEB_VERSION_UPSTREAM} <$< >$@
62
63 .PHONY: deb
64 deb: $(DEB)
65 ${DEB}:
66         $(MAKE) clean
67         rsync -a . --exclude build build
68         echo "git clone git://git.proxmox.com/git/vncterm.git\\ngit checkout ${GIVERSION}" > build/debian/SOURCE
69         cd build; dpkg-buildpackage -rfakeroot -b -us -uc
70         lintian ${DEB}
71
72 .PHONY: upload
73 upload: ${DEB}
74         tar cf - ${DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pmg,pve --dist stretch
75
76 .PHONY: clean
77 clean:
78         rm -rf vncterm vncterm.1 vncterm_*.deb genfont genfont2 *~ ${VNCDIR} vncterm-*.tar.gz glyph.h.tmp build *.changes wchardata.c font.data.tmp font.data *.buildinfo
79
80 .PHONY: distclean
81 distclean: clean