Commit | Line | Data |
---|---|---|
4807c6de MD |
1 | # Copyright (C) 2011-2012 Matthew Khouzam <matthew.khouzam@ericsson.com> |
2 | # Copyright (C) 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
3 | # | |
4 | # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED | |
5 | # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. | |
6 | # | |
7 | # Permission is hereby granted to use or copy this program for any | |
8 | # purpose, provided the above notices are retained on all copies. | |
9 | # Permission to modify the code and to distribute modified code is | |
10 | # granted, provided the above notices are retained, and a notice that | |
11 | # the code was modified is included with the above copyright notice. | |
12 | ||
a106a9f8 JG |
13 | # This makefile is not using automake so that users can see how to build |
14 | # a program with a statically embedded tracepoint provider probe. | |
4807c6de MD |
15 | # the "html" target helps for documentation (req. code2html) |
16 | ||
17 | CC = gcc | |
c6c454ab MD |
18 | LIBS = -ldl -llttng-ust # On Linux |
19 | #LIBS = -lc -llttng-ust # On BSD | |
2e390600 | 20 | LOCAL_CPPFLAGS += -I. |
a106a9f8 JG |
21 | |
22 | # Only necessary when building from the source tree and lttng-ust is not | |
23 | # installed | |
24 | ifdef BUILD_EXAMPLES_FROM_TREE | |
2e390600 | 25 | LOCAL_CPPFLAGS += -I../../../include/ |
a106a9f8 | 26 | LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/ |
2e390600 | 27 | override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)' |
a106a9f8 JG |
28 | |
29 | # Third-party Makefiles have to define these targets to integrate with an | |
30 | # automake project | |
31 | EMPTY_AUTOMAKE_TARGETS = distdir install install-data install-exec uninstall \ | |
32 | install-dvi install-html install-info install-ps install-pdf \ | |
33 | installdirs check installcheck mostlyclean distclean maintainer-clean \ | |
34 | dvi pdf ps info tags ctags | |
35 | .PHONY: $(EMPTY_AUTOMAKE_TARGETS) | |
36 | $(EMPTY_AUTOMAKE_TARGETS): | |
37 | endif | |
4807c6de MD |
38 | |
39 | all: sample | |
40 | ||
41 | sample: sample.o tp.o | |
a106a9f8 | 42 | $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) |
4807c6de MD |
43 | |
44 | sample.o: sample.c sample_component_provider.h | |
2e390600 | 45 | $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $< |
4807c6de MD |
46 | |
47 | tp.o: tp.c sample_component_provider.h | |
2e390600 | 48 | $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $< |
4807c6de MD |
49 | |
50 | html: sample_component_provider.html sample.html tp.html | |
51 | ||
a106a9f8 | 52 | %.html: %.c |
4807c6de MD |
53 | code2html -lc $< $@ |
54 | ||
55 | %.html : %.h | |
56 | code2html -lc $< $@ | |
57 | ||
58 | .PHONY: clean | |
59 | clean: | |
a106a9f8 | 60 | rm -f *.html |
4807c6de | 61 | rm -f *.o sample |