Commit | Line | Data |
---|---|---|
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 | |
a4e2c093 MJ |
13 | PYTHON := python |
14 | ||
c6c454ab MD |
15 | LIBS = -ldl -llttng-ust #On Linux |
16 | #LIBS = -lc -llttng-ust #On BSD | |
dc5af9e3 | 17 | AM_V_P := : |
b25c5b37 YB |
18 | |
19 | all: sample | |
20 | ||
db06a0a2 | 21 | sample: sample.o sample_tracepoint.o |
dc5af9e3 MJ |
22 | @if $(AM_V_P); then set -x; else echo " CCLD $@"; fi; \ |
23 | $(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \ | |
afd20a56 | 24 | -o $@ sample.o sample_tracepoint.o $(LIBS) |
b25c5b37 YB |
25 | |
26 | sample.o: sample.c sample_tracepoint.h | |
dc5af9e3 MJ |
27 | @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \ |
28 | $(CC) $(CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) \ | |
f7116edc | 29 | -c -o $@ $< |
b25c5b37 | 30 | |
db06a0a2 YB |
31 | # Use this command to compile the .c manually |
32 | #sample_tracepoint.o: sample_tracepoint.c sample_tracepoint.h | |
e1c62734 | 33 | # $(CC) $(CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) \ |
f7116edc | 34 | # -I. -c -o $@ $< |
db06a0a2 YB |
35 | |
36 | # This rule generate .o only and depends on rules for generating | |
37 | # the .h and .c | |
38 | %.o: %.tp %.c %.h | |
dc5af9e3 MJ |
39 | @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \ |
40 | CPPFLAGS="$(AM_CPPFLAGS) $(CPPFLAGS)" \ | |
41 | CFLAGS="$(AM_CFLAGS) $(CFLAGS)" \ | |
dc5af9e3 | 42 | CC="$(CC)" \ |
a4e2c093 | 43 | $(PYTHON) $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $< |
db06a0a2 YB |
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 $< | |
b25c5b37 YB |
50 | |
51 | %.h: %.tp | |
dc5af9e3 | 52 | @if $(AM_V_P); then set -x; else echo " GEN $@"; fi; \ |
a4e2c093 | 53 | $(PYTHON) $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $< |
db06a0a2 | 54 | |
b25c5b37 | 55 | %.c: %.tp |
dc5af9e3 | 56 | @if $(AM_V_P); then set -x; else echo " GEN $@"; fi; \ |
a4e2c093 | 57 | $(PYTHON) $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $< |
b25c5b37 YB |
58 | |
59 | .PHONY: clean | |
60 | clean: | |
61 | rm -f *.o sample | |
62 | rm -f sample_tracepoint.h sample_tracepoint.c |