.gitignore updates
[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 CPPFLAGS += -O2 -g -Wall -Wno-deprecated-declarations -D_GNU_SOURCE -I $(VNCDIR)
19
20 VNC_LIBS := -lnsl -lpthread -lz -ljpeg -lutil -lgnutls -lpng
21
22 all: vncterm
23
24 font.data: genfont2
25         ./genfont2 -o font.data.tmp -i /usr/share/unifont/unifont.hex
26         mv font.data.tmp font.data
27
28 genfont2: genfont2.c
29         gcc -g -O2 -o $@ genfont2.c -Wall -Wextra -D_GNU_SOURCE -lz
30
31 .PHONY: vnc
32 vnc: ${VNCLIB}
33 ${VNCLIB}: ${VNCSRC}
34         rm -rf ${VNCDIR}
35         tar xf ${VNCSRC}
36         ln -s ../vncpatches ${VNCDIR}/patches
37         cd ${VNCDIR}; quilt push -a
38         cd ${VNCDIR}; ./autogen.sh --without-ssl --without-websockets --without-tightvnc-filetransfer;
39         cd ${VNCDIR}; $(MAKE)
40
41 vncterm: vncterm.c wchardata.c $(VNCLIB)
42         $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(VNC_LIBS)
43
44 wchardata.c:
45         cp /usr/share/unifont/$@ $@
46
47 .PHONY: install
48 install: vncterm vncterm.1 font.data
49         mkdir -p ${DESTDIR}/usr/share/doc/${PACKAGE}
50         install -m 0644 copyright ${DESTDIR}/usr/share/doc/${PACKAGE}
51         mkdir -p ${DESTDIR}/usr/share/${PACKAGE}
52         install -m 0644 font.data ${DESTDIR}/usr/share/${PACKAGE}
53         mkdir -p ${DESTDIR}/usr/share/man/man1
54         install -m 0644 vncterm.1 ${DESTDIR}/usr/share/man/man1
55         mkdir -p ${DESTDIR}/usr/bin
56         install -s -m 0755 vncterm ${DESTDIR}/usr/bin
57
58 .PHONY: dinstall
59 dinstall: ${DEB}
60         dpkg -i ${DEB}
61
62 vncterm.1: vncterm.pod
63         rm -f $@
64         pod2man -n $< -s 1 -r ${VERSION} <$< >$@
65
66 .PHONY: deb
67 deb: $(DEB)
68 ${DEB}:
69         $(MAKE) clean
70         rsync -a . --exclude build build
71         echo "Architecture: ${ARCH}" >> build/debian/control
72         echo "git clone git://git.proxmox.com/git/vncterm.git\\ngit checkout ${GIVERSION}" > build/debian/SOURCE
73         cd build; dpkg-buildpackage -rfakeroot -b -us -uc
74         lintian ${DEB}  
75
76 .PHONY: upload
77 upload: ${DEB}
78         tar cf - ${DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pmg,pve --dist stretch
79
80 .PHONY: clean
81 clean:
82         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
83
84 .PHONY: distclean
85 distclean: clean
86
87 .PHONY: dist
88 ${SNAP} dist: distclean
89         rm -rf ../${SNAP}
90         cd ..; tar cvzf ${SNAP} --exclude .svn ${PACKAGE}
91         mv ../${SNAP} ${SNAP}
92
93 .PHONY: uploaddist
94 uploaddist: ${SNAP}
95         scp ${SNAP} pve.proxmox.com:/home/ftp/sources/