#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

clean:
	sudo rm -rf xrdp/xorg/X11R7.6/build_dir/ xrdp/xorg/X11R7.6/cookies/ xrdp/xorg/X11R7.6/rdp/X11rdp xrdp/xorg/X11R7.6/rdp/librdp.a
	sudo rm -rf /opt/X11rdp
	rm -rf debian/x11rdp/*
	cd xrdp/xorg/X11R7.6 ; ./buildx.sh clean

build:
	cd xrdp/xorg/X11R7.6 ; sudo ./buildx.sh /opt/X11rdp

install:
	mkdir -p debian/x11rdp/usr/bin
	mkdir -p debian/x11rdp/opt
	sudo cp -r /opt/X11rdp debian/x11rdp/opt/
	sudo chgrp admin debian/x11rdp -R
	sudo chmod g+rw debian/x11rdp -R
	cd debian/x11rdp/usr/bin ; ln -s ../../opt/X11rdp/bin/X11rdp ./

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
	dh_installlogrotate
	dh_installcron
	dh_installman
	dh_link
	dh_fixperms
	dh_compress
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-arch

