Move src/*.{c,h} to src/core/

This way we have all libosmocore.so in an own subdir instead of having
lots of files in the parent dir, which also contains subdirs to other
libraries.
This also matches the schema under include/osmocom/.

Change-Id: I6c76fafebdd5e961aed88bbecd2c16bc69d580e2
diff --git a/Doxyfile.core.in b/Doxyfile.core.in
index c2bfcd5..29507e0 100644
--- a/Doxyfile.core.in
+++ b/Doxyfile.core.in
@@ -610,7 +610,7 @@
 # directories like "/usr/src/myproject". Separate the files or directories
 # with spaces.
 
-INPUT                  = @srcdir@/include/osmocom/core @srcdir@/src
+INPUT                  = @srcdir@/include/osmocom/core @srcdir@/src/core
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
diff --git a/Makefile.am b/Makefile.am
index b3663ba..4347807 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,15 +4,6 @@
 SUBDIRS = \
 	include \
 	src \
-	src/vty \
-	src/codec \
-	src/gsm \
-	src/coding \
-	src/gb \
-	src/ctrl \
-	src/sim \
-	src/pseudotalloc \
-	src/usb \
 	utils \
 	tapset \
 	tests \
@@ -90,8 +81,8 @@
 
 $(top_builddir)/doc/libosmocore.tag.prep: $(top_builddir)/Doxyfile.core \
 		$(top_srcdir)/include/osmocom/core/*.h \
-		$(top_srcdir)/src/*.[hc] \
-		$(top_srcdir)/src/crcXXgen.c.tpl \
+		$(top_srcdir)/src/core/*.[hc] \
+		$(top_srcdir)/src/core/crcXXgen.c.tpl \
 		$(top_srcdir)/src/pseudotalloc/*.[hc]
 	rm -rf $(top_builddir)/doc/core; mkdir -p $(top_builddir)/doc/core
 	rm -rf $(top_builddir)/doc/libosmocore.map
diff --git a/configure.ac b/configure.ac
index 3d9492e..5f70fca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -586,6 +586,7 @@
 	libosmousb.pc
 	include/Makefile
 	src/Makefile
+	src/core/Makefile
 	src/vty/Makefile
 	src/codec/Makefile
 	src/coding/Makefile
diff --git a/debian/copyright b/debian/copyright
index 79c5876..31a2946 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -13,23 +13,23 @@
 
 Files: include/osmocom/core/loggingrb.h
        include/osmocom/core/strrb.h
-       src/strrb.c
-       src/loggingrb.c
+       src/core/strrb.c
+       src/core/loggingrb.c
 Copyright: 2012-2013 Katerina Barone-Adesi <kat.obsc@gmail.com>
 License: GPL-2+
 
 Files: include/osmocom/core/linuxrbtree.h
-       src/rbtree.c
+       src/core/rbtree.c
 Copyright: 1999 Andrea Arcangeli <andrea@suse.de>
            2002 David Woodhouse <dwmw2@infradead.org>
 License: GPL-2+
 
 Files: include/osmocom/core/crc16.h
-       src/crc16.c
+       src/core/crc16.c
 Copyright: 2005 Ben Gardner <bgardner@wabtec.com>
 License: GPL-2
 
-Files: src/utils.c
+Files: src/core/utils.c
 Copyright: 2011 Harald Welte <laforge@gnumonks.org>
            2011 Sylvain Munaut <tnt@246tNt.com>
            2014 Nils O. Selåsdal <noselasd@fiane.dyndns.org>
@@ -100,8 +100,8 @@
 License: GPL-2+
 
 Files: include/osmocom/core/stats.h
-       src/stat_item.c
-       src/stats.c
+       src/core/stat_item.c
+       src/core/stats.c
        src/vty/stats_vty.c
        tests/stats/stats_test.c
 Copyright: 2009-2010 by Harald Welte <laforge@gnumonks.org>
diff --git a/src/Makefile.am b/src/Makefile.am
index 2c73af6..5d8343c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,108 +1,12 @@
-# This is _NOT_ the library release version, it's an API version.
-# Please read chapter "Library interface versions" of the libtool documentation
-# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html
-LIBVERSION=19:0:0
-
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
-AM_CFLAGS = -Wall $(TALLOC_CFLAGS) $(PTHREAD_CFLAGS) $(LIBSCTP_CFLAGS) $(LIBMNL_CFLAGS)
-
-if ENABLE_PSEUDOTALLOC
-AM_CPPFLAGS += -I$(top_srcdir)/src/pseudotalloc
-endif
-
-lib_LTLIBRARIES = libosmocore.la
-
-libosmocore_la_LIBADD = $(BACKTRACE_LIB) $(TALLOC_LIBS) $(LIBRARY_RT) $(PTHREAD_LIBS) $(LIBSCTP_LIBS)
-libosmocore_la_SOURCES = context.c timer.c timer_gettimeofday.c timer_clockgettime.c \
-			 select.c signal.c msgb.c bits.c \
-			 bitvec.c bitcomp.c counter.c fsm.c \
-			 write_queue.c utils.c socket.c \
-			 logging.c logging_syslog.c logging_gsmtap.c rate_ctr.c \
-			 gsmtap_util.c crc16.c panic.c backtrace.c \
-			 conv.c application.c rbtree.c strrb.c \
-			 loggingrb.c crc8gen.c crc16gen.c crc32gen.c crc64gen.c \
-			 macaddr.c stat_item.c stats.c stats_statsd.c prim.c \
-			 stats_tcp.c \
-			 conv_acc.c conv_acc_generic.c sercomm.c prbs.c \
-			 isdnhdlc.c \
-			 tdef.c \
-			 thread.c \
-			 time_cc.c \
-			 sockaddr_str.c \
-			 use_count.c \
-			 exec.c \
-			 it_q.c \
-			 probes.d \
-			 base64.c \
-			 $(NULL)
-
-if HAVE_SSSE3
-libosmocore_la_SOURCES += conv_acc_sse.c
-if HAVE_SSE4_1
-conv_acc_sse.lo : AM_CFLAGS += -mssse3 -msse4.1
-else
-conv_acc_sse.lo : AM_CFLAGS += -mssse3
-endif
-
-if HAVE_AVX2
-libosmocore_la_SOURCES += conv_acc_sse_avx.c
-if HAVE_SSE4_1
-conv_acc_sse_avx.lo : AM_CFLAGS += -mssse3 -mavx2 -msse4.1
-else
-conv_acc_sse_avx.lo : AM_CFLAGS += -mssse3 -mavx2
-endif
-endif
-endif
-
-if HAVE_NEON
-libosmocore_la_SOURCES += conv_acc_neon.c
-# conv_acc_neon.lo : AM_CFLAGS += -mfpu=neon no, could as well be vfp with neon
-endif
-
-BUILT_SOURCES = crc8gen.c crc16gen.c crc32gen.c crc64gen.c
-
-EXTRA_DIST = \
-	conv_acc_sse_impl.h \
-	conv_acc_neon_impl.h \
-	crcXXgen.c.tpl \
-	stat_item_internal.h \
-	$(NULL)
-
-libosmocore_la_LDFLAGS = -version-info $(LIBVERSION) -no-undefined
-
-if ENABLE_PLUGIN
-libosmocore_la_SOURCES += plugin.c
-libosmocore_la_LIBADD += $(LIBRARY_DLOPEN)
-endif
-
-if ENABLE_MSGFILE
-libosmocore_la_SOURCES += msgfile.c
-endif
-
-if ENABLE_SERIAL
-libosmocore_la_SOURCES += serial.c
-endif
-
-if ENABLE_SYSTEMD_LOGGING
-libosmocore_la_SOURCES += logging_systemd.c
-libosmocore_la_LIBADD += $(SYSTEMD_LIBS)
-endif
-
-if ENABLE_LIBMNL
-libosmocore_la_SOURCES += mnl.c
-libosmocore_la_LIBADD += $(LIBMNL_LIBS)
-endif
-
-if ENABLE_SYSTEMTAP
-probes.h: probes.d
-	$(DTRACE) -C -h -s $< -o $@
-
-probes.lo: probes.d
-	$(LIBTOOL) --mode=compile $(AM_V_lt) --tag=CC env CFLAGS="$(CFLAGS)" $(DTRACE) -C -G -s $< -o $@
-
-BUILT_SOURCES += probes.h probes.lo
-libosmocore_la_LIBADD += probes.lo
-endif
-
-crc%gen.c: crcXXgen.c.tpl
-	$(AM_V_GEN)sed -e's/XX/$*/g' $< > $@
+SUBDIRS = \
+	core \
+	vty \
+	codec \
+	gsm \
+	coding \
+	gb \
+	ctrl \
+	pseudotalloc \
+	sim \
+	usb \
+	$(NULL)
\ No newline at end of file
diff --git a/src/codec/Makefile.am b/src/codec/Makefile.am
index de8de1b..c16ce9a 100644
--- a/src/codec/Makefile.am
+++ b/src/codec/Makefile.am
@@ -15,4 +15,4 @@
 
 libosmocodec_la_SOURCES = gsm610.c gsm620.c gsm660.c gsm690.c ecu.c ecu_fr.c
 libosmocodec_la_LDFLAGS = -version-info $(LIBVERSION) -no-undefined
-libosmocodec_la_LIBADD = $(top_builddir)/src/libosmocore.la
+libosmocodec_la_LIBADD = $(top_builddir)/src/core/libosmocore.la
diff --git a/src/coding/Makefile.am b/src/coding/Makefile.am
index 5ce3cbf..d856918 100644
--- a/src/coding/Makefile.am
+++ b/src/coding/Makefile.am
@@ -27,9 +27,11 @@
 	$(LIBVERSION) \
 	-no-undefined \
 	$(TALLOC_LIBS)
+
 libosmocoding_la_LIBADD = \
-	../libosmocore.la \
-	../gsm/libosmogsm.la \
-	../codec/libosmocodec.la
+	$(top_builddir)/src/core/libosmocore.la \
+	$(top_builddir)/src/gsm/libosmogsm.la \
+	$(top_builddir)/src/codec/libosmocodec.la \
+	$(NULL)
 
 EXTRA_DIST = libosmocoding.map
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
new file mode 100644
index 0000000..2c73af6
--- /dev/null
+++ b/src/core/Makefile.am
@@ -0,0 +1,108 @@
+# This is _NOT_ the library release version, it's an API version.
+# Please read chapter "Library interface versions" of the libtool documentation
+# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html
+LIBVERSION=19:0:0
+
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
+AM_CFLAGS = -Wall $(TALLOC_CFLAGS) $(PTHREAD_CFLAGS) $(LIBSCTP_CFLAGS) $(LIBMNL_CFLAGS)
+
+if ENABLE_PSEUDOTALLOC
+AM_CPPFLAGS += -I$(top_srcdir)/src/pseudotalloc
+endif
+
+lib_LTLIBRARIES = libosmocore.la
+
+libosmocore_la_LIBADD = $(BACKTRACE_LIB) $(TALLOC_LIBS) $(LIBRARY_RT) $(PTHREAD_LIBS) $(LIBSCTP_LIBS)
+libosmocore_la_SOURCES = context.c timer.c timer_gettimeofday.c timer_clockgettime.c \
+			 select.c signal.c msgb.c bits.c \
+			 bitvec.c bitcomp.c counter.c fsm.c \
+			 write_queue.c utils.c socket.c \
+			 logging.c logging_syslog.c logging_gsmtap.c rate_ctr.c \
+			 gsmtap_util.c crc16.c panic.c backtrace.c \
+			 conv.c application.c rbtree.c strrb.c \
+			 loggingrb.c crc8gen.c crc16gen.c crc32gen.c crc64gen.c \
+			 macaddr.c stat_item.c stats.c stats_statsd.c prim.c \
+			 stats_tcp.c \
+			 conv_acc.c conv_acc_generic.c sercomm.c prbs.c \
+			 isdnhdlc.c \
+			 tdef.c \
+			 thread.c \
+			 time_cc.c \
+			 sockaddr_str.c \
+			 use_count.c \
+			 exec.c \
+			 it_q.c \
+			 probes.d \
+			 base64.c \
+			 $(NULL)
+
+if HAVE_SSSE3
+libosmocore_la_SOURCES += conv_acc_sse.c
+if HAVE_SSE4_1
+conv_acc_sse.lo : AM_CFLAGS += -mssse3 -msse4.1
+else
+conv_acc_sse.lo : AM_CFLAGS += -mssse3
+endif
+
+if HAVE_AVX2
+libosmocore_la_SOURCES += conv_acc_sse_avx.c
+if HAVE_SSE4_1
+conv_acc_sse_avx.lo : AM_CFLAGS += -mssse3 -mavx2 -msse4.1
+else
+conv_acc_sse_avx.lo : AM_CFLAGS += -mssse3 -mavx2
+endif
+endif
+endif
+
+if HAVE_NEON
+libosmocore_la_SOURCES += conv_acc_neon.c
+# conv_acc_neon.lo : AM_CFLAGS += -mfpu=neon no, could as well be vfp with neon
+endif
+
+BUILT_SOURCES = crc8gen.c crc16gen.c crc32gen.c crc64gen.c
+
+EXTRA_DIST = \
+	conv_acc_sse_impl.h \
+	conv_acc_neon_impl.h \
+	crcXXgen.c.tpl \
+	stat_item_internal.h \
+	$(NULL)
+
+libosmocore_la_LDFLAGS = -version-info $(LIBVERSION) -no-undefined
+
+if ENABLE_PLUGIN
+libosmocore_la_SOURCES += plugin.c
+libosmocore_la_LIBADD += $(LIBRARY_DLOPEN)
+endif
+
+if ENABLE_MSGFILE
+libosmocore_la_SOURCES += msgfile.c
+endif
+
+if ENABLE_SERIAL
+libosmocore_la_SOURCES += serial.c
+endif
+
+if ENABLE_SYSTEMD_LOGGING
+libosmocore_la_SOURCES += logging_systemd.c
+libosmocore_la_LIBADD += $(SYSTEMD_LIBS)
+endif
+
+if ENABLE_LIBMNL
+libosmocore_la_SOURCES += mnl.c
+libosmocore_la_LIBADD += $(LIBMNL_LIBS)
+endif
+
+if ENABLE_SYSTEMTAP
+probes.h: probes.d
+	$(DTRACE) -C -h -s $< -o $@
+
+probes.lo: probes.d
+	$(LIBTOOL) --mode=compile $(AM_V_lt) --tag=CC env CFLAGS="$(CFLAGS)" $(DTRACE) -C -G -s $< -o $@
+
+BUILT_SOURCES += probes.h probes.lo
+libosmocore_la_LIBADD += probes.lo
+endif
+
+crc%gen.c: crcXXgen.c.tpl
+	$(AM_V_GEN)sed -e's/XX/$*/g' $< > $@
diff --git a/src/application.c b/src/core/application.c
similarity index 100%
rename from src/application.c
rename to src/core/application.c
diff --git a/src/backtrace.c b/src/core/backtrace.c
similarity index 100%
rename from src/backtrace.c
rename to src/core/backtrace.c
diff --git a/src/base64.c b/src/core/base64.c
similarity index 100%
rename from src/base64.c
rename to src/core/base64.c
diff --git a/src/bitcomp.c b/src/core/bitcomp.c
similarity index 100%
rename from src/bitcomp.c
rename to src/core/bitcomp.c
diff --git a/src/bits.c b/src/core/bits.c
similarity index 100%
rename from src/bits.c
rename to src/core/bits.c
diff --git a/src/bitvec.c b/src/core/bitvec.c
similarity index 100%
rename from src/bitvec.c
rename to src/core/bitvec.c
diff --git a/src/context.c b/src/core/context.c
similarity index 100%
rename from src/context.c
rename to src/core/context.c
diff --git a/src/conv.c b/src/core/conv.c
similarity index 100%
rename from src/conv.c
rename to src/core/conv.c
diff --git a/src/conv_acc.c b/src/core/conv_acc.c
similarity index 100%
rename from src/conv_acc.c
rename to src/core/conv_acc.c
diff --git a/src/conv_acc_generic.c b/src/core/conv_acc_generic.c
similarity index 100%
rename from src/conv_acc_generic.c
rename to src/core/conv_acc_generic.c
diff --git a/src/conv_acc_neon.c b/src/core/conv_acc_neon.c
similarity index 100%
rename from src/conv_acc_neon.c
rename to src/core/conv_acc_neon.c
diff --git a/src/conv_acc_neon_impl.h b/src/core/conv_acc_neon_impl.h
similarity index 100%
rename from src/conv_acc_neon_impl.h
rename to src/core/conv_acc_neon_impl.h
diff --git a/src/conv_acc_sse.c b/src/core/conv_acc_sse.c
similarity index 100%
rename from src/conv_acc_sse.c
rename to src/core/conv_acc_sse.c
diff --git a/src/conv_acc_sse_avx.c b/src/core/conv_acc_sse_avx.c
similarity index 100%
rename from src/conv_acc_sse_avx.c
rename to src/core/conv_acc_sse_avx.c
diff --git a/src/conv_acc_sse_impl.h b/src/core/conv_acc_sse_impl.h
similarity index 100%
rename from src/conv_acc_sse_impl.h
rename to src/core/conv_acc_sse_impl.h
diff --git a/src/counter.c b/src/core/counter.c
similarity index 100%
rename from src/counter.c
rename to src/core/counter.c
diff --git a/src/crc16.c b/src/core/crc16.c
similarity index 100%
rename from src/crc16.c
rename to src/core/crc16.c
diff --git a/src/crcXXgen.c.tpl b/src/core/crcXXgen.c.tpl
similarity index 100%
rename from src/crcXXgen.c.tpl
rename to src/core/crcXXgen.c.tpl
diff --git a/src/exec.c b/src/core/exec.c
similarity index 100%
rename from src/exec.c
rename to src/core/exec.c
diff --git a/src/fsm.c b/src/core/fsm.c
similarity index 100%
rename from src/fsm.c
rename to src/core/fsm.c
diff --git a/src/gsmtap_util.c b/src/core/gsmtap_util.c
similarity index 100%
rename from src/gsmtap_util.c
rename to src/core/gsmtap_util.c
diff --git a/src/isdnhdlc.c b/src/core/isdnhdlc.c
similarity index 100%
rename from src/isdnhdlc.c
rename to src/core/isdnhdlc.c
diff --git a/src/it_q.c b/src/core/it_q.c
similarity index 100%
rename from src/it_q.c
rename to src/core/it_q.c
diff --git a/src/logging.c b/src/core/logging.c
similarity index 100%
rename from src/logging.c
rename to src/core/logging.c
diff --git a/src/logging_gsmtap.c b/src/core/logging_gsmtap.c
similarity index 100%
rename from src/logging_gsmtap.c
rename to src/core/logging_gsmtap.c
diff --git a/src/logging_syslog.c b/src/core/logging_syslog.c
similarity index 100%
rename from src/logging_syslog.c
rename to src/core/logging_syslog.c
diff --git a/src/logging_systemd.c b/src/core/logging_systemd.c
similarity index 100%
rename from src/logging_systemd.c
rename to src/core/logging_systemd.c
diff --git a/src/loggingrb.c b/src/core/loggingrb.c
similarity index 100%
rename from src/loggingrb.c
rename to src/core/loggingrb.c
diff --git a/src/macaddr.c b/src/core/macaddr.c
similarity index 100%
rename from src/macaddr.c
rename to src/core/macaddr.c
diff --git a/src/mnl.c b/src/core/mnl.c
similarity index 100%
rename from src/mnl.c
rename to src/core/mnl.c
diff --git a/src/msgb.c b/src/core/msgb.c
similarity index 100%
rename from src/msgb.c
rename to src/core/msgb.c
diff --git a/src/msgfile.c b/src/core/msgfile.c
similarity index 100%
rename from src/msgfile.c
rename to src/core/msgfile.c
diff --git a/src/panic.c b/src/core/panic.c
similarity index 100%
rename from src/panic.c
rename to src/core/panic.c
diff --git a/src/plugin.c b/src/core/plugin.c
similarity index 100%
rename from src/plugin.c
rename to src/core/plugin.c
diff --git a/src/prbs.c b/src/core/prbs.c
similarity index 100%
rename from src/prbs.c
rename to src/core/prbs.c
diff --git a/src/prim.c b/src/core/prim.c
similarity index 100%
rename from src/prim.c
rename to src/core/prim.c
diff --git a/src/probes.d b/src/core/probes.d
similarity index 100%
rename from src/probes.d
rename to src/core/probes.d
diff --git a/src/rate_ctr.c b/src/core/rate_ctr.c
similarity index 100%
rename from src/rate_ctr.c
rename to src/core/rate_ctr.c
diff --git a/src/rbtree.c b/src/core/rbtree.c
similarity index 100%
rename from src/rbtree.c
rename to src/core/rbtree.c
diff --git a/src/select.c b/src/core/select.c
similarity index 100%
rename from src/select.c
rename to src/core/select.c
diff --git a/src/sercomm.c b/src/core/sercomm.c
similarity index 100%
rename from src/sercomm.c
rename to src/core/sercomm.c
diff --git a/src/serial.c b/src/core/serial.c
similarity index 100%
rename from src/serial.c
rename to src/core/serial.c
diff --git a/src/signal.c b/src/core/signal.c
similarity index 100%
rename from src/signal.c
rename to src/core/signal.c
diff --git a/src/sockaddr_str.c b/src/core/sockaddr_str.c
similarity index 100%
rename from src/sockaddr_str.c
rename to src/core/sockaddr_str.c
diff --git a/src/socket.c b/src/core/socket.c
similarity index 100%
rename from src/socket.c
rename to src/core/socket.c
diff --git a/src/stat_item.c b/src/core/stat_item.c
similarity index 100%
rename from src/stat_item.c
rename to src/core/stat_item.c
diff --git a/src/stat_item_internal.h b/src/core/stat_item_internal.h
similarity index 100%
rename from src/stat_item_internal.h
rename to src/core/stat_item_internal.h
diff --git a/src/stats.c b/src/core/stats.c
similarity index 100%
rename from src/stats.c
rename to src/core/stats.c
diff --git a/src/stats_statsd.c b/src/core/stats_statsd.c
similarity index 100%
rename from src/stats_statsd.c
rename to src/core/stats_statsd.c
diff --git a/src/stats_tcp.c b/src/core/stats_tcp.c
similarity index 100%
rename from src/stats_tcp.c
rename to src/core/stats_tcp.c
diff --git a/src/strrb.c b/src/core/strrb.c
similarity index 100%
rename from src/strrb.c
rename to src/core/strrb.c
diff --git a/src/tdef.c b/src/core/tdef.c
similarity index 100%
rename from src/tdef.c
rename to src/core/tdef.c
diff --git a/src/thread.c b/src/core/thread.c
similarity index 100%
rename from src/thread.c
rename to src/core/thread.c
diff --git a/src/time_cc.c b/src/core/time_cc.c
similarity index 100%
rename from src/time_cc.c
rename to src/core/time_cc.c
diff --git a/src/timer.c b/src/core/timer.c
similarity index 100%
rename from src/timer.c
rename to src/core/timer.c
diff --git a/src/timer_clockgettime.c b/src/core/timer_clockgettime.c
similarity index 100%
rename from src/timer_clockgettime.c
rename to src/core/timer_clockgettime.c
diff --git a/src/timer_gettimeofday.c b/src/core/timer_gettimeofday.c
similarity index 100%
rename from src/timer_gettimeofday.c
rename to src/core/timer_gettimeofday.c
diff --git a/src/use_count.c b/src/core/use_count.c
similarity index 100%
rename from src/use_count.c
rename to src/core/use_count.c
diff --git a/src/utils.c b/src/core/utils.c
similarity index 100%
rename from src/utils.c
rename to src/core/utils.c
diff --git a/src/write_queue.c b/src/core/write_queue.c
similarity index 100%
rename from src/write_queue.c
rename to src/core/write_queue.c
diff --git a/src/ctrl/Makefile.am b/src/ctrl/Makefile.am
index e53594d..f149acb 100644
--- a/src/ctrl/Makefile.am
+++ b/src/ctrl/Makefile.am
@@ -13,7 +13,7 @@
 
 libosmoctrl_la_LDFLAGS = $(LTLDFLAGS_OSMOCTRL) -version-info $(LIBVERSION) -no-undefined
 libosmoctrl_la_LIBADD = $(TALLOC_LIBS) \
-	$(top_builddir)/src/libosmocore.la \
+	$(top_builddir)/src/core/libosmocore.la \
 	$(top_builddir)/src/gsm/libosmogsm.la \
 	$(top_builddir)/src/vty/libosmovty.la
 
diff --git a/src/gb/Makefile.am b/src/gb/Makefile.am
index f3bbcfb..32a03c8 100644
--- a/src/gb/Makefile.am
+++ b/src/gb/Makefile.am
@@ -21,7 +21,7 @@
 		-no-undefined \
 		$(NULL)
 libosmogb_la_LIBADD = $(TALLOC_LIBS) \
-		$(top_builddir)/src/libosmocore.la \
+		$(top_builddir)/src/core/libosmocore.la \
 		$(top_builddir)/src/vty/libosmovty.la \
 		$(top_builddir)/src/gsm/libosmogsm.la
 
diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am
index 0d66476..eb0f7e4 100644
--- a/src/gsm/Makefile.am
+++ b/src/gsm/Makefile.am
@@ -36,7 +36,7 @@
 			gad.c bsslap.c bssmap_le.c kdf.c iuup.c
 
 libgsmint_la_LDFLAGS = -no-undefined
-libgsmint_la_LIBADD = $(top_builddir)/src/libosmocore.la
+libgsmint_la_LIBADD = $(top_builddir)/src/core/libosmocore.la
 
 libosmogsm_la_SOURCES =
 libosmogsm_la_LDFLAGS = $(LTLDFLAGS_OSMOGSM) -version-info $(LIBVERSION) -no-undefined
diff --git a/src/sim/Makefile.am b/src/sim/Makefile.am
index 3d30506..4ef4490 100644
--- a/src/sim/Makefile.am
+++ b/src/sim/Makefile.am
@@ -20,7 +20,7 @@
 	-no-undefined \
 	$(NULL)
 libosmosim_la_LIBADD = \
-	$(top_builddir)/src/libosmocore.la \
+	$(top_builddir)/src/core/libosmocore.la \
 	$(top_builddir)/src/gsm/libosmogsm.la \
 	$(TALLOC_LIBS)
 if ENABLE_PCSC
diff --git a/src/usb/Makefile.am b/src/usb/Makefile.am
index a1426f9..c8e557b 100644
--- a/src/usb/Makefile.am
+++ b/src/usb/Makefile.am
@@ -17,7 +17,7 @@
 	-no-undefined \
 	$(NULL)
 libosmousb_la_LIBADD = \
-	$(top_builddir)/src/libosmocore.la \
+	$(top_builddir)/src/core/libosmocore.la \
 	$(TALLOC_LIBS) \
 	$(LIBUSB_LIBS)
 
diff --git a/src/vty/Makefile.am b/src/vty/Makefile.am
index 3142d75..c2d133a 100644
--- a/src/vty/Makefile.am
+++ b/src/vty/Makefile.am
@@ -14,5 +14,5 @@
 			fsm_vty.c talloc_ctx_vty.c \
 			cpu_sched_vty.c tdef_vty.c
 libosmovty_la_LDFLAGS = -version-info $(LIBVERSION) -no-undefined
-libosmovty_la_LIBADD = $(top_builddir)/src/libosmocore.la $(TALLOC_LIBS) $(PTHREAD_LIBS)
+libosmovty_la_LIBADD = $(top_builddir)/src/core/libosmocore.la $(TALLOC_LIBS) $(PTHREAD_LIBS)
 endif
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8c7e40a..f0eaaca 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,7 @@
 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
 AM_CFLAGS = -Wall $(TALLOC_CFLAGS) $(PTHREAD_CFLAGS)
 AM_LDFLAGS = -no-install
-LDADD = $(top_builddir)/src/libosmocore.la $(TALLOC_LIBS) $(PTHREAD_LIBS)
+LDADD = $(top_builddir)/src/core/libosmocore.la $(TALLOC_LIBS) $(PTHREAD_LIBS)
 
 if ENABLE_SERCOM_STUB
 noinst_LIBRARIES = libsercomstub.a
@@ -93,7 +93,7 @@
 
 stats_stats_test_SOURCES = stats/stats_test.c
 stats_stats_test_LDADD = $(LDADD) $(top_builddir)/src/gsm/libosmogsm.la
-stats_stats_test_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src
+stats_stats_test_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/core
 
 stats_stats_vty_test_SOURCES = stats/stats_vty_test.c
 stats_stats_vty_test_LDADD = $(LDADD) $(top_builddir)/src/vty/libosmovty.la
@@ -209,7 +209,7 @@
 gb_gprs_ns2_test_LDADD = $(LDADD) $(LIBRARY_DLSYM) \
 			$(top_builddir)/src/vty/libosmovty.la \
 			$(top_builddir)/src/gsm/libosmogsm.la \
-			$(top_builddir)/src/libosmocore.la \
+			$(top_builddir)/src/core/libosmocore.la \
 			$(top_builddir)/src/gb/libosmogb-test.la
 if ENABLE_LIBMNL
 gb_gprs_ns2_test_LDADD += $(LIBMNL_LIBS)
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 80d1566..6e11dcd 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -3,7 +3,7 @@
 noinst_PROGRAMS =
 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
 AM_CFLAGS = -Wall $(TALLOC_CFLAGS) $(PTHREAD_CFLAGS)
-LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la $(PTHREAD_LIBS)
+LDADD = $(top_builddir)/src/core/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la $(PTHREAD_LIBS)
 
 if ENABLE_UTILITIES
 EXTRA_DIST = conv_gen.py conv_codes_gsm.py
diff --git a/utils/osmo-stat-dummy/Makefile.am b/utils/osmo-stat-dummy/Makefile.am
index d28b982..f1faa3d 100644
--- a/utils/osmo-stat-dummy/Makefile.am
+++ b/utils/osmo-stat-dummy/Makefile.am
@@ -4,7 +4,7 @@
 osmo_stat_dummy_LDADD = $(LDADD) $(TALLOC_LIBS) \
 			$(top_builddir)/src/vty/libosmovty.la \
 			$(top_builddir)/src/ctrl/libosmoctrl.la \
-			$(top_builddir)/src/libosmocore.la
+			$(top_builddir)/src/core/libosmocore.la
 osmo_stat_dummy_CFLAGS = -Wall $(TALLOC_CFLAGS) $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(LIBOSMOCTRL_CFLAGS)
 osmo_stat_dummy_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
 endif