| 1 | # SPDX-License-Identifier: MIT |
| 2 | # |
| 3 | # Copyright (C) 2013 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 4 | # |
| 5 | # This Makefile is not using automake so that users may see how to build |
| 6 | # a program with tracepoint provider probes as stand-alone shared objects. |
| 7 | # |
| 8 | # This makefile is purposefully kept simple to support GNU and BSD make. |
| 9 | |
| 10 | LIBS = -ldl # On Linux |
| 11 | #LIBS = -lc # On BSD |
| 12 | LOCAL_CPPFLAGS += -I. |
| 13 | AM_V_P := : |
| 14 | |
| 15 | all: demo lttng-ust-provider-ust-tests-demo.so lttng-ust-provider-ust-tests-demo3.so |
| 16 | |
| 17 | tp.o: tp.c ust_tests_demo.h |
| 18 | @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \ |
| 19 | $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \ |
| 20 | $(CFLAGS) -fpic -c -o $@ $< |
| 21 | |
| 22 | tp2.o: tp2.c ust_tests_demo2.h |
| 23 | @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \ |
| 24 | $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \ |
| 25 | $(CFLAGS) -fpic -c -o $@ $< |
| 26 | |
| 27 | lttng-ust-provider-ust-tests-demo.so: tp.o tp2.o |
| 28 | @if $(AM_V_P); then set -x; else echo " CCLD $@"; fi; \ |
| 29 | $(CC) -Wl,--no-as-needed -o $@ $(LDFLAGS) $(AM_CFLAGS) \ |
| 30 | $(AM_LDFLAGS) $(CFLAGS) -shared -fpic tp.o tp2.o $(LIBS) -llttng-ust |
| 31 | |
| 32 | tp3.o: tp3.c ust_tests_demo3.h |
| 33 | @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \ |
| 34 | $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \ |
| 35 | $(CFLAGS) -fpic -c -o $@ $< |
| 36 | |
| 37 | lttng-ust-provider-ust-tests-demo3.so: tp3.o |
| 38 | @if $(AM_V_P); then set -x; else echo " CCLD $@"; fi; \ |
| 39 | $(CC) -Wl,--no-as-needed -o $@ $(LDFLAGS) $(AM_CFLAGS) \ |
| 40 | $(AM_LDFLAGS) $(CFLAGS) -shared -fpic tp3.o $(LIBS) -llttng-ust |
| 41 | |
| 42 | demo.o: demo.c |
| 43 | @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \ |
| 44 | $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \ |
| 45 | $(CFLAGS) -c -o $@ $< |
| 46 | |
| 47 | demo: demo.o |
| 48 | @if $(AM_V_P); then set -x; else echo " CCLD $@"; fi; \ |
| 49 | $(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \ |
| 50 | -o $@ demo.o $(LIBS) |
| 51 | |
| 52 | .PHONY: clean |
| 53 | clean: |
| 54 | rm -f *.o *.so demo |