Move to kernel style SPDX license identifiers
[lttng-ust.git] / doc / examples / gen-tp / Makefile
CommitLineData
c0c0989a
MJ
1# SPDX-License-Identifier: MIT
2#
b25c5b37
YB
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#
b25c5b37
YB
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.
16c96fc0
MD
10#
11# This makefile is purposefully kept simple to support GNU and BSD make.
b25c5b37 12
c6c454ab
MD
13LIBS = -ldl -llttng-ust #On Linux
14#LIBS = -lc -llttng-ust #On BSD
dc5af9e3 15AM_V_P := :
b25c5b37
YB
16
17all: sample
18
db06a0a2 19sample: sample.o sample_tracepoint.o
dc5af9e3
MJ
20 @if $(AM_V_P); then set -x; else echo " CCLD $@"; fi; \
21 $(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
afd20a56 22 -o $@ sample.o sample_tracepoint.o $(LIBS)
b25c5b37
YB
23
24sample.o: sample.c sample_tracepoint.h
dc5af9e3
MJ
25 @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \
26 $(CC) $(CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) \
f7116edc 27 -c -o $@ $<
b25c5b37 28
db06a0a2
YB
29# Use this command to compile the .c manually
30#sample_tracepoint.o: sample_tracepoint.c sample_tracepoint.h
e1c62734 31# $(CC) $(CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) \
f7116edc 32# -I. -c -o $@ $<
db06a0a2
YB
33
34# This rule generate .o only and depends on rules for generating
35# the .h and .c
36%.o: %.tp %.c %.h
dc5af9e3
MJ
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 $@ $<
db06a0a2
YB
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 $<
b25c5b37
YB
49
50%.h: %.tp
dc5af9e3
MJ
51 @if $(AM_V_P); then set -x; else echo " GEN $@"; fi; \
52 $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
db06a0a2 53
b25c5b37 54%.c: %.tp
dc5af9e3
MJ
55 @if $(AM_V_P); then set -x; else echo " GEN $@"; fi; \
56 $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
b25c5b37
YB
57
58.PHONY: clean
59clean:
60 rm -f *.o sample
61 rm -f sample_tracepoint.h sample_tracepoint.c
This page took 0.02973 seconds and 4 git commands to generate.