From c3a3bec97c1e85e333c4d6f958ee50d09e6a9429 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Fri, 26 Mar 2010 15:23:54 -0700 Subject: tet: Build TET API library as private shared module Making libapi shared saves quite a bit of space since it's linked into every test program. However, parts of the API are intended to be linked statically into the program, so libapi and libtcm have been split into static and shared (_s) portions. In order to satisy undefined extern variables with shared libraries, tet_pname and tet_thistest have been added to tcc and exported. Hopefully, more code can be moved into the shared _s portion with just small stubs linked statically into the tests. Signed-off-by: Dan Nicholson --- src/tet3/apilib/Makefile.am | 14 +++++++++++--- src/tet3/tcc/tcc.c | 5 +++++ src/tet3/tcclib/Makefile.am | 2 +- src/tet3/tcm/Makefile.am | 18 ++++++++++++------ 4 files changed, 29 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/tet3/apilib/Makefile.am b/src/tet3/apilib/Makefile.am index 8bb5fbfd..bf5179e4 100644 --- a/src/tet3/apilib/Makefile.am +++ b/src/tet3/apilib/Makefile.am @@ -1,9 +1,15 @@ AM_CPPFLAGS = -I../inc -I$(top_srcdir)/include + +# libapi_s is the shared portion of the library +xtslibdir = $(libexecdir)/xts5 +xtslib_LTLIBRARIES = libapi_s.la noinst_LTLIBRARIES = libapi.la + # If we weren't building TeT lite, this could also add inetlib, servlib # and xtilib -libapi_la_LIBADD = ../tcm/libtcm.la ../dtet2lib/libdtet2.la -libapi_la_SOURCES = \ +libapi_s_la_LIBADD = ../tcm/libtcm_s.la ../dtet2lib/libdtet2.la +libapi_s_la_LDFLAGS = -avoid-version +libapi_s_la_SOURCES = \ dcancel.c \ dconfig.c \ dresfile.c \ @@ -19,8 +25,10 @@ libapi_la_SOURCES = \ remwait.c \ rtab.c \ sync.c \ - tciface.c \ tdiscon.c \ tet_exec.c \ tet_fork.c \ tet_spawn.c +libapi_la_LIBADD = ../tcm/libtcm.la +libapi_la_SOURCES = \ + tciface.c diff --git a/src/tet3/tcc/tcc.c b/src/tet3/tcc/tcc.c index bd9364bb..bdd05986 100644 --- a/src/tet3/tcc/tcc.c +++ b/src/tet3/tcc/tcc.c @@ -71,6 +71,7 @@ MODIFICATIONS: #include #include # include +#include "tet_api.h" #include "dtmac.h" #include "dtmsg.h" #include "error.h" @@ -90,6 +91,10 @@ char tcc_options[] = "IT:Va:bcef:g:i:j:l:m:n:pr:s:t:v:x:y:"; static void badusage PROTOLIST((void)); static void prversioninfo PROTOLIST((void)); +/* satisfy libapi symbol resolution */ +TET_EXPORT char *tet_pname; +TET_EXPORT int tet_thistest; + /* default root directories */ #ifndef DEFAULT_TET_ROOT #define DEFAULT_TET_ROOT "/usr/local/share" diff --git a/src/tet3/tcclib/Makefile.am b/src/tet3/tcclib/Makefile.am index b4c923e2..e256b99d 100644 --- a/src/tet3/tcclib/Makefile.am +++ b/src/tet3/tcclib/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = -I../inc -I$(top_srcdir)/include noinst_LTLIBRARIES = libtcc.la -libtcc_la_LIBADD = ../apilib/libapi.la +libtcc_la_LIBADD = ../apilib/libapi.la ../apilib/libapi_s.la libtcc_la_SOURCES = \ lockfile.c \ lsdir.c \ diff --git a/src/tet3/tcm/Makefile.am b/src/tet3/tcm/Makefile.am index 55cd0ab3..e68f1560 100644 --- a/src/tet3/tcm/Makefile.am +++ b/src/tet3/tcm/Makefile.am @@ -1,10 +1,16 @@ AM_CPPFLAGS = -I../inc -I$(top_srcdir)/include -noinst_LTLIBRARIES = libtcm.la libtcmmain.la libtcmchild.la -libtcm_la_SOURCES = child.c \ - ckversion.c \ - dynlink.c \ - ictp.c \ - tcmfuncs.c + +# libtcm_s is the shared part of the library pulled into libapi_s. +# libtcmmain and libtcmchild basically provide main() for tests or their +# children. +noinst_LTLIBRARIES = libtcm_s.la libtcm.la libtcmmain.la libtcmchild.la +libtcm_s_la_SOURCES = \ + ictp.c +libtcm_la_SOURCES = \ + child.c \ + ckversion.c \ + dynlink.c \ + tcmfuncs.c # When linking to either of these libraries, remember to link libapi.la # after them -- cgit v1.2.3