a3b57fee2add3d6f9102f0b96ab3d04c9a865ecd
[vncterm.git] / Makefile
1 PACKAGE=vncterm
2 # Note: also change version in debian/control and debian/changelog
3 VERSION=1.5
4 PACKAGERELEASE=3
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 font.data: genfont2
21         ./genfont2 -o font.data.tmp -i /usr/share/unifont/unifont.hex
22         mv font.data.tmp font.data
23
24 genfont2: genfont2.c
25         gcc -g -O2 -o $@ genfont2.c -Wall -Wextra -D_GNU_SOURCE -lz
26
27 .PHONY: vnc
28 vnc: ${VNCLIB}
29 ${VNCLIB}: ${VNCSRC}
30         rm -rf ${VNCDIR}
31         tar xf ${VNCSRC}
32         ln -s ../vncpatches ${VNCDIR}/patches
33         cd ${VNCDIR}; quilt push -a
34         cd ${VNCDIR}; ./autogen.sh --without-ssl --without-websockets --without-tightvnc-filetransfer;
35         cd ${VNCDIR}; $(MAKE)
36
37 vncterm: vncterm.c ${VNCLIB} wchardata.c
38         gcc -O2 -g -o $@ vncterm.c wchardata.c -Wall -Wno-deprecated-declarations -D_GNU_SOURCE -I ${VNCDIR} ${VNCLIB} -lnsl -lpthread -lz -ljpeg -lutil -lgnutls -lpng
39
40 wchardata.c:
41         cp /usr/share/unifont/$@ $@
42
43 .PHONY: install
44 install: vncterm vncterm.1 font.data
45         mkdir -p ${DESTDIR}/usr/share/doc/${PACKAGE}
46         install -m 0644 copyright ${DESTDIR}/usr/share/doc/${PACKAGE}
47         mkdir -p ${DESTDIR}/usr/share/${PACKAGE}
48         install -m 0644 font.data ${DESTDIR}/usr/share/${PACKAGE}
49         mkdir -p ${DESTDIR}/usr/share/man/man1
50         install -m 0644 vncterm.1 ${DESTDIR}/usr/share/man/man1
51         mkdir -p ${DESTDIR}/usr/bin
52         install -s -m 0755 vncterm ${DESTDIR}/usr/bin
53
54 .PHONY: dinstall
55 dinstall: ${DEB}
56         dpkg -i ${DEB}
57
58 vncterm.1: vncterm.pod
59         rm -f $@
60         pod2man -n $< -s 1 -r ${VERSION} <$< >$@
61
62 .PHONY: deb
63 deb: $(DEB)
64 ${DEB}:
65         $(MAKE) clean
66         rsync -a . --exclude build build
67         echo "Architecture: ${ARCH}" >> build/debian/control
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
82
83 .PHONY: dist
84 ${SNAP} dist: distclean
85         rm -rf ../${SNAP}
86         cd ..; tar cvzf ${SNAP} --exclude .svn ${PACKAGE}
87         mv ../${SNAP} ${SNAP}
88
89 .PHONY: uploaddist
90 uploaddist: ${SNAP}
91         scp ${SNAP} pve.proxmox.com:/home/ftp/sources/