ust-fd: Add close_range declaration
[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 PYTHON := python
14
15 LIBS = -ldl -llttng-ust #On Linux
16 #LIBS = -lc -llttng-ust #On BSD
17 AM_V_P := :
18
19 all: sample
20
21 sample: sample.o sample_tracepoint.o
22 @if $(AM_V_P); then set -x; else echo " CCLD $@"; fi; \
23 $(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
24 -o $@ sample.o sample_tracepoint.o $(LIBS)
25
26 sample.o: sample.c sample_tracepoint.h
27 @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \
28 $(CC) $(CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) \
29 -c -o $@ $<
30
31 # Use this command to compile the .c manually
32 #sample_tracepoint.o: sample_tracepoint.c sample_tracepoint.h
33 # $(CC) $(CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) \
34 # -I. -c -o $@ $<
35
36 # This rule generate .o only and depends on rules for generating
37 # the .h and .c
38 %.o: %.tp %.c %.h
39 @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \
40 CPPFLAGS="$(AM_CPPFLAGS) $(CPPFLAGS)" \
41 CFLAGS="$(AM_CFLAGS) $(CFLAGS)" \
42 CC="$(CC)" \
43 $(PYTHON) $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
44
45 # The following rule can be used to generate all files instead of having one
46 # for each file type. Note that the sample.o has a dependency on the
47 # .h, so you need to change that if you remove the %.h rule.
48 #%.o: %.tp
49 # lttng-gen-tp $<
50
51 %.h: %.tp
52 @if $(AM_V_P); then set -x; else echo " GEN $@"; fi; \
53 $(PYTHON) $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
54
55 %.c: %.tp
56 @if $(AM_V_P); then set -x; else echo " GEN $@"; fi; \
57 $(PYTHON) $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
58
59 .PHONY: clean
60 clean:
61 rm -f *.o sample
62 rm -f sample_tracepoint.h sample_tracepoint.c
This page took 0.030632 seconds and 5 git commands to generate.