+include /usr/share/dpkg/pkg-info.mk
+include /usr/share/dpkg/architecture.mk
-PROGRAMS=spiceterm
+PACKAGE=spiceterm
-HEADERS=translations.h event_loop.h glyphs.h spiceterm.h
-SOURCES=screen.c event_loop.c spiceterm.c
+GITVERSION:=$(shell cat .git/refs/heads/master)
+BUILDDIR ?= ${PACKAGE}-${DEB_VERSION_UPSTREAM}
-#export G_MESSAGES_DEBUG=all
-#export SPICE_DEBUG=1
+export VERSION=$(DEB_VERSION_UPSTREAM)
-all: ${PROGRAMS}
+DEB=${PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_${DEB_BUILD_ARCH}.deb
-spiceterm: ${SOURCES} ${HEADERS} spiceterm.c
- gcc -Werror -Wall -Wtype-limits ${SOURCES} -o $@ -lutil $(shell pkg-config --cflags gdk-3.0) $(shell pkg-config --cflags --libs gthread-2.0,spice-protocol,spice-server)
+.PHONY: deb
+deb: ${DEB}
+${DEB}:
+ rm -rf $(BUILDDIR)
+ rsync -a src/ debian $(BUILDDIR)
+ echo "git clone git://git.proxmox.com/git/spiceterm.git\\ngit checkout ${GITVERSION}" > $(BUILDDIR)/debian/SOURCE
+ cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
+ lintian ${DEB}
-.PHONY: test
-test: spiceterm
- ./spiceterm & remote-viewer spice://localhost:5912
+.PHONY: dinstall
+dinstall: ${DEB}
+ dpkg -i ${DEB}
-.PHONY: distclean
-distclean: clean
+.PHONY: upload
+upload: ${DEB}
+ tar cf - ${DEB} | ssh repoman@repo.proxmox.com -- upload --product pve --dist stretch --arch ${ARCH}
-.PHONY: clean
+.PHONY: distclean clean
+distclean: clean
clean:
- rm -rf *~ ${PROGRAMS}
\ No newline at end of file
+ rm -rf *~ $(BUILDDIR) *.deb *.changes genfont *.buildinfo