Project

General

Profile

Bug #648 » Makefile

The Makefile for the simple project - Daniel U. Thibault, 02/28/2014 04:54 PM

 
CC = gcc
LIBDL = -ldl # On Linux
#LIBDL = -lc # On BSD
LIBUST = -llttng-ust
#LIBS = $(LIBDL) $(LIBUST)
LOCAL_CPPFLAGS += -I. $(AM_CPPFLAGS)
LDFLAGS += -L/usr/local/lib $(AM_LDFLAGS)
TP_DEFINE = -D TRACEPOINT_DEFINE

# Only necessary when building from the source tree without lttng-ust
ifdef BUILD_EXAMPLES_FROM_TREE
LOCAL_CPPFLAGS += -I../../../include/
LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/
override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'

# Third-party Makefiles targets for integration with automake projects
EMPTY_AUTOMAKE_TARGETS = distdir install install-data install-exec uninstall \
install-dvi install-html install-info install-ps install-pdf \
installdirs check installcheck mostlyclean distclean \
maintainer-clean dvi pdf ps info tags ctags
.PHONY: $(EMPTY_AUTOMAKE_TARGETS)
$(EMPTY_AUTOMAKE_TARGETS):
endif

all: static

###############################################################################
#Tracepoint provider statically included.
#This is indifferent to the -[no-]as-needed linker flag.
static: static.o simpletp.o
@echo "~~~~~~Linking simple_$@:"
$(CC) -o simple_$@ $^ $(LDFLAGS) $(LIBDL) $(LIBUST)
@echo " Use './simple_$@' to run simple_$@"

static.o: simple.c simpletp.h
@echo "~~~~~~Compiling $@:"
$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(TP_DEFINE) -c -o $@ $<

simpletp.o: simpletp.h
@echo "~~~~~~Compiling $@:"
$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) -c \
-x c -D TRACEPOINT_CREATE_PROBES -o $@ $<

###############################################################################
html: simpletp_provider.html simple.html simpletp.html

%.html: %.c
code2html -lc $< $@

%.html : %.h
code2html -lc $< $@

.PHONY: clean

###############################################################################
clean:
rm -f *.html
rm -f *.o
rm -f simple_static
rm -f *~
(2-2/4)