3d57eb5b |
1 | |
3d57eb5b |
2 | CC=gcc |
15146922 |
3 | INCLUDE_DIR=/usr/include |
3a4541a5 |
4 | LIB_DIR?=/usr/lib |
06b6cf12 |
5 | RANLIB=ranlib |
3d57eb5b |
6 | |
3a4541a5 |
7 | LTT_CFLAGS=-I. -O2 -L. |
976db1b3 |
8 | |
9 | #For testing lib ltt-usertrace-fast |
10 | #CFLAGS+=-DLTT_SUBBUF_SIZE_CPU=134217728 |
11 | #CFLAGS+=-DLTT_NULL_OUTPUT_TEST |
12 | |
13 | all: libs samples |
14 | |
1a7c8c19 |
15 | #SAMPLE PROGRAMS |
976db1b3 |
16 | |
1a7c8c19 |
17 | samples: sample sample-highspeed sample-printf \ |
18 | sample-instrument-fct sample-thread-slow sample-thread-fast |
3d57eb5b |
19 | |
20 | sample: sample.c ltt-facility-loader-user_generic.c |
3a4541a5 |
21 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -o $@ $^ |
972a52cf |
22 | |
23 | sample-highspeed: sample-highspeed.c ltt-facility-loader-user_generic.c |
3a4541a5 |
24 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -lltt-usertrace-fast -o $@ $^ |
3d57eb5b |
25 | |
e36efdc5 |
26 | sample-printf: sample-printf.c ltt-facility-loader-user_generic.c |
3a4541a5 |
27 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -o $@ $^ |
15146922 |
28 | |
06b6cf12 |
29 | sample-instrument-fct: sample-instrument-fct.c |
3a4541a5 |
30 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -g -finstrument-functions -lltt-instrument-functions -o $@ $^ |
20f73bc0 |
31 | |
1a7c8c19 |
32 | sample-thread-slow: sample-thread-slow.c ltt-facility-loader-user_generic.c |
3a4541a5 |
33 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -lpthread -o $@ $^ |
1a7c8c19 |
34 | |
35 | sample-thread-fast: sample-thread-fast.c ltt-facility-loader-user_generic.c |
3a4541a5 |
36 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -lpthread -lltt-usertrace-fast -o $@ $^ |
1a7c8c19 |
37 | |
38 | |
39 | #LIBRAIRIES |
40 | |
41 | libs: libltt-instrument-functions.a libltt-instrument-functions.so.0 \ |
42 | libltt-usertrace-fast.a libltt-usertrace-fast.so.0 |
43 | |
44 | libltt-usertrace-fast.a: ltt-usertrace-fast.o |
976db1b3 |
45 | @rm -f libltt-usertrace-fast.a |
46 | $(AR) rc $@ $^ |
47 | $(RANLIB) $@ |
48 | |
1a7c8c19 |
49 | libltt-usertrace-fast.so.0: ltt-usertrace-fast.o |
976db1b3 |
50 | @rm -f libltt-usertrace-fast.so libltt-usertrace-fast.so.0 |
3a4541a5 |
51 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -lpthread -shared -Wl,-soname,libltt-usertrace-fast.so -o $@ $^ |
976db1b3 |
52 | ln -s libltt-usertrace-fast.so.0 libltt-usertrace-fast.so |
53 | |
54 | libltt-instrument-functions.a: ltt-instrument-functions.o ltt-facility-loader-user_generic.o ltt-usertrace-fast.o |
06b6cf12 |
55 | @rm -f libltt-instrument-functions.a |
56 | $(AR) rc $@ $^ |
57 | $(RANLIB) $@ |
58 | |
976db1b3 |
59 | libltt-instrument-functions.so.0: ltt-instrument-functions.o ltt-facility-loader-user_generic.o ltt-usertrace-fast.o |
06b6cf12 |
60 | @rm -f libltt-instrument-functions.so libltt-instrument-functions.so.0 |
3a4541a5 |
61 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -lpthread -shared -Wl,-soname,libltt-instrument-functions.so -o $@ $^ |
06b6cf12 |
62 | ln -s libltt-instrument-functions.so.0 libltt-instrument-functions.so |
e90c7b86 |
63 | |
3a4541a5 |
64 | %.o: %.c |
65 | $(CC) $(LTT_CFLAGS) $(CFLAGS) -c -o $@ $+ |
e36efdc5 |
66 | |
3a4541a5 |
67 | .PHONY : clean install libs install_libs install_headers samples |
68 | |
69 | install_headers: |
15146922 |
70 | if [ ! -e "$(INCLUDE_DIR)/ltt" ] ; then mkdir $(INCLUDE_DIR)/ltt ; fi |
71 | cp -f ltt/*.h $(INCLUDE_DIR)/ltt |
3a4541a5 |
72 | |
73 | install_libs: |
b09f3215 |
74 | cp -df libltt-instrument-functions.so* libltt-instrument-functions.a $(LIB_DIR) |
976db1b3 |
75 | cp -df libltt-usertrace-fast.so* libltt-usertrace-fast.a $(LIB_DIR) |
3d57eb5b |
76 | |
3a4541a5 |
77 | install: install_headers libs install_libs |
78 | |
3d57eb5b |
79 | clean: |
403a4bcd |
80 | 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* sample-thread-slow sample-thread-fast |
3d57eb5b |
81 | |