fixup debian packagin/Makefile
[vncterm.git] / Makefile
1 PACKAGE=vncterm
2 # Note: also change version in debian/control and debian/changelog
3 VERSION=1.4
4 PACKAGERELEASE=2
5 ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
6 GITVERSION:=$(shell cat .git/refs/heads/master)
7 CDATE:=$(shell date +%F)
8
9 VNCVER=0.9.11
10 VNCREL=LibVNCServer-${VNCVER}
11 VNCDIR=libvncserver-${VNCREL}
12 VNCSRC=${VNCREL}.tar.gz
13 VNCLIB=${VNCDIR}/libvncserver/.libs/libvncserver.a
14
15 DEB=${PACKAGE}_${VERSION}-${PACKAGERELEASE}_${ARCH}.deb
16 SNAP=${PACKAGE}-${VERSION}-${CDATE}.tar.gz
17
18 all: vncterm
19
20 glyphs.h: genfont
21         ./genfont > glyphs.h.tmp
22         mv glyphs.h.tmp glyphs.h
23
24 genfont: genfont.c
25         gcc -g -O2 -o $@ genfont.c -Wall -D_GNU_SOURCE -lz
26
27 .PHONY: vnc
28 ${VNCLIB} vnc: ${VNCSRC}
29         rm -rf ${VNCDIR}
30         tar xf ${VNCSRC}
31         ln -s ../vncpatches ${VNCDIR}/patches
32         cd ${VNCDIR}; quilt push -a
33         cd ${VNCDIR}; ./autogen.sh --without-ssl --without-websockets --without-tightvnc-filetransfer;
34         cd ${VNCDIR}; make
35
36 vncterm: vncterm.c glyphs.h ${VNCLIB}
37         gcc -O2 -g -o $@ vncterm.c -Wall -Wno-deprecated-declarations -D_GNU_SOURCE -I ${VNCDIR} ${VNCLIB} -lnsl -lpthread -lz -ljpeg -lutil -lgnutls -lpng
38
39
40 .PHONY: install
41 install: vncterm vncterm.1
42         mkdir -p ${DESTDIR}/usr/share/doc/${PACKAGE}
43         install -m 0644 copyright ${DESTDIR}/usr/share/doc/${PACKAGE}
44         mkdir -p ${DESTDIR}/usr/share/man/man1
45         install -m 0644 vncterm.1 ${DESTDIR}/usr/share/man/man1
46         mkdir -p ${DESTDIR}/usr/bin
47         install -s -m 0755 vncterm ${DESTDIR}/usr/bin
48
49 .PHONY: dinstall
50 dinstall: ${DEB}
51         dpkg -i ${DEB}
52
53 vncterm.1: vncterm.pod
54         rm -f $@
55         pod2man -n $< -s 1 -r ${VERSION} <$< >$@
56
57 .PHONY: deb
58 deb: $(DEB)
59 ${DEB}:
60         make clean
61         rsync -a . --exclude build build
62         echo "Architecture: ${ARCH}" >> build/debian/control
63         echo "git clone git://git.proxmox.com/git/vncterm.git\\ngit checkout ${GIVERSION}" > build/debian/SOURCE
64         cd build; dpkg-buildpackage -rfakeroot -b -us -uc
65         lintian ${DEB}  
66
67 .PHONY: upload
68 upload: ${DEB}
69         tar cf - ${DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pmg,pve --dist stretch
70
71 .PHONY: clean
72 clean:
73         rm -rf vncterm vncterm.1 vncterm_*.deb genfont *~ ${VNCDIR} vncterm-*.tar.gz glyph.h.tmp build *.changes
74
75 .PHONY: distclean
76 distclean: clean
77
78 .PHONY: dist
79 ${SNAP} dist: distclean
80         rm -rf ../${SNAP}
81         cd ..; tar cvzf ${SNAP} --exclude .svn ${PACKAGE}
82         mv ../${SNAP} ${SNAP}
83
84 .PHONY: uploaddist
85 uploaddist: ${SNAP}
86         scp ${SNAP} pve.proxmox.com:/home/ftp/sources/