Commit | Line | Data |
---|---|---|
b25c5b37 YB |
1 | # Copyright (C) 2011-2012 Matthew Khouzam <matthew.khouzam@ericsson.com> |
2 | # Copyright (C) 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
3 | # Copyright (C) 2012 Yannick Brosseau <yannick.brosseau@gmail.com> | |
4 | # | |
5 | # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED | |
6 | # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. | |
7 | # | |
8 | # Permission is hereby granted to use or copy this program for any | |
9 | # purpose, provided the above notices are retained on all copies. | |
10 | # Permission to modify the code and to distribute modified code is | |
11 | # granted, provided the above notices are retained, and a notice that | |
12 | # the code was modified is included with the above copyright notice. | |
16c96fc0 | 13 | # |
b25c5b37 YB |
14 | # This makefile is not using automake so that people can see how to make |
15 | # simply. It builds a program with a statically embedded tracepoint | |
16 | # provider probe. | |
16c96fc0 MD |
17 | # |
18 | # This makefile is purposefully kept simple to support GNU and BSD make. | |
b25c5b37 | 19 | |
c6c454ab MD |
20 | LIBS = -ldl -llttng-ust #On Linux |
21 | #LIBS = -lc -llttng-ust #On BSD | |
dc5af9e3 | 22 | AM_V_P := : |
b25c5b37 YB |
23 | |
24 | all: sample | |
25 | ||
db06a0a2 | 26 | sample: sample.o sample_tracepoint.o |
dc5af9e3 MJ |
27 | @if $(AM_V_P); then set -x; else echo " CCLD $@"; fi; \ |
28 | $(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \ | |
afd20a56 | 29 | -o $@ sample.o sample_tracepoint.o $(LIBS) |
b25c5b37 YB |
30 | |
31 | sample.o: sample.c sample_tracepoint.h | |
dc5af9e3 MJ |
32 | @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \ |
33 | $(CC) $(CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) \ | |
f7116edc | 34 | -c -o $@ $< |
b25c5b37 | 35 | |
db06a0a2 YB |
36 | # Use this command to compile the .c manually |
37 | #sample_tracepoint.o: sample_tracepoint.c sample_tracepoint.h | |
e1c62734 | 38 | # $(CC) $(CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) \ |
f7116edc | 39 | # -I. -c -o $@ $< |
db06a0a2 YB |
40 | |
41 | # This rule generate .o only and depends on rules for generating | |
42 | # the .h and .c | |
43 | %.o: %.tp %.c %.h | |
dc5af9e3 MJ |
44 | @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \ |
45 | CPPFLAGS="$(AM_CPPFLAGS) $(CPPFLAGS)" \ | |
46 | CFLAGS="$(AM_CFLAGS) $(CFLAGS)" \ | |
47 | LDFLAGS="$(AM_LDFLAGS) $(LDFLAGS)" \ | |
48 | CC="$(CC)" \ | |
49 | $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $< | |
db06a0a2 YB |
50 | |
51 | # The following rule can be used to generate all files instead of having one | |
52 | # for each file type. Note that the sample.o has a dependency on the | |
53 | # .h, so you need to change that if you remove the %.h rule. | |
54 | #%.o: %.tp | |
55 | # lttng-gen-tp $< | |
b25c5b37 YB |
56 | |
57 | %.h: %.tp | |
dc5af9e3 MJ |
58 | @if $(AM_V_P); then set -x; else echo " GEN $@"; fi; \ |
59 | $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $< | |
db06a0a2 | 60 | |
b25c5b37 | 61 | %.c: %.tp |
dc5af9e3 MJ |
62 | @if $(AM_V_P); then set -x; else echo " GEN $@"; fi; \ |
63 | $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $< | |
b25c5b37 YB |
64 | |
65 | .PHONY: clean | |
66 | clean: | |
67 | rm -f *.o sample | |
68 | rm -f sample_tracepoint.h sample_tracepoint.c |