Move to kernel style SPDX license identifiers
[lttng-ust.git] / doc / examples / gen-tp / Makefile
1 # SPDX-License-Identifier: MIT
2 #
3 # Copyright (C) 2011-2012 Matthew Khouzam <matthew.khouzam@ericsson.com>
4 # Copyright (C) 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 # Copyright (C) 2012 Yannick Brosseau <yannick.brosseau@gmail.com>
6 #
7 # This makefile is not using automake so that people can see how to make
8 # simply. It builds a program with a statically embedded tracepoint
9 # provider probe.
10 #
11 # This makefile is purposefully kept simple to support GNU and BSD make.
12
13 LIBS = -ldl -llttng-ust #On Linux
14 #LIBS = -lc -llttng-ust #On BSD
15 AM_V_P := :
16
17 all: sample
18
19 sample: sample.o sample_tracepoint.o
20 @if $(AM_V_P); then set -x; else echo " CCLD $@"; fi; \
21 $(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
22 -o $@ sample.o sample_tracepoint.o $(LIBS)
23
24 sample.o: sample.c sample_tracepoint.h
25 @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \
26 $(CC) $(CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) \
27 -c -o $@ $<
28
29 # Use this command to compile the .c manually
30 #sample_tracepoint.o: sample_tracepoint.c sample_tracepoint.h
31 # $(CC) $(CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) \
32 # -I. -c -o $@ $<
33
34 # This rule generate .o only and depends on rules for generating
35 # the .h and .c
36 %.o: %.tp %.c %.h
37 @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \
38 CPPFLAGS="$(AM_CPPFLAGS) $(CPPFLAGS)" \
39 CFLAGS="$(AM_CFLAGS) $(CFLAGS)" \
40 LDFLAGS="$(AM_LDFLAGS) $(LDFLAGS)" \
41 CC="$(CC)" \
42 $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
43
44 # The following rule can be used to generate all files instead of having one
45 # for each file type. Note that the sample.o has a dependency on the
46 # .h, so you need to change that if you remove the %.h rule.
47 #%.o: %.tp
48 # lttng-gen-tp $<
49
50 %.h: %.tp
51 @if $(AM_V_P); then set -x; else echo " GEN $@"; fi; \
52 $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
53
54 %.c: %.tp
55 @if $(AM_V_P); then set -x; else echo " GEN $@"; fi; \
56 $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
57
58 .PHONY: clean
59 clean:
60 rm -f *.o sample
61 rm -f sample_tracepoint.h sample_tracepoint.c
This page took 0.029271 seconds and 4 git commands to generate.