Commit | Line | Data |
---|---|---|
60302adc JG |
1 | # Copyright (C) 2013 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
2 | # | |
3 | # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED | |
4 | # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. | |
5 | # | |
6 | # Permission is hereby granted to use or copy this program for any | |
7 | # purpose, provided the above notices are retained on all copies. | |
8 | # Permission to modify the code and to distribute modified code is | |
9 | # granted, provided the above notices are retained, and a notice that | |
10 | # the code was modified is included with the above copyright notice. | |
11 | ||
a106a9f8 JG |
12 | # This Makefile is not using automake so that users may see how to build |
13 | # a program with tracepoint provider probes as stand-alone shared objects. | |
60302adc JG |
14 | |
15 | CC = gcc | |
16 | LIBS = -ldl # On Linux | |
17 | #LIBS = -lc # On BSD | |
2e390600 | 18 | LOCAL_CPPFLAGS += -I. |
a106a9f8 JG |
19 | |
20 | # Only necessary when building from the source tree and lttng-ust is not | |
21 | # installed | |
22 | ifdef BUILD_EXAMPLES_FROM_TREE | |
2e390600 | 23 | LOCAL_CPPFLAGS += -I../../../include/ |
a106a9f8 | 24 | LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/ |
2e390600 | 25 | override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)' |
a106a9f8 JG |
26 | |
27 | # Third-party Makefiles have to define these targets to integrate with an | |
28 | # automake project | |
29 | EMPTY_AUTOMAKE_TARGETS = distdir install install-data install-exec uninstall \ | |
30 | install-dvi install-html install-info install-ps install-pdf \ | |
31 | installdirs check installcheck mostlyclean distclean maintainer-clean \ | |
32 | dvi html pdf ps info tags ctags | |
33 | .PHONY: $(EMPTY_AUTOMAKE_TARGETS) | |
34 | $(EMPTY_AUTOMAKE_TARGETS): | |
35 | endif | |
60302adc JG |
36 | |
37 | all: demo lttng-ust-provider-ust-tests-demo.so lttng-ust-provider-ust-tests-demo3.so | |
38 | ||
08a10b1b | 39 | tp.o: tp.c ust_tests_demo.h |
2e390600 | 40 | $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $< |
60302adc | 41 | |
08a10b1b | 42 | tp2.o: tp2.c ust_tests_demo2.h |
2e390600 | 43 | $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $< |
08a10b1b MD |
44 | |
45 | lttng-ust-provider-ust-tests-demo.so: tp.o tp2.o | |
8e950684 | 46 | $(CC) -shared -o $@ $(LDFLAGS) -llttng-ust $^ |
60302adc | 47 | |
08a10b1b | 48 | tp3.o: tp3.c ust_tests_demo3.h |
2e390600 | 49 | $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $< |
60302adc | 50 | |
08a10b1b | 51 | lttng-ust-provider-ust-tests-demo3.so: tp3.o |
8e950684 | 52 | $(CC) -shared -o $@ $(LDFLAGS) -llttng-ust $^ |
60302adc JG |
53 | |
54 | demo.o: demo.c | |
2e390600 | 55 | $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $< |
60302adc JG |
56 | |
57 | demo: demo.o | |
0802d36a | 58 | $(CC) -o $@ $^ $(LIBS) |
60302adc JG |
59 | |
60 | .PHONY: clean | |
61 | clean: | |
62 | rm -f *.o *.so demo |