| 1 | # SPDX-License-Identifier: MIT |
| 2 | # |
| 3 | # Copyright (C) 2011-2012 Matthew Khouzam <matthew.khouzam@ericsson.com> |
| 4 | # Copyright (C) 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 5 | # |
| 6 | # This makefile is not using automake so that users can see how to build |
| 7 | # a program with a statically embedded tracepoint provider probe. |
| 8 | # the "html" target helps for documentation (req. code2html) |
| 9 | # |
| 10 | # This makefile is purposefully kept simple to support GNU and BSD make. |
| 11 | |
| 12 | LIBS = -ldl -llttng-ust # On Linux |
| 13 | #LIBS = -lc -llttng-ust # On BSD |
| 14 | LOCAL_CPPFLAGS += -I. |
| 15 | AM_V_P := : |
| 16 | |
| 17 | all: sample |
| 18 | |
| 19 | sample: sample.o tp.o |
| 20 | @if $(AM_V_P); then set -x; else echo " CCLD $@"; fi; \ |
| 21 | $(CC) -o $@ $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \ |
| 22 | sample.o tp.o $(LIBS) |
| 23 | |
| 24 | sample.o: sample.c sample_component_provider.h |
| 25 | @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \ |
| 26 | $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \ |
| 27 | $(CFLAGS) -c -o $@ $< |
| 28 | |
| 29 | tp.o: tp.c sample_component_provider.h |
| 30 | @if $(AM_V_P); then set -x; else echo " CC $@"; fi; \ |
| 31 | $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \ |
| 32 | $(CFLAGS) -c -o $@ $< |
| 33 | |
| 34 | html: sample_component_provider.html sample.html tp.html |
| 35 | |
| 36 | %.html: %.c |
| 37 | code2html -lc $< $@ |
| 38 | |
| 39 | %.html : %.h |
| 40 | code2html -lc $< $@ |
| 41 | |
| 42 | .PHONY: clean |
| 43 | clean: |
| 44 | rm -f *.html |
| 45 | rm -f *.o sample |