This patch requires the appropriate git-subtree magic to include the new
proposed libosmo-gsm into osmocom-bb (as it happens with libosmocore).
build: use new libosmo-gsm library

From: Pablo Neira Ayuso <[email protected]>

With this patch, osmocom-bb uses the new libosmo-gsm library (which
came from extracting the GSM-specific features from libosmocore).

Make sure that you add libosmo-gsm via git-sub-tree if you apply
this patch.

Signed-off-by: Pablo Neira Ayuso <[email protected]>
---
 src/Makefile                     |   49 +++++++++++++++++++++++++++++++++-----
 src/shared/update-libosmocore.sh |    1 +
 2 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index b3594c1..77f597e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -9,11 +9,13 @@ CROSS_TOOL_PREFIX=arm-elf-
 TOPDIR=$(shell pwd)
 OSMOCORE_CONFIGURE_ENV= LIBOSMOCORE_LIBS=$(TOPDIR)/shared/libosmocore/build-host/src/.libs/libosmocore.a \
                         LIBOSMOVTY_LIBS=$(TOPDIR)/shared/libosmocore/build-host/src/vty/.libs/libosmovty.a \
+			LIBOSMOGSM_LIBS=$(TOPDIR)/shared/libosmo-gsm/build-host/src/.libs/libosmo-gsm.a \
 	 	    	LIBOSMOCORE_CFLAGS=-I$(TOPDIR)/shared/libosmocore/include \
-	 	    	LIBOSMOVTY_CFLAGS=-I$(TOPDIR)/shared/libosmocore/include
+	 	    	LIBOSMOVTY_CFLAGS=-I$(TOPDIR)/shared/libosmocore/include \
+	 	    	LIBOSMOGSM_CFLAGS=-I$(TOPDIR)/shared/libosmo-gsm/include
 
-all: libosmocore-target nofirmware firmware
-nofirmware: libosmocore-host layer23 osmocon gsmmap
+all: libosmocore-target libosmo-gsm-target nofirmware firmware
+nofirmware: libosmocore-host libosmo-gsm-host layer23 osmocon gsmmap
 
 libosmocore-host: shared/libosmocore/build-host/src/.libs/libosmocore.la
 
@@ -44,6 +46,35 @@ shared/libosmocore/build-target/Makefile: shared/libosmocore/configure shared/li
 shared/libosmocore/build-target/src/.libs/libosmocore.a: shared/libosmocore/build-target/Makefile
 	cd shared/libosmocore/build-target && make
 
+libosmo-gsm-host: shared/libosmo-gsm/build-host/src/.libs/libosmo-gsm.la
+
+shared/libosmo-gsm/build-host:
+	mkdir $@
+
+shared/libosmo-gsm/configure: shared/libosmo-gsm/configure.in
+	cd shared/libosmo-gsm && autoreconf -i
+
+shared/libosmo-gsm/build-host/Makefile: shared/libosmo-gsm/configure shared/libosmo-gsm/build-host
+	cd shared/libosmo-gsm/build-host && ../configure $(HOST_CONFARGS)
+
+shared/libosmo-gsm/build-host/src/.libs/libosmo-gsm.la: shared/libosmo-gsm/build-host/Makefile
+	cd shared/libosmo-gsm/build-host && make
+
+
+libosmo-gsm-target: shared/libosmo-gsm/build-target/src/.libs/libosmo-gsm.a
+
+shared/libosmo-gsm/build-target:
+	mkdir $@
+
+shared/libosmo-gsm/build-target/Makefile: shared/libosmo-gsm/configure shared/libosmo-gsm/build-target
+	cd shared/libosmo-gsm/build-target && ../configure \
+			--host=arm-elf-linux \
+			--disable-shared --disable-tests \
+		CC="$(CROSS_TOOL_PREFIX)gcc" CFLAGS="-Os -ffunction-sections -I$(TOPDIR)/target/firmware/include -I$(TOPDIR)/shared/libosmocore/include -nostartfiles -nodefaultlibs"
+
+shared/libosmo-gsm/build-target/src/.libs/libosmo-gsm.a: shared/libosmo-gsm/build-target/Makefile
+	cd shared/libosmo-gsm/build-target && make
+
 
 .PHONY: osmocon
 osmocon: host/osmocon/osmocon
@@ -54,7 +85,7 @@ host/osmocon/configure: host/osmocon/configure.ac
 host/osmocon/Makefile: host/osmocon/configure
 	cd host/osmocon && $(OSMOCORE_CONFIGURE_ENV) ./configure $(HOST_CONFARGS)
 
-host/osmocon/osmocon: host/osmocon/Makefile libosmocore-host
+host/osmocon/osmocon: host/osmocon/Makefile libosmocore-host libosmo-gsm-host
 	make -C host/osmocon
 
 
@@ -67,7 +98,7 @@ host/gsmmap/configure: host/gsmmap/configure.ac
 host/gsmmap/Makefile: host/gsmmap/configure
 	cd host/gsmmap && $(OSMOCORE_CONFIGURE_ENV) ./configure $(HOST_CONFARGS)
 
-host/gsmmap/gsmmap: host/gsmmap/Makefile libosmocore-host
+host/gsmmap/gsmmap: host/gsmmap/Makefile libosmocore-host libosmo-gsm-host
 	make -C host/gsmmap
 
 
@@ -80,18 +111,20 @@ host/layer23/configure: host/layer23/configure.ac
 host/layer23/Makefile: host/layer23/configure
 	cd host/layer23 && $(OSMOCORE_CONFIGURE_ENV) ./configure $(HOST_CONFARGS)
 
-host/layer23/layer23: host/layer23/Makefile libosmocore-host
+host/layer23/layer23: host/layer23/Makefile libosmocore-host libosmo-gsm-host
 	make -C host/layer23
 
 
 .PHONY: firmware
-firmware: libosmocore-target
+firmware: libosmocore-target libosmo-gsm-target
 	make -C target/firmware CROSS_COMPILE=$(CROSS_TOOL_PREFIX)
 
 
 clean:
 	make -C shared/libosmocore/build-host $@
 	make -C shared/libosmocore/build-target $@
+	make -C shared/libosmo-gsm/build-host $@
+	make -C shared/libosmo-gsm/build-target $@
 	make -C host/layer23 $@
 	make -C host/osmocon $@
 	make -C target/firmware $@
@@ -99,6 +132,8 @@ clean:
 distclean:
 	rm -rf shared/libosmocore/build-host
 	rm -rf shared/libosmocore/build-target
+	rm -rf shared/libosmo-gsm/build-host
+	rm -rf shared/libosmo-gsm/build-target
 	make -C host/layer23 $@
 	make -C host/osmocon $@
 	make -C target/firmware $@
diff --git a/src/shared/update-libosmocore.sh b/src/shared/update-libosmocore.sh
index e7940c3..b44018e 100755
--- a/src/shared/update-libosmocore.sh
+++ b/src/shared/update-libosmocore.sh
@@ -1,3 +1,4 @@
 #!/bin/sh
 
 (cd ../.. && git-subtree pull --prefix=src/shared/libosmocore git://git.osmocom.org/libosmocore.git master)
+(cd ../.. && git-subtree pull --prefix=src/shared/libosmo-gsm git://git.osmocom.org/libosmo-gsm.git master)

Reply via email to