From 06b6cf125d86305a5231e744fc6c6febb113484e Mon Sep 17 00:00:00 2001 From: compudj Date: Tue, 7 Mar 2006 02:44:42 +0000 Subject: [PATCH] make a dynamic lib git-svn-id: http://ltt.polymtl.ca/svn@1600 04897980-b3bd-0310-b5e0-8ef037075253 --- usertrace-generic/Makefile | 23 +++++++++++++++-------- usertrace-generic/README | 4 ++-- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/usertrace-generic/Makefile b/usertrace-generic/Makefile index dfcccf9e..8291ac3f 100644 --- a/usertrace-generic/Makefile +++ b/usertrace-generic/Makefile @@ -2,8 +2,9 @@ CC=gcc INCLUDE_DIR=/usr/include LIB_DIR=/usr/lib +RANLIB=ranlib -all: sample-thread sample sample-highspeed sample-printf sample-instrument-fct ltt-instrument-functions.so.0 +all: libltt-instrument-functions.a libltt-instrument-functions.so.0 sample-thread sample sample-highspeed sample-printf sample-instrument-fct sample-thread: sample-thread.c ltt-facility-loader-user_generic.c $(CC) $(CFLAGS) -lpthread -o $@ $^ @@ -17,20 +18,26 @@ sample-highspeed: sample-highspeed.c ltt-facility-loader-user_generic.c sample-printf: sample-printf.c ltt-facility-loader-user_generic.c $(CC) $(CFLAGS) -o $@ $^ -sample-instrument-fct: sample-instrument-fct.c ltt-facility-loader-user_generic.c ltt-instrument-functions.c - $(CC) $(CFLAGS) -g -finstrument-functions -o $@ $^ +sample-instrument-fct: sample-instrument-fct.c + $(CC) $(CFLAGS) -L. -g -finstrument-functions -lltt-instrument-functions -o $@ $^ -ltt-instrument-functions.so.0: ltt-facility-loader-user_generic.c ltt-instrument-functions.c - $(CC) $(CFLAGS) -shared -Wl,-soname,ltt-instrument-functions.so -o $@ $^ - ln -s ltt-instrument-functions.so.0 ltt-instrument-functions.so +libltt-instrument-functions.a: ltt-instrument-functions.o ltt-facility-loader-user_generic.o + @rm -f libltt-instrument-functions.a + $(AR) rc $@ $^ + $(RANLIB) $@ + +libltt-instrument-functions.so.0: ltt-instrument-functions.o ltt-facility-loader-user_generic.o + @rm -f libltt-instrument-functions.so libltt-instrument-functions.so.0 + $(CC) $(CFLAGS) -shared -Wl,-soname,libltt-instrument-functions.so -o $@ $^ + ln -s libltt-instrument-functions.so.0 libltt-instrument-functions.so .PHONY : clean install install: if [ ! -e "$(INCLUDE_DIR)/ltt" ] ; then mkdir $(INCLUDE_DIR)/ltt ; fi cp -f ltt/*.h $(INCLUDE_DIR)/ltt - cp -f ltt-instrument-functions.so* $(LIB_DIR) + cp -f libltt-instrument-functions.so* libltt-instrument-functions.a $(LIB_DIR) clean: - rm -fr *.o *~ sample-thread sample sample-highspeed sample-printf sample-instrument-fct ltt-instrument-functions.so.0 ltt-instrument-functions.so + rm -fr *.o *~ sample-thread sample sample-highspeed sample-printf sample-instrument-fct libltt-instrument-functions.so* libltt-instrument-functions.a diff --git a/usertrace-generic/README b/usertrace-generic/README index 01477a3d..5165ebd1 100644 --- a/usertrace-generic/README +++ b/usertrace-generic/README @@ -168,8 +168,8 @@ See the sample-instrument-fct.c example program. - Compile your application with at least these parameters to gcc (it is splitted on two lines, joined by a "\") : -gcc -g -finstrument-functions -I /usr/src/usertrace-generic -o myapp myapp.c \ - -l/usr/lib/ltt-instrument-functions.so +gcc -g -finstrument-functions -I /usr/src/usertrace-generic \ + -llibltt-instrument-functions -o myapp myapp.c To see what the final result looks like : - Start tracing -- 2.34.1