Index: app/dist/deb/Makefile
===================================================================
--- app/dist/deb/Makefile	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/deb/Makefile	(revision d593c5e768abb663835cfc216a133cf5ce86c8c6)
@@ -1,52 +1,57 @@
 #default task
+
+DIR=$(shell pwd)
+
+ifndef UTT_DIST_DIR
+	UTT_DIST_DIR=${DIR}
+endif
+
+ifndef UTT_DIST_OUTPUT
+	UTT_DIST_OUTPUT=${DIR}
+endif
 
 # here there're few properties
 _PRODUCT_NAME=utt
-_BUILD_DIR=$(_UTT_BIN_DIR)
 _UTT_VER=$(shell cat ../common/version.def)
 _UTT_REL=$(shell cat ../common/release.def)
-_DEB_ROOT=$(shell pwd)/deb_root
-_INSTALL_DIR=/usr/local/$(_PRODUCT_NAME)/$(_UTT_VER)-$(_UTT_REL)
+_DEB_FROOT=$(DIR)/deb_root
+_UTT_DIR=${_DEB_FROOT}/usr/local/$(_PRODUCT_NAME).$(_UTT_VER)-$(_UTT_REL)
 
 .PHONY: default
-default:
-	# we need some extra configuration files
-	make_control
-	make_postinst
+default: make_control make_postinst make_prerm
+	# first, we prepare some directory structure
+	mkdir -p $(_DEB_FROOT)/DEBIAN
+	mkdir -p $(_UTT_DIR)
 
-	# first, we prepare some directory structure
-	mkdir -p $(_DEB_ROOT)/DEBIAN
-	mkdir -p $(_DEB_ROOT)$(_INSTALL_DIR)
-	mkdir -p $(_DEB_ROOT)/usr/share/man/man1
-	mkdir -p $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)
+	# next, we copy deb package files
+	mv ./control $(_DEB_FROOT)/DEBIAN/
+	mv ./postinst $(_DEB_FROOT)/DEBIAN/
+	mv ./prerm $(_DEB_FROOT)/DEBIAN/
+	cd ${_DEB_FROOT} && tar -cvvf control.tar.gz DEBIAN/
+	cd ${DIR};
+	rm -fr ${_DEB_FROOT}/DEBIAN/
 
-	find $(_DEB_ROOT) -type d | xargs chmod 755   # this is necessary on Debian Woody, don't ask me why
-
-	# next, we copy necessary files
-	mv ./control $(_DEB_ROOT)/DEBIAN/
-	cp ./postinst $(_DEB_ROOT)/DEBIAN/
-	cp ./prerm $(_DEB_ROOT)/DEBIAN/
-#	cp -r $(_BUILD_DIR)/man/* $(_DEB_ROOT)/usr/share/man/
-	cp $(_BUILD_DIR)/COPYRIGHT $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/copyright
-#	cp $(_BUILD_DIR)/changelog $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/
-#	cp $(_BUILD_DIR)/changelog.Debian $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/
+	# we copy all necessery files (binaries)
+	cp -r ${UTT_DIST_DIR}/* ${_UTT_DIR}/
+	cp ./changelog ${_UTT_DIR}/share/doc/$(_PRODUCT_NAME)/
+#	gzip --best $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/changelog
+	cp ./changelog.Debian $(_UTT_DIR)/share/doc/$(_PRODUCT_NAME)/
+#	gzip --best $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/changelog.Debian
+	cp ../files/* ${_UTT_DIR}/share/doc/${_PRODUCT_NAME}/
+	cp ../common/utt_make_config.pl ${_UTT_DIR}/bin/
+	chmod 755 ${_UTT_DIR}/bin/utt_make_config.pl
+	
 
 
-	# next we make man/doc archives
+#	# next we make man/doc archives
 #	gzip --best $(_DEB_ROOT)/usr/share/man/man1/$(_PRODUCT_NAME).1
-#	gzip --best $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/changelog
-#	gzip --best $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/changelog.Debian
-#	tar -cvvf control.tar.gz ${_DEB_ROOT}/DEBIAN/
-#	rm -fr ${_DEB_ROOT}/DEBIAN/
 
-	# and binaries
-	cp -rv $(_BUILD_DIR)/* $(_DEB_ROOT)$(_INSTALL_DIR)/
-#	tar -cvvf data.tar.gz ${_DEB_ROOT}/
-#	rm -fr ${_DEB_ROOT}/
-
+	find $(_DEB_FROOT) -type d | xargs chmod 755   # this is necessary on Debian Woody, don't ask me why
 
 	# finally, we buid deb package
-	fakeroot dpkg-deb --build $(_DEB_ROOT)
-	mv $(_DEB_ROOT).deb $(_PRODUCT_NAME)_$(_UTT_VER)-$(_UTT_REL).all.deb
+	fakeroot dpkg-deb --build $(_DEB_FROOT)
+	mv $(_DEB_FROOT).deb $(_PRODUCT_NAME)_$(_UTT_VER)-$(_UTT_REL).all.deb
+	rm -rf ${_DEB_FROOT}
+	
 
 
