create libosmoisdn sub-library

There are some parts of libosmogsm which are not really GSM specific,
but rather ISDN bits that were inherited by GSM.  This includes the
I.460 multiplex as well as the core LAPD protocol.

Let's move those bits to its own libosmoisdn library, before we add
more ISDN specific bits to the wrong place.

Backwards-compatibility is created by making libosmogsm depend on
libosmoisdn, and by providing wrapper include files for source
compatibility.

Change-Id: Ib1a6c762322fd5047be3188b1df22408ef06aa50
diff --git a/Makefile.am b/Makefile.am
index 48d6e9b..e57b022 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,7 +12,7 @@
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libosmocore.pc libosmocodec.pc libosmovty.pc libosmogsm.pc \
 		 libosmogb.pc libosmoctrl.pc libosmocoding.pc libosmosim.pc \
-		 libosmousb.pc
+		 libosmousb.pc libosmoisdn.pc
 
 aclocaldir = $(datadir)/aclocal
 dist_aclocal_DATA = m4/osmo_ac_code_coverage.m4 \
@@ -47,6 +47,7 @@
 HTML = \
 	$(top_builddir)/doc/core/html/index.html \
 	$(top_builddir)/doc/gsm/html/index.html \
+	$(top_builddir)/doc/isdn/html/index.html \
 	$(top_builddir)/doc/vty/html/index.html \
 	$(top_builddir)/doc/codec/html/index.html \
 	$(top_builddir)/doc/coding/html/index.html \
@@ -100,6 +101,14 @@
 	-$(DOXYGEN) $(top_builddir)/Doxyfile.gsm
 	touch "$@"
 
+$(top_builddir)/doc/libosmoisdn.tag.prep: $(top_builddir)/Doxyfile.isdn \
+		$(top_srcdir)/include/osmocom/isdn/*.h \
+		$(top_srcdir)/src/isdn/*.c
+	rm -rf $(top_builddir)/doc/isdn; mkdir -p $(top_builddir)/doc/isdn
+	rm -rf $(top_builddir)/doc/libosmoisdn.map
+	-$(DOXYGEN) $(top_builddir)/Doxyfile.isdn
+	touch "$@"
+
 # Don't delete the entire doc/vty, it contains example.xml and vtydoc.xsd (OS#3986)
 $(top_builddir)/doc/libosmovty.tag.prep: $(top_builddir)/Doxyfile.vty \
 		$(top_srcdir)/include/osmocom/vty/*.h \
@@ -155,6 +164,7 @@
 
 $(top_builddir)/doc/core/html/index.html: $(top_builddir)/doc/libosmocore.tag.prep \
 		$(top_builddir)/doc/libosmogsm.tag.prep \
+		$(top_builddir)/doc/libosmoisdn.tag.prep \
 		$(top_builddir)/doc/libosmovty.tag.prep \
 		$(top_builddir)/doc/libosmocodec.tag.prep \
 		$(top_builddir)/doc/libosmocoding.tag.prep \
@@ -165,6 +175,7 @@
 
 $(top_builddir)/doc/gsm/html/index.html: $(top_builddir)/doc/libosmogsm.tag.prep \
 		$(top_builddir)/doc/libosmocore.tag.prep \
+		$(top_builddir)/doc/libosmoisdn.tag.prep \
 		$(top_builddir)/doc/libosmovty.tag.prep \
 		$(top_builddir)/doc/libosmocodec.tag.prep \
 		$(top_builddir)/doc/libosmocoding.tag.prep \
@@ -173,10 +184,22 @@
 	rm -rf $(top_builddir)/doc/gsm; mkdir -p $(top_builddir)/doc/gsm
 	$(DOXYGEN) Doxyfile.gsm
 
+$(top_builddir)/doc/isdn/html/index.html: $(top_builddir)/doc/libosmoisdn.tag.prep \
+		$(top_builddir)/doc/libosmocore.tag.prep \
+		$(top_builddir)/doc/libosmogsm.tag.prep \
+		$(top_builddir)/doc/libosmovty.tag.prep \
+		$(top_builddir)/doc/libosmocodec.tag.prep \
+		$(top_builddir)/doc/libosmocoding.tag.prep \
+		$(top_builddir)/doc/libosmoctrl.tag.prep \
+		$(top_builddir)/doc/libosmogb.tag.prep
+	rm -rf $(top_builddir)/doc/isdn; mkdir -p $(top_builddir)/doc/isdn
+	$(DOXYGEN) Doxyfile.isdn
+
 # Don't delete the entire doc/vty, it contains example.xml and vtydoc.xsd (OS#3986)
 $(top_builddir)/doc/vty/html/index.html: $(top_builddir)/doc/libosmovty.tag.prep \
 		$(top_builddir)/doc/libosmocore.tag.prep \
 		$(top_builddir)/doc/libosmogsm.tag.prep \
+		$(top_builddir)/doc/libosmoisdn.tag.prep \
 		$(top_builddir)/doc/libosmocodec.tag.prep \
 		$(top_builddir)/doc/libosmocoding.tag.prep \
 		$(top_builddir)/doc/libosmoctrl.tag.prep \
@@ -187,6 +210,7 @@
 $(top_builddir)/doc/codec/html/index.html: $(top_builddir)/doc/libosmocodec.tag.prep \
 		$(top_builddir)/doc/libosmocore.tag.prep \
 		$(top_builddir)/doc/libosmogsm.tag.prep \
+		$(top_builddir)/doc/libosmoisdn.tag.prep \
 		$(top_builddir)/doc/libosmovty.tag.prep \
 		$(top_builddir)/doc/libosmocoding.tag.prep \
 		$(top_builddir)/doc/libosmoctrl.tag.prep \
@@ -197,6 +221,7 @@
 $(top_builddir)/doc/coding/html/index.html: $(top_builddir)/doc/libosmocoding.tag.prep \
 		$(top_builddir)/doc/libosmocore.tag.prep \
 		$(top_builddir)/doc/libosmogsm.tag.prep \
+		$(top_builddir)/doc/libosmoisdn.tag.prep \
 		$(top_builddir)/doc/libosmovty.tag.prep \
 		$(top_builddir)/doc/libosmocodec.tag.prep \
 		$(top_builddir)/doc/libosmoctrl.tag.prep \
@@ -207,6 +232,7 @@
 $(top_builddir)/doc/ctrl/html/index.html: $(top_builddir)/doc/libosmoctrl.tag.prep \
 		$(top_builddir)/doc/libosmocore.tag.prep \
 		$(top_builddir)/doc/libosmogsm.tag.prep \
+		$(top_builddir)/doc/libosmoisdn.tag.prep \
 		$(top_builddir)/doc/libosmovty.tag.prep \
 		$(top_builddir)/doc/libosmocodec.tag.prep \
 		$(top_builddir)/doc/libosmocoding.tag.prep \
@@ -217,6 +243,7 @@
 $(top_builddir)/doc/gb/html/index.html: $(top_builddir)/doc/libosmogb.tag.prep \
 		$(top_builddir)/doc/libosmocore.tag.prep \
 		$(top_builddir)/doc/libosmogsm.tag.prep \
+		$(top_builddir)/doc/libosmoisdn.tag.prep \
 		$(top_builddir)/doc/libosmovty.tag.prep \
 		$(top_builddir)/doc/libosmocodec.tag.prep \
 		$(top_builddir)/doc/libosmocoding.tag.prep \
@@ -229,9 +256,9 @@
 	cd $(DESTDIR)$(htmldir) && tar xf html.tar && rm -f html.tar
 
 uninstall-hook:
-	cd $(DESTDIR)$(htmldir) && rm -rf {core,gsm,vty,codec,coding,ctrl,gb}
+	cd $(DESTDIR)$(htmldir) && rm -rf {core,gsm,isdn,vty,codec,coding,ctrl,gb}
 
-DX_CLEAN = doc/{core,gsm,vty,codec,coding,ctrl,gb}/html/search/* doc/{core,gsm,vty,codec,coding,ctrl,gb}/{html,latex}/* doc/html.tar doc/{core,gsm,vty,codec,coding,ctrl,gb}/doxygen_sqlite3.db doc/*.tag doc/*.tag.prep
+DX_CLEAN = doc/{core,gsm,isdn,vty,codec,coding,ctrl,gb}/html/search/* doc/{core,gsm,isdn,vty,codec,coding,ctrl,gb}/{html,latex}/* doc/html.tar doc/{core,gsm,isdn,vty,codec,coding,ctrl,gb}/doxygen_sqlite3.db doc/*.tag doc/*.tag.prep
 endif
 
 MOSTLYCLEANFILES = $(DX_CLEAN)