make libustcomm into a static lib
authorPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Thu, 11 Mar 2010 23:38:27 +0000 (18:38 -0500)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Thu, 11 Mar 2010 23:40:52 +0000 (18:40 -0500)
Makefile.am
configure.ac
libust/Makefile.am
libust/buffers.c
libustcomm/Makefile.am [new file with mode: 0644]
ustctl/Makefile.am
ustd/Makefile.am

index de22e0d84021d2aedff6300ab3a1fc9024f5d40f..e3a4bbdc4eed8a5821ab3f19a7c24a6445480f5b 100644 (file)
@@ -5,7 +5,7 @@ ACLOCAL_AMFLAGS = -I m4
 # libust and '.' (that contains the linker script). However, '.'
 # must be installed after libust so it can overwrite libust.so with
 # the linker script.
-SUBDIRS = snprintf libust . tests libmallocwrap ustd ustctl libinterfork include
+SUBDIRS = snprintf libustcomm libust . tests libmallocwrap ustd ustctl libinterfork include
 
 EXTRA_DIST = doc libust.ldscript.in libust-initializer.c
 dist_bin_SCRIPTS = usttrace
index e428a4970b121d847f5636bd36ee699416706bd0..b1fb068bd85c0fcddab6466f9a37ecd753679231 100644 (file)
@@ -125,6 +125,7 @@ AC_CONFIG_FILES([
        libinterfork/Makefile
        ustd/Makefile
        ustctl/Makefile
+       libustcomm/Makefile
        snprintf/Makefile
 ])
 AC_OUTPUT
index e38956a9f4bd60f66838286964691cade7e5c4a5..cb5dc1291511d4a34a80439111dc466a58e19fa3 100644 (file)
@@ -1,6 +1,7 @@
 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libustcomm
 
 lib_LTLIBRARIES = libust.la
+
 libust_la_SOURCES = \
        marker.c \
        tracepoint.c \
@@ -16,9 +17,14 @@ libust_la_SOURCES = \
        tracercore.h \
        serialize.c \
        tracectl.c \
-       $(top_builddir)/libustcomm/ustcomm.c \
        tracerconst.h \
        header-inline.h
+
 libust_la_LDFLAGS = -no-undefined -version-info 0:0:0
-libust_la_LIBADD = -lpthread $(top_builddir)/snprintf/libustsnprintf.la
+
+libust_la_LIBADD = \
+       -lpthread \
+       $(top_builddir)/snprintf/libustsnprintf.la \
+       $(top_builddir)/libustcomm/libustcomm.la
+
 libust_la_CFLAGS = -DUST_COMPONENT="libust"
index 9651beb916db5d78b8acbae83ded896513963c3f..776823ea2789e718c1a82ea11de93f8bcb7d215a 100644 (file)
@@ -49,26 +49,24 @@ static int get_n_cpus(void)
        int result;
        static int n_cpus = 0;
 
-       if(n_cpus) {
-               return n_cpus;
-       }
+       if(!n_cpus) {
+               /* On Linux, when some processors are offline
+                * _SC_NPROCESSORS_CONF counts the offline
+                * processors, whereas _SC_NPROCESSORS_ONLN
+                * does not. If we used _SC_NPROCESSORS_ONLN,
+                * getcpu() could return a value greater than
+                * this sysconf, in which case the arrays
+                * indexed by processor would overflow.
+                */
+               result = sysconf(_SC_NPROCESSORS_CONF);
+               if(result == -1) {
+                       return -1;
+               }
 
-       /* On Linux, when some processors are offline
-        * _SC_NPROCESSORS_CONF counts the offline
-        * processors, whereas _SC_NPROCESSORS_ONLN
-        * does not. If we used _SC_NPROCESSORS_ONLN,
-        * getcpu() could return a value greater than
-        * this sysconf, in which case the arrays
-        * indexed by processor would overflow.
-        */
-       result = sysconf(_SC_NPROCESSORS_CONF);
-       if(result == -1) {
-               return -1;
+               n_cpus = result;
        }
 
-       n_cpus = result;
-
-       return result;
+       return n_cpus;
 }
 
 /* _ust_buffers_write()
diff --git a/libustcomm/Makefile.am b/libustcomm/Makefile.am
new file mode 100644 (file)
index 0000000..fa24cfb
--- /dev/null
@@ -0,0 +1,8 @@
+AM_CPPFLAGS = -I$(top_srcdir)/include
+
+lib_LTLIBRARIES = libustcomm.la
+libustcomm_la_SOURCES = \
+       ustcomm.h \
+       ustcomm.c
+libustcomm_la_LDFLAGS = -no-undefined -version-info 0:0:0 -static
+libustcomm_la_CFLAGS = -DUST_COMPONENT="libustcomm" -fPIC
index 91966f0d6752e964aa7708ac5bd588ce9f7a1350..4b8100f77f2a4c65f00d64cff67c750836902c59 100644 (file)
@@ -2,6 +2,14 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libustcomm \
        -I$(top_srcdir)/libustcmd $(KCOMPAT_CFLAGS)
 
 bin_PROGRAMS = ustctl
-ustctl_SOURCES = ustctl.c $(top_srcdir)/libustcomm/ustcomm.c $(top_srcdir)/libustcomm/ustcomm.h $(top_srcdir)/libustcmd/ustcmd.c $(top_srcdir)/libustcmd/ustcmd.h
+
+ustctl_SOURCES = \
+       ustctl.c \
+       $(top_srcdir)/libustcmd/ustcmd.c \
+       $(top_srcdir)/libustcmd/ustcmd.h
+
 ustctl_CFLAGS = -DUST_COMPONENT=ustctl
-ustctl_LDADD = $(top_builddir)/snprintf/libustsnprintf.la
+
+ustctl_LDADD = \
+       $(top_builddir)/snprintf/libustsnprintf.la \
+       $(top_builddir)/libustcomm/libustcomm.la
index 6adad644b36b0f002a51df336b500d441d178c44..96f167b0e1a3e533f4911975e8e6b1f34d93f5a6 100644 (file)
@@ -2,7 +2,12 @@ AM_CPPFLAGS = -I$(top_srcdir)/libust -I$(top_srcdir)/libustcomm \
        -I$(top_srcdir)/include
 
 bin_PROGRAMS = ustd
-ustd_SOURCES = lowlevel.c ustd.c ustd.h $(top_srcdir)/libustcomm/ustcomm.c $(top_srcdir)/libustcomm/ustcomm.h
-ustd_LDADD = $(top_builddir)/snprintf/libustsnprintf.la
+
+ustd_SOURCES = lowlevel.c ustd.c ustd.h
+
+ustd_LDADD = \
+       $(top_builddir)/snprintf/libustsnprintf.la \
+       $(top_builddir)/libustcomm/libustcomm.la
+
 ustd_LDFLAGS = -lpthread
 ustd_CFLAGS = -DUST_COMPONENT=ustd
This page took 0.028702 seconds and 4 git commands to generate.