update usertrade to support g++
[lttv.git] / ltt-usertrace / Makefile
CommitLineData
3d57eb5b 1
3d57eb5b 2CC=gcc
15146922 3INCLUDE_DIR=/usr/include
3a4541a5 4LIB_DIR?=/usr/lib
06b6cf12 5RANLIB=ranlib
3d57eb5b 6
5ecaa1ab 7LTT_CFLAGS=-I. -O2 -L. -fPIC
8c44a29d 8# note : x86_64 needs -fPIC ? FIXME
976db1b3 9
10#For testing lib ltt-usertrace-fast
11#CFLAGS+=-DLTT_SUBBUF_SIZE_CPU=134217728
12#CFLAGS+=-DLTT_NULL_OUTPUT_TEST
13
14all: libs samples
15
1a7c8c19 16#SAMPLE PROGRAMS
976db1b3 17
1a7c8c19 18samples: sample sample-highspeed sample-printf \
4df264b2 19 sample-instrument-fct sample-thread-slow sample-thread-fast sample-thread-brand sample-block
3d57eb5b 20
ce22b1be 21sample: sample.c
22 $(CC) $(LTT_CFLAGS) $(CFLAGS) -lltt-loader-user_generic -o $@ $^
23sample-block: sample-block.c
24 $(CC) $(LTT_CFLAGS) $(CFLAGS) -lltt-loader-user_generic -o $@ $^
4b18c4a6 25
ce22b1be 26sample-thread-brand: sample-thread-brand.c
27 $(CC) $(LTT_CFLAGS) $(CFLAGS) -lltt-loader-user_generic -o $@ $^
a31c6b45 28
ce22b1be 29sample-highspeed: sample-highspeed.c
30 $(CC) $(LTT_CFLAGS) $(CFLAGS) -lltt-usertrace-fast -lltt-loader-user_generic -o $@ $^
3d57eb5b 31
ce22b1be 32sample-printf: sample-printf.c
33 $(CC) $(LTT_CFLAGS) $(CFLAGS) -lltt-loader-user_generic -o $@ $^
15146922 34
06b6cf12 35sample-instrument-fct: sample-instrument-fct.c
3a4541a5 36 $(CC) $(LTT_CFLAGS) $(CFLAGS) -g -finstrument-functions -lltt-instrument-functions -o $@ $^
20f73bc0 37
ce22b1be 38sample-thread-slow: sample-thread-slow.c
39 $(CC) $(LTT_CFLAGS) $(CFLAGS) -lpthread -lltt-loader-user_generic -o $@ $^
1a7c8c19 40
ce22b1be 41sample-thread-fast: sample-thread-fast.c
42 $(CC) $(LTT_CFLAGS) $(CFLAGS) -lpthread -lltt-usertrace-fast -lltt-loader-user_generic -o $@ $^
1a7c8c19 43
44
45#LIBRAIRIES
46
47libs: libltt-instrument-functions.a libltt-instrument-functions.so.0 \
ce22b1be 48 libltt-usertrace-fast.a libltt-usertrace-fast.so.0 \
49 libltt-loader-user_generic.a libltt-loader-user_generic.so.0
1a7c8c19 50
51libltt-usertrace-fast.a: ltt-usertrace-fast.o
976db1b3 52 @rm -f libltt-usertrace-fast.a
53 $(AR) rc $@ $^
54 $(RANLIB) $@
55
1a7c8c19 56libltt-usertrace-fast.so.0: ltt-usertrace-fast.o
976db1b3 57 @rm -f libltt-usertrace-fast.so libltt-usertrace-fast.so.0
3a4541a5 58 $(CC) $(LTT_CFLAGS) $(CFLAGS) -lpthread -shared -Wl,-soname,libltt-usertrace-fast.so -o $@ $^
976db1b3 59 ln -s libltt-usertrace-fast.so.0 libltt-usertrace-fast.so
60
61libltt-instrument-functions.a: ltt-instrument-functions.o ltt-facility-loader-user_generic.o ltt-usertrace-fast.o
06b6cf12 62 @rm -f libltt-instrument-functions.a
63 $(AR) rc $@ $^
64 $(RANLIB) $@
65
976db1b3 66libltt-instrument-functions.so.0: ltt-instrument-functions.o ltt-facility-loader-user_generic.o ltt-usertrace-fast.o
06b6cf12 67 @rm -f libltt-instrument-functions.so libltt-instrument-functions.so.0
3a4541a5 68 $(CC) $(LTT_CFLAGS) $(CFLAGS) -lpthread -shared -Wl,-soname,libltt-instrument-functions.so -o $@ $^
06b6cf12 69 ln -s libltt-instrument-functions.so.0 libltt-instrument-functions.so
e90c7b86 70
ce22b1be 71libltt-loader-user_generic.a: ltt-facility-loader-user_generic.o
72 @rm -f libltt-loader-user_generic.a
73 $(AR) rc $@ $^
74 $(RANLIB) $@
75
76libltt-loader-user_generic.so.0: ltt-facility-loader-user_generic.o
77 @rm -f libltt-loader-user_generic.so libltt-loader-user_generic.so.0
78 $(CC) $(LTT_CFLAGS) $(CFLAGS) -lpthread -shared -Wl,-soname,libltt-loader-user_generic.so -o $@ $^
79 ln -s libltt-loader-user_generic.so.0 libltt-loader-user_generic.so
80
3a4541a5 81%.o: %.c
82 $(CC) $(LTT_CFLAGS) $(CFLAGS) -c -o $@ $+
e36efdc5 83
3a4541a5 84.PHONY : clean install libs install_libs install_headers samples
85
86install_headers:
15146922 87 if [ ! -e "$(INCLUDE_DIR)/ltt" ] ; then mkdir $(INCLUDE_DIR)/ltt ; fi
88 cp -f ltt/*.h $(INCLUDE_DIR)/ltt
3a4541a5 89
90install_libs:
b09f3215 91 cp -df libltt-instrument-functions.so* libltt-instrument-functions.a $(LIB_DIR)
976db1b3 92 cp -df libltt-usertrace-fast.so* libltt-usertrace-fast.a $(LIB_DIR)
ce22b1be 93 cp -df libltt-loader-user_generic.so* libltt-loader-user_generic.a $(LIB_DIR)
3d57eb5b 94
3a4541a5 95install: install_headers libs install_libs
96
3d57eb5b 97clean:
4b18c4a6 98 find . -name \*~ | xargs rm -fr *.o sample-thread sample sample-highspeed sample-printf sample-instrument-fct libltt-instrument-functions.so* libltt-instrument-functions.a libltt-usertrace-fast.a libltt-usertrace-fast.so* libltt-loader-user_generic.so* libltt-loader-user_generic.a sample-thread-slow sample-thread-fast sample-thread-brand sample-block java/*.class java/Sample.h java/TestBrand.h
This page took 0.034822 seconds and 4 git commands to generate.