3d57eb5b |
1 | |
3d57eb5b |
2 | CC=gcc |
15146922 |
3 | INCLUDE_DIR=/usr/include |
3a4541a5 |
4 | LIB_DIR?=/usr/lib |
06b6cf12 |
5 | RANLIB=ranlib |
3d57eb5b |
6 | |
8c44a29d |
7 | LTT_CFLAGS=-I. -O2 -L. |
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 | |
14 | all: libs samples |
15 | |
1a7c8c19 |
16 | #SAMPLE PROGRAMS |
976db1b3 |
17 | |
1a7c8c19 |
18 | samples: sample sample-highspeed sample-printf \ |
4df264b2 |
19 | sample-instrument-fct sample-thread-slow sample-thread-fast sample-thread-brand sample-block |
3d57eb5b |
20 | |
ce22b1be |
21 | sample: sample.c |
22 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -lltt-loader-user_generic -o $@ $^ |
23 | sample-block: sample-block.c |
24 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -lltt-loader-user_generic -o $@ $^ |
972a52cf |
25 | |
ce22b1be |
26 | sample-thread-brand: sample-thread-brand.c |
27 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -lltt-loader-user_generic -o $@ $^ |
a31c6b45 |
28 | |
ce22b1be |
29 | sample-highspeed: sample-highspeed.c |
30 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -lltt-usertrace-fast -lltt-loader-user_generic -o $@ $^ |
3d57eb5b |
31 | |
ce22b1be |
32 | sample-printf: sample-printf.c |
33 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -lltt-loader-user_generic -o $@ $^ |
15146922 |
34 | |
06b6cf12 |
35 | sample-instrument-fct: sample-instrument-fct.c |
3a4541a5 |
36 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -g -finstrument-functions -lltt-instrument-functions -o $@ $^ |
20f73bc0 |
37 | |
ce22b1be |
38 | sample-thread-slow: sample-thread-slow.c |
39 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -lpthread -lltt-loader-user_generic -o $@ $^ |
1a7c8c19 |
40 | |
ce22b1be |
41 | sample-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 | |
47 | libs: 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 | |
51 | libltt-usertrace-fast.a: ltt-usertrace-fast.o |
976db1b3 |
52 | @rm -f libltt-usertrace-fast.a |
53 | $(AR) rc $@ $^ |
54 | $(RANLIB) $@ |
55 | |
1a7c8c19 |
56 | libltt-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 | |
61 | libltt-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 |
66 | libltt-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 |
71 | libltt-loader-user_generic.a: ltt-facility-loader-user_generic.o |
72 | @rm -f libltt-loader-user_generic.a |
73 | $(AR) rc $@ $^ |
74 | $(RANLIB) $@ |
75 | |
76 | libltt-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 | |
86 | install_headers: |
15146922 |
87 | if [ ! -e "$(INCLUDE_DIR)/ltt" ] ; then mkdir $(INCLUDE_DIR)/ltt ; fi |
88 | cp -f ltt/*.h $(INCLUDE_DIR)/ltt |
3a4541a5 |
89 | |
90 | install_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 |
95 | install: install_headers libs install_libs |
96 | |
3d57eb5b |
97 | clean: |
9d351e68 |
98 | 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 |