diff --git a/debian/control b/debian/control
index 459030b..f7138b5 100644
--- a/debian/control
+++ b/debian/control
@@ -1,86 +1,282 @@
 Source: libosmocore
+Maintainer: Harald Welte <laforge@gnumonks.org>
+Uploaders: Ruben Undheim <ruben.undheim@gmail.com>
 Section: libs
 Priority: optional
-Maintainer: Harald Welte <laforge@gnumonks.org>
-Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, doxygen, libpcsclite-dev, pkg-config, libtalloc-dev
-Standards-Version: 3.9.6
-Homepage: http://bb.osmocom.org/trac/wiki/libosmocore
+Build-Depends: debhelper (>= 9),
+               autotools-dev,
+               dh-autoreconf,
+               doxygen,
+               txt2man,
+               libpcsclite-dev,
+               pkg-config,
+               autoconf,
+               automake,
+               libtool,
+               libdpkg-perl,
+               git,
+               libtalloc-dev
+Standards-Version: 3.9.7
 Vcs-Git: git://git.osmocom.org/libosmocore.git
 Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmocore.git;a=summary
+Homepage: http://bb.osmocom.org/trac/wiki/libosmocore
 
 Package: libosmocore
 Section: libs
 Architecture: any
-Depends: libosmocodec0, libosmocore7, libosmogb4, libosmogsm5, libosmovty3, libosmoctrl0, ${misc:Depends}
-Multi-Arch: foreign
-Description: Open Source MObile COMmunications CORE library
+Multi-Arch: same
+Depends: libosmocodec0 (= ${binary:Version}),
+         libosmocore6 (= ${binary:Version}),
+         libosmogb4 (= ${binary:Version}),
+         libosmogsm5 (= ${binary:Version}),
+         libosmovty3 (= ${binary:Version}),
+         libosmoctrl0 (= ${binary:Version}),
+         libosmosim0 (= ${binary:Version}),
+         ${misc:Depends}
+Description: Open Source MObile COMmunications CORE library (metapackage)
+ The libraries provided by this package contain various utility functions.
+ These were originally developed as part of the
+ OpenBSC project but are of a more generic nature and thus useful to (at
+ least) other programs that are developed in the sphere of Free Software / Open
+ Source mobile communication.
 
 Package: libosmocodec0
 Section: libs
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
 Multi-Arch: same
+Depends: ${shlibs:Depends},
+         ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}
 Description: Osmo codec library
+ This is part of the libosmocore "meta"-library. The libosmocore library
+ contains various utility functions that were originally developed as part of
+ the OpenBSC project, but which are of a more generic nature and thus useful to
+ (at least) other programs that are developed in the sphere of Free Software /
+ Open Source mobile communication.
+ .
+ The libosmocodec library in particular contains the implementation of multiple
+ GSM codecs:
+ .
+  - GSM 06.10 - GSM FR Codec
+  - GSM 06.20 - GSM HR Codec
+  - GSM 06.60 - GSM EFR Codec
+  - GSM 06.90 - GSM AMR Codec
+
+Package: libosmocodec-doc
+Architecture: all
+Section: doc
+Depends: ${misc:Depends},
+         libosmocodec0,
+         libjs-jquery
+Description: Documentation for the osmo codec library
+ This is part of the libosmocore "meta"-library. The libosmocore library
+ contains various utility functions that were originally developed as part of
+ the OpenBSC project, but which are of a more generic nature and thus useful to
+ (at least) other programs that are developed in the sphere of Free Software /
+ Open Source mobile communication.
+ .
+ This package contains the documentation for the libosmocodec library.
 
 Package: libosmocore7
 Section: libs
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
 Multi-Arch: same
+Depends: ${shlibs:Depends},
+         ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}
 Description: Osmo Core library
+ This is part of the libosmocore "meta"-library. The libosmocore library
+ contains various utility functions that were originally developed as part of
+ the OpenBSC project, but which are of a more generic nature and thus useful to
+ (at least) other programs that are developed in the sphere of Free Software /
+ Open Source mobile communication.
+ .
+ The libosmocore6 library in particular is a collection of common code used in
+ various sub-projects inside the Osmocom family of projects.
+
+Package: libosmocore-doc
+Architecture: all
+Section: doc
+Depends: ${misc:Depends},
+         libosmocore6,
+         libjs-jquery,
+         libosmocodec-doc,
+         libosmogsm-doc,
+         libosmovty-doc
+Description: Documentation for the Osmo Core library
+ This is part of the libosmocore "meta"-library. The libosmocore library
+ contains various utility functions that were originally developed as part of
+ the OpenBSC project, but which are of a more generic nature and thus useful to
+ (at least) other programs that are developed in the sphere of Free Software /
+ Open Source mobile communication.
+ .
+ This package contains the documentation for the libosmocore library.
 
 Package: libosmogb4
 Section: libs
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
 Multi-Arch: same
+Depends: ${shlibs:Depends},
+         ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}
 Description: Osmo GPRS GB library
+ This is part of the libosmocore "meta"-library. The libosmocore library
+ contains various utility functions that were originally developed as part of
+ the OpenBSC project, but which are of a more generic nature and thus useful to
+ (at least) other programs that are developed in the sphere of Free Software /
+ Open Source mobile communication.
+ .
+ The libosmogb library in particular contains a GPRS BSSGP protocol
+ implementation.
 
 Package: libosmogsm5
 Section: libs
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
 Multi-Arch: same
+Depends: ${shlibs:Depends},
+         ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}
 Description: Osmo GSM utility library
+ This is part of the libosmocore "meta"-library. The libosmocore library
+ contains various utility functions that were originally developed as part of
+ the OpenBSC project, but which are of a more generic nature and thus useful to
+ (at least) other programs that are developed in the sphere of Free Software /
+ Open Source mobile communication.
+ .
+ The libosmogsm library in particular is a collection of common code used in
+ various GSM related sub-projects inside the Osmocom family of projects. It
+ includes A5/1 and A5/2 ciphers, COMP128v1, a LAPDm implementation, a GSM TLV
+ parser, SMS utility routines as well as protocol definitions for a series of
+ protocols.
+
+Package: libosmogsm-doc
+Architecture: all
+Section: doc
+Depends: ${misc:Depends},
+         libosmogsm5,
+         libjs-jquery
+Description: Documentation for the Osmo GSM utility library
+ This is part of the libosmocore "meta"-library. The libosmocore library
+ contains various utility functions that were originally developed as part of
+ the OpenBSC project, but which are of a more generic nature and thus useful to
+ (at least) other programs that are developed in the sphere of Free Software /
+ Open Source mobile communication.
+ .
+ This package contains the documentation for the libosmogsm library.
 
 Package: libosmovty3
 Section: libs
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
 Multi-Arch: same
+Depends: ${shlibs:Depends},
+         ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}
 Description: Osmo VTY library
+ This is part of the libosmocore "meta"-library. The libosmocore library
+ contains various utility functions that were originally developed as part of
+ the OpenBSC project, but which are of a more generic nature and thus useful to
+ (at least) other programs that are developed in the sphere of Free Software /
+ Open Source mobile communication.
+ .
+ The libosmovty library in particular implements the interactive command-line
+ on the VTY (Virtual TTY) as well as configuration file parsing.
+
+Package: libosmovty-doc
+Architecture: all
+Section: doc
+Depends: ${misc:Depends},
+         libosmovty3,
+         libjs-jquery
+Description: Documentation for the Osmo VTY library
+ This is part of the libosmocore "meta"-library. The libosmocore library
+ contains various utility functions that were originally developed as part of
+ the OpenBSC project, but which are of a more generic nature and thus useful to
+ (at least) other programs that are developed in the sphere of Free Software /
+ Open Source mobile communication.
+ .
+ This package contains the documentation for the libosmovty library.
 
 Package: libosmoctrl0
 Section: libs
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
 Multi-Arch: same
+Depends: ${shlibs:Depends},
+         ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}
 Description: Osmo control library
+ This is part of the libosmocore "meta"-library. The libosmocore library
+ contains various utility functions that were originally developed as part of
+ the OpenBSC project, but which are of a more generic nature and thus useful to
+ (at least) other programs that are developed in the sphere of Free Software /
+ Open Source mobile communication.
+ .
+ The libosmoctrl library in particular contains an SNMP-like status interface.
 
 Package: libosmosim0
 Section: libs
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
 Multi-Arch: same
+Depends: ${shlibs:Depends},
+         ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}
 Description: Osmo SIM library
+ This is part of the libosmocore "meta"-library. The libosmocore library
+ contains various utility functions that were originally developed as part of
+ the OpenBSC project, but which are of a more generic nature and thus useful to
+ (at least) other programs that are developed in the sphere of Free Software /
+ Open Source mobile communication.
+ .
+ The libosmosim library in particular contains routines for SIM card access.
 
 Package: libosmocore-dev
-Section: libdevel
 Architecture: any
-Depends: ${misc:Depends}, libosmocore, libtalloc-dev
 Multi-Arch: same
+Section: libdevel
+Depends: libosmocodec0 (= ${binary:Version}),
+         libosmocore7 (= ${binary:Version}),
+         libosmogb4 (= ${binary:Version}),
+         libosmogsm5 (= ${binary:Version}),
+         libosmovty3 (= ${binary:Version}),
+         libosmoctrl0 (= ${binary:Version}),
+         libosmosim0 (= ${binary:Version}),
+         ${misc:Depends},
+         libtalloc-dev
 Description: Development headers for Open Source MObile COMmunications CORE library
+ The header files provided by this package may be used to develop
+ with any of the libosmocore libraries.
+ .
+ Also static libraries are installed with this package. 
 
 Package: libosmocore-utils
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore
 Multi-Arch: same
+Section: utils
+Depends: ${shlibs:Depends},
+         ${misc:Depends},
+         libosmocore
 Description: Utilities for gsm
+ This package contains a program for frequency calculation for GSM called
+ 'osmo-arfcn' and a program called 'osmo-auc-gen' that is used for testing GSM
+ authentication.
+ .
+ They use the libosmocore library. The libosmocore library contain various
+ utility functions that were originally developed as part of the OpenBSC
+ project, but which are of a more generic nature and thus useful to (at least)
+ other programs that are developed in the sphere of Free Software / Open Source
+ mobile communication.
 
 Package: libosmocore-dbg
 Architecture: any
+Multi-Arch: same
 Section: debug
 Priority: extra
-Depends: libosmocore (= ${binary:Version}), ${misc:Depends}
-Multi-Arch: same
+Depends: libosmocore (= ${binary:Version}),
+         ${misc:Depends}
 Description: Debug symbols for Open Source MObile COMmunications CORE library
+ This proackage contains debug symbols for all the libraries that are part of
+ libosmocore.
+ .
+ The libosmocore library contain various utility functions that
+ were originally developed as part of the OpenBSC project, but which are of a
+ more generic nature and thus useful to (at least) other programs that are
+ developed in the sphere of Free Software / Open Source mobile communication.
diff --git a/debian/copyright b/debian/copyright
index c450be5..2991c85 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,54 +1,211 @@
-This work was packaged for Debian by:
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: libosmocore
+Source: git://git.osmocom.org/libosmocore.git
 
-    Harald Welte <laforge@gnumonks.org> on Tue, 24 Aug 2010 10:55:04 +0200
+Files: *
+Copyright: 2008      Daniel Willmann <daniel@totalueberwachung.de>
+           2008-2010 Harald Welte <laforge@gnumonks.org>
+           2008-2010 Holger Hans Peter Freyther <zecke@selfish.org>
+           2009-2010 Sylvain Munaut <tnt@246tNt.com>
+           2009-2010 On-Waves
+           2010      Nico Golde <nico@ngolde.de>
+License: GPL-2+
 
-It was downloaded from:
+Files: src/talloc.c include/osmocom/core/talloc.h
+Copyright: 2004 Andrew Tridgell
+           2006 Stefan Metzmacher
+License: LGPL-3+
 
-    git://git.osmocom.org/libosmocore.git
+Files: include/osmocom/core/loggingrb.h
+       include/osmocom/core/strrb.h
+       src/strrb.c
+       src/loggingrb.c
+Copyright: 2012-2013 Katerina Barone-Adesi <kat.obsc@gmail.com>
+License: GPL-2+
 
-Upstream Author(s):
+Files: include/osmocom/core/linuxrbtree.h
+       src/rbtree.c
+Copyright: 1999 Andrea Arcangeli <andrea@suse.de>
+           2002 David Woodhouse <dwmw2@infradead.org>
+License: GPL-2+
 
-    Harald Welte <laforge@gnumonks.org>
-    Holger Hans Peter Freyther <zecke@selfish.org>
-    Sylvain Munaut <tnt@246tNt.com>
-    Daniel Willmann <daniel@totalueberwachung.de>
-    Golde <nico@ngolde.de>
-	For src/talloc.c and include/osmocore/talloc.h:
-    Andrew Tridgell
-    Stefan Metzmacher
-	For src/vty/* and include/osmocom/vty/*
-    Kunihiro Ishiguro
+Files: include/osmocom/core/crc16.h
+Copyright: 2005 Ben Gardner <bgardner@wabtec.com>
+License: GPL-2+
 
-Copyright:
+Files: src/utils.c
+Copyright: 2011 Harald Welte <laforge@gnumonks.org>
+           2011 Sylvain Munaut <tnt@246tNt.com>
+           2014 Nils O. Selåsdal <noselasd@fiane.dyndns.org>
+License: GPL-2+
 
-    Copyright (C) 2008-2010 Harald Welte <laforge@gnumonks.org>
-    Copyright (C) 2008-2010 Holger Hans Peter Freyther <zecke@selfish.org>
-    Copyright (C) 2009-2010 Sylvain Munaut <tnt@246tNt.com>
-    Copyright (C) 2009-2010 On-Waves
-    Copyright (C) 2008 Daniel Willmann <daniel@totalueberwachung.de>
-    Copyright (C) 2010 Nico Golde <nico@ngolde.de>
-	For src/talloc.c and include/osmocore/talloc.h:
-    Copyright (C) 2004 Andrew Tridgell
-    Copyright (C) 2006 Stefan Metzmacher
-	For src/vty/* and include/osmocom/vty/*
-    Copyright (C) 1998 Kunihiro Ishiguro
+Files: src/gsm/gsm48_ie.c
+       src/gsm/lapd_core.c
+       src/gsm/lapdm.c
+Copyright: 2008,2010-2011 Harald Welte <laforge@gnumonks.org>
+           2009-2011      Andreas Eversberg <jolly@eversberg.eu>
+License: GPL-2+
 
-License:
+Files: src/gsm/gsm0411_smc.c
+       src/gsm/gsm0411_smr.c
+       src/gsm/gsm0411_utils.c
+Copyright: 2008 Daniel Willmann <daniel@totalueberwachung.de>
+           2009 Harald Welte <laforge@gnumonks.org>
+           2010-2013 Holger Hans Peter Freyther <zecke@selfish.org>
+           2010 On-Waves
+           2011 Andreas Eversberg <jolly@eversberg.eu>
+License: GPL-2+
 
-    GNU General Public License, Version 2 or later
+Files: src/gsm/gsm0480.c
+Copyright: 2009 Mike Haben <michael.haben@btinternet.com>
+           2010 Holger Hans Peter Freyther <zecke@selfish.org>
+License: GPL-2+
 
-The Debian packaging is:
+Files: src/gsm/milenage/aes-internal.c
+       src/gsm/milenage/aes-encblock.c
+       src/gsm/milenage/aes.h
+       src/gsm/milenage/milenage.c
+       src/gsm/milenage/aes_wrap.h
+       src/gsm/milenage/aes-internal-enc.c
+       src/gsm/milenage/aes_i.h
+Copyright: 2003-2007 Jouni Malinen <j@w1.fi>
+License: GPL-2
+Comment: Most of the file aes-internal.c is public_domain
 
-    Copyright (C) 2010 Harald Welte <laforge@gnumonks.org>
+Files: include/osmocom/core/bitXXgen.h.tpl
+       src/gsm/kasumi.c
+Copyright: 2013-2014 Max <max.suraev@fairwaves.co>
+License: GPL-2+
 
-# Please chose a license for your packaging work. If the program you package
-# uses a mainstream license, using the same license is the safest choice.
-# Please avoid to pick license terms that are more restrictive than the
-# packaged work, as it may make Debian's contributions unacceptable upstream.
-# If you just want it to be GPL version 3, leave the following lines in.
+Files: src/gsm/auth_comp128v23.c
+Copyright: 2010-2011 Harald Welte <laforge@gnumonks.org>
+           2013 Kévin Redon <kevredon@mail.tsaitgaist.info>
+License: GPL-2+
 
-and is licensed under the GPL version 3,
-see "/usr/share/common-licenses/GPL-3".
+Files: src/gsm/comp128v23.c
+Copyright: 2013 Kévin Redon <kevredon@mail.tsaitgaist.info>
+License: GPL-2+
 
-# Please also look if there are files or directories which have a
-# different copyright/license attached and list them here.
+Files: tests/fr/fr_test.c
+       tests/logging/logging_test.c
+       tests/loggingrb/loggingrb_test.c
+Copyright: 2008,2009,2012 Holger Hans Peter Freyther <zecke@selfish.org>
+           2012-2013      Katerina Barone-Adesi <kat.obsc@gmail.com>
+License: AGPL-3+
+
+Files: tests/strrb/strrb_test.c
+       tests/vty/vty_test.c
+Copyright: 2012-2013 Katerina Barone-Adesi <kat.obsc@gmail.com>
+           2013      Jacob Erlbeck <jerlbeck@sysmocom.de>
+License: GPL-3+
+
+Files: src/vty/* include/osmocom/vty/*
+Copyright: 1997,1998 Kunihiro Ishiguro
+License: GPL-2+
+
+Files: include/osmocom/core/stats.h
+       src/stat_item.c
+       src/stats.c
+       src/vty/stats_vty.c
+       tests/stats/stats_test.c
+Copyright: 2009-2010 by Harald Welte <laforge@gnumonks.org>
+           2009-2014 by Holger Hans Peter Freyther
+           2015 Sysmocom s.f.m.c. GmbH
+License: GPL-2+
+
+Files: tests/gb/gprs_ns_test.c
+       tests/gb/gprs_bssgp_test.c
+Copyright: 2013-2014 sysmocom s.f.m.c. GmbH
+License: GPL-2+
+Comment: No license is listed in these files, but it is assumed that
+ the project specific license GPL-2+ applies since contributions by
+ sysmocom people to other files in this package are GPL licensed.
+
+Files: debian/*
+Copyright: 2010-2015 Harald Welte <laforge@gnumonks.org>
+           2014-2015 Ruben Undheim <ruben.undheim@gmail.com>
+License: GPL-3+
+
+
+License: GPL-2+
+ This package is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+ .
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
+
+License: GPL-2
+ This package is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, version 2 of the License.
+ .
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
+
+License: GPL-3+
+ This package is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+ .
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
+
+
+License: LGPL-3+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+ .
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Lesser General Public License for more details.
+ .
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU Lesser General
+ Public License version 3 can be found in "/usr/share/common-licenses/LGPL-3".
+
+
+License: AGPL-3+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+ .
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU Affero General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
diff --git a/debian/libosmocodec-doc.doc-base b/debian/libosmocodec-doc.doc-base
new file mode 100644
index 0000000..8480c73
--- /dev/null
+++ b/debian/libosmocodec-doc.doc-base
@@ -0,0 +1,7 @@
+Document: libosmocodec-doc
+Title: Documentation for the libosmocodec library
+Section: Programming
+
+Format: HTML
+Index: /usr/share/doc/libosmocore/codec/html/index.html
+Files: /usr/share/doc/libosmocore/codec/html/*.html
diff --git a/debian/libosmocodec-doc.install b/debian/libosmocodec-doc.install
new file mode 100644
index 0000000..be0255b
--- /dev/null
+++ b/debian/libosmocodec-doc.install
@@ -0,0 +1 @@
+usr/share/doc/libosmocore/codec/
diff --git a/debian/libosmocodec-doc.lintian-overrides b/debian/libosmocodec-doc.lintian-overrides
new file mode 100644
index 0000000..526d4f9
--- /dev/null
+++ b/debian/libosmocodec-doc.lintian-overrides
@@ -0,0 +1,2 @@
+# jquery.js is generated by doxygen. See http://bugs.debian.org/736360
+libosmocodec-doc binary: embedded-javascript-library usr/share/doc/libosmocore/codec/html/jquery.js please use libjs-jquery
diff --git a/debian/libosmocore-dev.install b/debian/libosmocore-dev.install
index 7c5a789..465f933 100644
--- a/debian/libosmocore-dev.install
+++ b/debian/libosmocore-dev.install
@@ -3,4 +3,3 @@ usr/lib/*/lib*.a
 usr/lib/*/lib*.so
 usr/lib/*/lib*.la
 usr/lib/*/pkgconfig/*
-usr/share/doc/libosmocore/*
diff --git a/debian/libosmocore-doc.doc-base b/debian/libosmocore-doc.doc-base
new file mode 100644
index 0000000..b13b82d
--- /dev/null
+++ b/debian/libosmocore-doc.doc-base
@@ -0,0 +1,7 @@
+Document: libosmocore-doc
+Title: Documentation for the libosmocore library
+Section: Programming
+
+Format: HTML
+Index: /usr/share/doc/libosmocore/core/html/index.html
+Files: /usr/share/doc/libosmocore/core/html/*.html
diff --git a/debian/libosmocore-doc.install b/debian/libosmocore-doc.install
new file mode 100644
index 0000000..fe4cb26
--- /dev/null
+++ b/debian/libosmocore-doc.install
@@ -0,0 +1 @@
+usr/share/doc/libosmocore/core/
diff --git a/debian/libosmocore-doc.lintian-overrides b/debian/libosmocore-doc.lintian-overrides
new file mode 100644
index 0000000..345e48d
--- /dev/null
+++ b/debian/libosmocore-doc.lintian-overrides
@@ -0,0 +1,2 @@
+# jquery.js is generated by doxygen. See http://bugs.debian.org/736360
+libosmocore-doc binary: embedded-javascript-library usr/share/doc/libosmocore/core/html/jquery.js please use libjs-jquery
diff --git a/debian/libosmocore-utils.manpages b/debian/libosmocore-utils.manpages
new file mode 100644
index 0000000..13cdaf4
--- /dev/null
+++ b/debian/libosmocore-utils.manpages
@@ -0,0 +1 @@
+debian/man/*.1
diff --git a/debian/libosmogsm-doc.doc-base b/debian/libosmogsm-doc.doc-base
new file mode 100644
index 0000000..6318c1d
--- /dev/null
+++ b/debian/libosmogsm-doc.doc-base
@@ -0,0 +1,7 @@
+Document: libosmogsm-doc
+Title: Documentation for the libosmogsm library
+Section: Programming
+
+Format: HTML
+Index: /usr/share/doc/libosmocore/gsm/html/index.html
+Files: /usr/share/doc/libosmocore/gsm/html/*.html
diff --git a/debian/libosmogsm-doc.install b/debian/libosmogsm-doc.install
new file mode 100644
index 0000000..a4300bc
--- /dev/null
+++ b/debian/libosmogsm-doc.install
@@ -0,0 +1 @@
+usr/share/doc/libosmocore/gsm/
diff --git a/debian/libosmogsm-doc.lintian-overrides b/debian/libosmogsm-doc.lintian-overrides
new file mode 100644
index 0000000..2db0404
--- /dev/null
+++ b/debian/libosmogsm-doc.lintian-overrides
@@ -0,0 +1,2 @@
+# jquery.js is generated by doxygen. See http://bugs.debian.org/736360
+libosmogsm-doc binary: embedded-javascript-library usr/share/doc/libosmocore/gsm/html/jquery.js please use libjs-jquery
diff --git a/debian/libosmovty-doc.doc-base b/debian/libosmovty-doc.doc-base
new file mode 100644
index 0000000..dde189c
--- /dev/null
+++ b/debian/libosmovty-doc.doc-base
@@ -0,0 +1,7 @@
+Document: libosmovty-doc
+Title: Documentation for the libosmovty library
+Section: Programming
+
+Format: HTML
+Index: /usr/share/doc/libosmocore/vty/html/index.html
+Files: /usr/share/doc/libosmocore/vty/html/*.html
diff --git a/debian/libosmovty-doc.install b/debian/libosmovty-doc.install
new file mode 100644
index 0000000..634ba41
--- /dev/null
+++ b/debian/libosmovty-doc.install
@@ -0,0 +1 @@
+usr/share/doc/libosmocore/vty/
diff --git a/debian/libosmovty-doc.lintian-overrides b/debian/libosmovty-doc.lintian-overrides
new file mode 100644
index 0000000..c10975e
--- /dev/null
+++ b/debian/libosmovty-doc.lintian-overrides
@@ -0,0 +1,2 @@
+# jquery.js is generated by doxygen. See http://bugs.debian.org/736360
+libosmovty-doc binary: embedded-javascript-library usr/share/doc/libosmocore/vty/html/jquery.js please use libjs-jquery
diff --git a/debian/rules b/debian/rules
index 3cce05e..42222b2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -12,6 +12,10 @@
 DEBIAN  := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2)
 DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1)
 VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g')
+CHANGELOG_DATE := $(shell LC_ALL=C date -u -d "`dpkg-parsechangelog --show-field Date`" +"%d %B %Y")
+
+export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
 # Our tests want to override symbols, make it possible on Ubuntu
 export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS | sed -e 's/-Wl,-Bsymbolic-functions//')
@@ -38,3 +42,27 @@ override_dh_autoreconf:
 
 override_dh_auto_configure:
 	dh_auto_configure -- --enable-static
+
+override_dh_clean:
+	dh_clean
+	$(RM) .version
+	$(RM) debian/man/osmo-arfcn.1
+	$(RM) debian/man/osmo-auc-gen.1
+	$(RM) include/osmocom/core/bit16gen.h
+	$(RM) include/osmocom/core/bit32gen.h
+	$(RM) include/osmocom/core/bit64gen.h
+	$(RM) include/osmocom/core/crc16gen.h
+	$(RM) include/osmocom/core/crc32gen.h
+	$(RM) include/osmocom/core/crc64gen.h
+	$(RM) include/osmocom/core/crc8gen.h
+	$(RM) src/crc16gen.c
+	$(RM) src/crc32gen.c
+	$(RM) src/crc64gen.c
+	$(RM) src/crc8gen.c
+	$(RM) tests/package.m4
+	$(RM) tests/testsuite
+	$(RM) -r doc/codec/
+	$(RM) -r doc/core/
+	$(RM) -r doc/gsm/
+	$(RM) -r doc/vty/html/
+	$(RM) -r doc/vty/latex/
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..efce4b8
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,2 @@
+version=3
+https://github.com/osmocom/libosmocore/releases /osmocom/libosmocore/archive/(\d\S+)\.tar\.(?:bz2|gz|xz)
