doc/examples/gen-tp: pass automake CPPFLAGS/CFLAGS/LDFLAGS
[lttng-ust.git] / doc / examples / gen-tp / Makefile
CommitLineData
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.
2cd19027 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.
2cd19027
MD
17#
18# This makefile is purposefully kept simple to support GNU and BSD make.
b25c5b37
YB
19
20CC = gcc
c6c454ab
MD
21
22LIBS = -ldl -llttng-ust #On Linux
23#LIBS = -lc -llttng-ust #On BSD
b25c5b37
YB
24
25all: sample
26
db06a0a2 27sample: sample.o sample_tracepoint.o
55bf11fa 28 $(CC) $(LDFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(AM_CFLAGS) \
6689c64e 29 -o $@ sample.o sample_tracepoint.o $(LIBS)
b25c5b37
YB
30
31sample.o: sample.c sample_tracepoint.h
55bf11fa
MD
32 $(CC) $(CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) $(AM_CFLAGS) \
33 -c -o $@ $<
b25c5b37 34
db06a0a2
YB
35# Use this command to compile the .c manually
36#sample_tracepoint.o: sample_tracepoint.c sample_tracepoint.h
55bf11fa
MD
37# $(CC) $(CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) $(AM_CFLAGS) \
38# -I. -c -o $@ $<
db06a0a2
YB
39
40# This rule generate .o only and depends on rules for generating
41# the .h and .c
42%.o: %.tp %.c %.h
acc6a835
MD
43 CPPFLAGS="$(CPPFLAGS) $(AM_CPPFLAGS)" \
44 CFLAGS="$(CFLAGS) $(AM_CFLAGS)" \
45 LDFLAGS="$(LDFLAGS) $(AM_LDFLAGS)" \
55bf11fa 46 $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
db06a0a2
YB
47
48# The following rule can be used to generate all files instead of having one
49# for each file type. Note that the sample.o has a dependency on the
50# .h, so you need to change that if you remove the %.h rule.
51#%.o: %.tp
52# lttng-gen-tp $<
b25c5b37
YB
53
54%.h: %.tp
55bf11fa 55 $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
db06a0a2 56
b25c5b37 57%.c: %.tp
55bf11fa 58 $(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
b25c5b37
YB
59
60.PHONY: clean
61clean:
62 rm -f *.o sample
63 rm -f sample_tracepoint.h sample_tracepoint.c
This page took 0.025751 seconds and 4 git commands to generate.