Skip to contentSkip to conversation

Use config.h to define SONAME major number

PATCH New Michael Jeanson 2 participants 4 messages Dec 20, 2018 – Dec 21, 2018 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/4 Use config.h to define SONAME major number

---
 configure.ac                  | 2 +-
 liblttng-ust/Makefile.am      | 2 --
 liblttng-ust/lttng-ust-comm.c | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)
configure.ac +1 -1
index 431ed21a..9ab76501 100644
@@ -25,7 +25,7 @@ m4_define([UST_LIB_V_MINOR], [0])
 m4_define([UST_LIB_V_PATCH], [0])
 
 AC_SUBST([LTTNG_UST_LIBRARY_VERSION], [UST_LIB_V_MAJOR:UST_LIB_V_MINOR:UST_LIB_V_PATCH])
-AC_SUBST([LTTNG_UST_LIBRARY_VERSION_MAJOR], [UST_LIB_V_MAJOR])
+AC_DEFINE([CONFIG_LTTNG_UST_LIBRARY_VERSION_MAJOR], [UST_LIB_V_MAJOR], [Major SONAME number of the ust library])
 # note: remember to update tracepoint.h dlopen() to match this version
 # number. TODO: eventually automate by exporting the major number.
 
liblttng-ust/Makefile.am +0 -2
index ea4c8f61..15655280 100644
@@ -63,8 +63,6 @@ liblttng_ust_runtime_la_SOURCES = \
 	string-utils.c \
 	string-utils.h
 
-liblttng_ust_runtime_la_CFLAGS = -DLTTNG_UST_LIBRARY_VERSION_MAJOR=\"$(LTTNG_UST_LIBRARY_VERSION_MAJOR)\"
-
 if HAVE_PERF_EVENT
 liblttng_ust_runtime_la_SOURCES += \
 	lttng-context-perf-counters.c \
liblttng-ust/lttng-ust-comm.c +1 -1
index a09f676a..eab2d8eb 100644
@@ -61,7 +61,7 @@
 #include "getenv.h"
 
 /* Concatenate lttng ust shared library name with its major version number. */
-#define LTTNG_UST_LIB_SO_NAME "liblttng-ust.so." LTTNG_UST_LIBRARY_VERSION_MAJOR
+#define LTTNG_UST_LIB_SO_NAME "liblttng-ust.so." __ust_stringify(CONFIG_LTTNG_UST_LIBRARY_VERSION_MAJOR)
 
 /*
  * Has lttng ust comm constructor been called ?
Signature · 1 line
2.17.1
#2 lore raw

PATCH 3/4 Add silent rules support for docs

In reply to a message not in the archive
---
 doc/man/Makefile.am | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
doc/man/Makefile.am +13 -4
index fcc4c5c7..f562bfd1 100644
@@ -47,26 +47,35 @@ MAN = $(MAN1) $(MAN3)
 if MAN_PAGES_OPT
 # At this point, we know the user asked to build the man pages.
 if HAVE_ASCIIDOC_XMLTO
+
+asciidoc_verbose = $(asciidoc_verbose_@AM_V@)
+asciidoc_verbose_ = $(asciidoc_verbose_@AM_DEFAULT_V@)
+asciidoc_verbose_0 = @echo "  ASCIIDOC  " $@;
+
+xmlto_verbose = $(xmlto_verbose_@AM_V@)
+xmlto_verbose_ = $(xmlto_verbose_@AM_DEFAULT_V@)
+xmlto_verbose_0 = @echo "  XMLTO     " $@;
+
 # Tools to execute:
-ADOC = $(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
+ADOC = $(asciidoc_verbose)$(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
 	-a lttng_version="$(PACKAGE_VERSION)" \
 	-a lttng_ust_register_timeout="@LTTNG_UST_DEFAULT_CONSTRUCTOR_TIMEOUT_MS@"
 
 ADOC_DOCBOOK = $(ADOC) -b docbook
-XTO = $(XMLTO) -m $(XSL_FILE) man
+XTO = $(xmlto_verbose)$(XMLTO) -m $(XSL_FILE) man
 
 # Recipes:
 %.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
 	$(ADOC_DOCBOOK) -o $@ $<
 
 %.1: %.1.xml $(XSL_FILE)
-	$(XTO) $<
+	$(XTO) $< 2>/dev/null
 
 %.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
 	$(ADOC_DOCBOOK) -o $@ $<
 
 %.3: %.3.xml $(XSL_FILE)
-	$(XTO) $<
+	$(XTO) $< 2>/dev/null
 
 # Only clean the generated files if we have the tools to generate them again.
 CLEANFILES = $(MAN_XML) $(MAN)
Signature · 1 line
2.17.1
#3 lore raw

PATCH 4/4 Add silent mode to examples Makefiles

In reply to a message not in the archive
---
 doc/examples/Makefile.am               | 10 +++-------
 doc/examples/clock-override/Makefile   |  7 +++++--
 doc/examples/demo-tracef/Makefile      |  7 +++++--
 doc/examples/demo-tracelog/Makefile    |  7 +++++--
 doc/examples/demo/Makefile             | 22 +++++++++++++++-------
 doc/examples/easy-ust/Makefile         | 10 +++++++---
 doc/examples/gen-tp/Makefile           | 24 +++++++++++++++---------
 doc/examples/getcpu-override/Makefile  |  7 +++++--
 doc/examples/hello-static-lib/Makefile | 13 +++++++++----
 9 files changed, 69 insertions(+), 38 deletions(-)
doc/examples/Makefile.am +3 -7
index 493e07dd..d5d00b09 100644
@@ -106,28 +106,24 @@ SUBDIRS_PROXY += gen-tp
 endif
 
 all-local:
-	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+	$(AM_V_at)if [ x"$(srcdir)" != x"$(builddir)" ]; then \
 		for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL) $(SUBDIRS_LOG4J) $(SUBDIRS_CMAKE); do \
 			cp -pfR $(srcdir)/$$subdir $(builddir); \
 			chmod -R u+w $(builddir)/$$subdir; \
 		done; \
 	fi; \
 	if [ x"$(shell echo "$(top_srcdir)" | grep "^/" | wc -l)" = x"1" ]; then \
-		echo "Examples: absolute top_srcdir path $(top_srcdir)"; \
 		rel_src_subdir=""; \
 	else \
-		echo "Examples: relative top_srcdir path $(top_srcdir)"; \
 		rel_src_subdir="../"; \
 	fi; \
 	if [ x"$(shell echo "$(top_builddir)" | grep "^/" | wc -l)" = x"1" ]; then \
-		echo "Examples: absolute top_builddir path $(top_builddir)"; \
 		rel_build_subdir=""; \
 	else \
-		echo "Examples: relative top_builddir path $(top_builddir)"; \
 		rel_build_subdir="../"; \
 	fi; \
 	for subdir in $(SUBDIRS_PROXY); do \
-		(cd $$subdir && $(MAKE) CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" AM_CPPFLAGS="$(AM_CPPFLAGS) -I$$rel_src_subdir$(top_srcdir)/include/ -I$$rel_build_subdir$(top_builddir)/include/" CFLAGS='$(CFLAGS)' AM_CFLAGS='$(AM_CFLAGS)' LDFLAGS="$(LDFLAGS)" AM_LDFLAGS='$(AM_LDFLAGS) -L../../../liblttng-ust/.libs -Wl,-rpath="$(PWD)/../../liblttng-ust/.libs/" -Wl,-rpath-link="$(PWD)/../../liblttng-ust/.libs/"' LTTNG_GEN_TP_PATH="../../../tools/" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
+		(cd $$subdir && $(MAKE) CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" AM_CPPFLAGS="$(AM_CPPFLAGS) -I$$rel_src_subdir$(top_srcdir)/include/ -I$$rel_build_subdir$(top_builddir)/include/" CFLAGS='$(CFLAGS)' AM_CFLAGS='$(AM_CFLAGS)' LDFLAGS="$(LDFLAGS)" AM_LDFLAGS='$(AM_LDFLAGS) -L../../../liblttng-ust/.libs -Wl,-rpath="$(PWD)/../../liblttng-ust/.libs/" -Wl,-rpath-link="$(PWD)/../../liblttng-ust/.libs/"' LTTNG_GEN_TP_PATH="../../../tools/" AM_V_P="$(AM_V_P)" AM_V_at="$(AM_V_at)" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
 	done; \
 	if [ x"$(SUBDIRS_JUL)" != x"" ]; then \
 		for subdir in $(SUBDIRS_JUL); do \
@@ -162,7 +158,7 @@ all-local:
 
 
 clean-local:
-	@for subdir in $(SUBDIRS_PROXY); do \
+	$(AM_V_at)for subdir in $(SUBDIRS_PROXY); do \
 		if [ -d $$subdir ]; then \
 			(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) clean && cd ..) || exit 1; \
 		fi; \
doc/examples/clock-override/Makefile +5 -2
index 22e5dffb..bd29f179 100644
@@ -18,15 +18,18 @@
 LIBS = -ldl	# On Linux
 #LIBS = -lc	# On BSD
 LOCAL_CPPFLAGS += -I.
+AM_V_P := :
 
 all: lttng-ust-clock-override-example.so
 
 lttng-ust-clock-override-example.o: lttng-ust-clock-override-example.c
-	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
 		$(CFLAGS) -fpic -c -o $@ $<
 
 lttng-ust-clock-override-example.so: lttng-ust-clock-override-example.o
-	$(CC) -Wl,--no-as-needed -o $@ $(LDFLAGS) $(AM_CFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CCLD     $@"; fi; \
+		$(CC) -Wl,--no-as-needed -o $@ $(LDFLAGS) $(AM_CFLAGS) \
 		$(AM_LDFLAGS) $(CFLAGS) -shared -fpic lttng-ust-clock-override-example.o
 
 .PHONY: clean
doc/examples/demo-tracef/Makefile +5 -2
index 1e4544c4..ee207843 100644
@@ -18,15 +18,18 @@
 LIBS = -ldl -llttng-ust	# On Linux
 #LIBS = -lc	# On BSD
 LOCAL_CPPFLAGS += -I.
+AM_V_P := :
 
 all: demo-tracef
 
 demo-tracef.o: demo-tracef.c
-	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
 		$(CFLAGS) -c -o $@ $<
 
 demo-tracef: demo-tracef.o
-	$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CCLD     $@"; fi; \
+		$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
 		-o $@ $< $(LIBS)
 
 .PHONY: clean
doc/examples/demo-tracelog/Makefile +5 -2
index a16d6c52..0d9a20aa 100644
@@ -18,15 +18,18 @@
 LIBS = -ldl -llttng-ust	# On Linux
 #LIBS = -lc	# On BSD
 LOCAL_CPPFLAGS += -I.
+AM_V_P := :
 
 all: demo-tracelog
 
 demo-tracelog.o: demo-tracelog.c
-	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
 		$(CFLAGS) -c -o $@ $<
 
 demo-tracelog: demo-tracelog.o
-	$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CCLD     $@"; fi; \
+		$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
 		-o $@ $< $(LIBS)
 
 .PHONY: clean
doc/examples/demo/Makefile +15 -7
index bb7fc173..b309ef6e 100644
@@ -17,35 +17,43 @@
 LIBS = -ldl	# On Linux
 #LIBS = -lc	# On BSD
 LOCAL_CPPFLAGS += -I.
+AM_V_P := :
 
 all: demo lttng-ust-provider-ust-tests-demo.so lttng-ust-provider-ust-tests-demo3.so
 
 tp.o: tp.c ust_tests_demo.h
-	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
 		$(CFLAGS) -fpic -c -o $@ $<
 
 tp2.o: tp2.c ust_tests_demo2.h
-	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
 		$(CFLAGS) -fpic -c -o $@ $<
 
 lttng-ust-provider-ust-tests-demo.so: tp.o tp2.o
-	$(CC) -Wl,--no-as-needed -o $@ $(LDFLAGS) $(AM_CFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CCLD     $@"; fi; \
+		$(CC) -Wl,--no-as-needed -o $@ $(LDFLAGS) $(AM_CFLAGS) \
 		$(AM_LDFLAGS) $(CFLAGS) -shared -fpic tp.o tp2.o $(LIBS) -llttng-ust
 
 tp3.o: tp3.c ust_tests_demo3.h
-	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
 		$(CFLAGS) -fpic -c -o $@ $<
 
 lttng-ust-provider-ust-tests-demo3.so: tp3.o
-	$(CC) -Wl,--no-as-needed -o $@ $(LDFLAGS) $(AM_CFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CCLD     $@"; fi; \
+		$(CC) -Wl,--no-as-needed -o $@ $(LDFLAGS) $(AM_CFLAGS) \
 		$(AM_LDFLAGS) $(CFLAGS) -shared -fpic tp3.o $(LIBS) -llttng-ust
 
 demo.o: demo.c
-	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
 		$(CFLAGS) -c -o $@ $<
 
 demo: demo.o
-	$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CCLD     $@"; fi; \
+		$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
 		-o $@ demo.o $(LIBS)
 
 .PHONY: clean
doc/examples/easy-ust/Makefile +7 -3
index 02272938..9e957ccf 100644
@@ -19,19 +19,23 @@
 LIBS = -ldl -llttng-ust		# On Linux
 #LIBS = -lc -llttng-ust		# On BSD
 LOCAL_CPPFLAGS += -I.
+AM_V_P := :
 
 all: sample
 
 sample: sample.o tp.o
-	$(CC) -o $@ $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CCLD     $@"; fi; \
+		$(CC) -o $@ $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
 		sample.o tp.o $(LIBS)
 
 sample.o: sample.c sample_component_provider.h
-	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
 		$(CFLAGS) -c -o $@ $<
 
 tp.o: tp.c sample_component_provider.h
-	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
 		$(CFLAGS) -c -o $@ $<
 
 html: sample_component_provider.html sample.html tp.html
doc/examples/gen-tp/Makefile +15 -9
index 6d9ec10d..bc172f0c 100644
@@ -19,15 +19,18 @@
 
 LIBS = -ldl -llttng-ust		#On Linux
 #LIBS = -lc -llttng-ust		#On BSD
+AM_V_P := :
 
 all: sample
 
 sample: sample.o sample_tracepoint.o
-	$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CCLD     $@"; fi; \
+		$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
 		-o $@ sample.o sample_tracepoint.o $(LIBS)
 
 sample.o: sample.c sample_tracepoint.h
-	$(CC) $(CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) \
 		-c -o $@ $<
 
 # Use this command to compile the .c manually
@@ -38,11 +41,12 @@ sample.o: sample.c sample_tracepoint.h
 # This rule generate .o only and depends on rules for generating
 # the .h and .c
 %.o: %.tp %.c %.h
-	CPPFLAGS="$(AM_CPPFLAGS) $(CPPFLAGS)" \
-	CFLAGS="$(AM_CFLAGS) $(CFLAGS)" \
-	LDFLAGS="$(AM_LDFLAGS) $(LDFLAGS)" \
-	CC="$(CC)" \
-	$(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		CPPFLAGS="$(AM_CPPFLAGS) $(CPPFLAGS)" \
+		CFLAGS="$(AM_CFLAGS) $(CFLAGS)" \
+		LDFLAGS="$(AM_LDFLAGS) $(LDFLAGS)" \
+		CC="$(CC)" \
+		$(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
 
 # The following rule can be used to generate all files instead of having one
 # for each file type. Note that the sample.o has a dependency on the
@@ -51,10 +55,12 @@ sample.o: sample.c sample_tracepoint.h
 #	lttng-gen-tp $<
 
 %.h: %.tp
-	$(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
+	@if $(AM_V_P); then set -x; else echo "  GEN      $@"; fi; \
+		$(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
 
 %.c: %.tp
-	$(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
+	@if $(AM_V_P); then set -x; else echo "  GEN      $@"; fi; \
+		$(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
 
 .PHONY: clean
 clean:
doc/examples/getcpu-override/Makefile +5 -2
index e1e4892c..435b851d 100644
@@ -18,15 +18,18 @@
 LIBS = -ldl	# On Linux
 #LIBS = -lc	# On BSD
 LOCAL_CPPFLAGS += -I.
+AM_V_P := :
 
 all: lttng-ust-getcpu-override-example.so
 
 lttng-ust-getcpu-override-example.o: lttng-ust-getcpu-override-example.c
-	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
 		$(CFLAGS) -fpic -c -o $@ $<
 
 lttng-ust-getcpu-override-example.so: lttng-ust-getcpu-override-example.o
-	$(CC) -Wl,--no-as-needed -o $@ $(LDFLAGS) $(AM_CFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CCLD     $@"; fi; \
+		$(CC) -Wl,--no-as-needed -o $@ $(LDFLAGS) $(AM_CFLAGS) \
 		$(AM_LDFLAGS) $(CFLAGS) -shared -fpic lttng-ust-getcpu-override-example.o
 
 .PHONY: clean
doc/examples/hello-static-lib/Makefile +9 -4
index cf72b35d..c5fdd31c 100644
@@ -17,22 +17,27 @@
 LOCAL_CPPFLAGS += -I.
 LIBS = -ldl -llttng-ust	# On Linux
 #LIBS = -lc -llttng-ust	# On BSD
+AM_V_P := :
 
 all: hello
 
 lttng-ust-provider-hello.o: tp.c ust_tests_hello.h
-	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
 		$(CFLAGS) -c -o $@ $<
 
 lttng-ust-provider-hello.a: lttng-ust-provider-hello.o
-	ar -rc $@ lttng-ust-provider-hello.o
+	@if $(AM_V_P); then set -x; else echo "  AR       $@"; fi; \
+		ar -rc $@ lttng-ust-provider-hello.o
 
 hello.o: hello.c
-	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
 		$(CFLAGS) -c -o $@ $<
 
 hello: hello.o lttng-ust-provider-hello.a
-	$(CC) -o $@ $(LDFLAGS) $(CPPFLAGS) $(AM_LDFLAGS) $(AM_CFLAGS) \
+	@if $(AM_V_P); then set -x; else echo "  CCLD     $@"; fi; \
+		$(CC) -o $@ $(LDFLAGS) $(CPPFLAGS) $(AM_LDFLAGS) $(AM_CFLAGS) \
 		$(CFLAGS) hello.o lttng-ust-provider-hello.a $(LIBS)
 
 .PHONY: clean
Signature · 1 line
2.17.1
#4 lore raw

Re: [PATCH lttng-ust 1/4] Use a variable to select the dlopen lib in Makefiles

In reply to a message not in the archive

All 4 patches merged into master, thanks!

Mathieu

Quoted 414 lines · ----- On Dec 20, 2018, at 3:22 PM, Michael Jeanson [email protected] wrote:

Instead of multiple conditionnals, it makes for cleaner and more readable Makefiles.

---

configure.ac                           |  8 +++-----
liblttng-ust-cyg-profile/Makefile.am   | 17 ++++++-----------
liblttng-ust-dl/Makefile.am            | 11 +++--------
liblttng-ust-fd/Makefile.am            | 11 +++--------
liblttng-ust-fork/Makefile.am          | 10 ++--------
liblttng-ust-libc-wrapper/Makefile.am  | 18 +++++++-----------
liblttng-ust/Makefile.am               | 22 ++++++----------------
tests/benchmark/Makefile.am            | 14 +++-----------
tests/ctf-types/Makefile.am            |  9 +--------
tests/hello-many/Makefile.am           |  9 +--------
tests/hello.cxx/Makefile.am            |  9 +--------
tests/hello/Makefile.am                |  9 +--------
tests/same_line_tracepoint/Makefile.am |  9 +--------
tests/test-app-ctx/Makefile.am         |  9 +--------
tests/ust-variant/Makefile.am          |  9 +--------
15 files changed, 40 insertions(+), 134 deletions(-)
configure.ac +0 -0
index 2ea15533..431ed21a 100644
@@ -207,17 +207,18 @@ AH_TEMPLATE([LTTNG_UST_HAVE_PERF_EVENT], [Perf event

integration via perf_event.

# Checks for libraries.
AC_CHECK_LIB([dl], [dlopen], [

configure.ac +0 -1
-	have_libdl=yes

libdl_name=dl

configure.ac +1 -0
+	DL_LIBS="-ldl"

], [

	#libdl not found, check for dlopen in libc.
	AC_CHECK_LIB([c], [dlopen], [
configure.ac +0 -1
-		have_libc_dl=yes

libdl_name=c

configure.ac +1 -0
+		DL_LIBS="-lc"
	], [
		AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to
		specify their location.])
	])

])
+AC_SUBST(DL_LIBS)

# Check if libdl has dlmopen support. AH_TEMPLATE([HAVE_DLMOPEN], ["Define to 1 if dlmopen is available."])

configure.ac +0 -3
@@ -225,9 +226,6 @@ AC_CHECK_LIB([$libdl_name], [dlmopen],
 	[AC_DEFINE([HAVE_DLMOPEN], [1])]
 )
 
-AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBDL], [test "x$have_libdl" = "xyes"])
-AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBC_DL], [test "x$have_libc_dl" =
 "xyes"])
-
 AC_CHECK_LIB([pthread], [pthread_create])
 AC_CHECK_LIB([pthread], [pthread_setname_np],
	AC_DEFINE([HAVE_PTHREAD_SETNAME_NP], [1], [Define to 1 if pthread_setname_np is
	available.]),
liblttng-ust-cyg-profile/Makefile.am +6 -11
index 3130282d..0ed2cd9c 100644
@@ -7,25 +7,20 @@ lib_LTLIBRARIES = liblttng-ust-cyg-profile.la \
 liblttng_ust_cyg_profile_la_SOURCES = \
 	lttng-ust-cyg-profile.c \
 	lttng-ust-cyg-profile.h
+
 liblttng_ust_cyg_profile_la_LIBADD = \
 	-L$(top_builddir)/liblttng-ust/.libs \
-	-llttng-ust
+	-llttng-ust \
+	$(DL_LIBS)
 
 liblttng_ust_cyg_profile_fast_la_SOURCES = \
 	lttng-ust-cyg-profile-fast.c \
 	lttng-ust-cyg-profile-fast.h
+
 liblttng_ust_cyg_profile_fast_la_LIBADD = \
 	-L$(top_builddir)/liblttng-ust/.libs \
-	-llttng-ust
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-liblttng_ust_cyg_profile_la_LIBADD += -ldl
-liblttng_ust_cyg_profile_fast_la_LIBADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-liblttng_ust_cyg_profile_la_LIBADD += -lc
-liblttng_ust_cyg_profile_fast_la_LIBADD += -lc
-endif
+	-llttng-ust \
+	$(DL_LIBS)
 

noinst_SCRIPTS = run run-fast
EXTRA_DIST = run run-fast

liblttng-ust-dl/Makefile.am +3 -8
index c0168f39..1f6d166a 100644
@@ -6,14 +6,9 @@ liblttng_ust_dl_la_SOURCES = \
 	lttng-ust-dl.c \
 	ust_dl.c \
 	ust_dl.h
-liblttng_ust_dl_la_LIBADD = \
-	$(top_builddir)/liblttng-ust/liblttng-ust.la
 
-if LTTNG_UST_BUILD_WITH_LIBDL
-liblttng_ust_dl_la_LIBADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-liblttng_ust_dl_la_LIBADD += -lc
-endif
+liblttng_ust_dl_la_LIBADD = \
+	$(top_builddir)/liblttng-ust/liblttng-ust.la \
+	$(DL_LIBS)
 
 liblttng_ust_dl_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-dl $(AM_CFLAGS)
liblttng-ust-fd/Makefile.am +0 -0
index f7706634..57122ec7 100644
@@ -4,14 +4,9 @@ AM_CFLAGS += -fno-strict-aliasing

lib_LTLIBRARIES = liblttng-ust-fd.la
liblttng_ust_fd_la_SOURCES = \
lttng-ust-fd.c

liblttng-ust-fd/Makefile.am +3 -8
-liblttng_ust_fd_la_LIBADD = \
-	$(top_builddir)/liblttng-ust/liblttng-ust.la
 
-if LTTNG_UST_BUILD_WITH_LIBDL
-liblttng_ust_fd_la_LIBADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-liblttng_ust_fd_la_LIBADD += -lc
-endif
+liblttng_ust_fd_la_LIBADD = \
+	$(top_builddir)/liblttng-ust/liblttng-ust.la \
+	$(DL_LIBS)

liblttng_ust_fd_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-fd $(AM_CFLAGS)

liblttng-ust-fork/Makefile.am +0 -0
index 2f0976d4..d05f5b93 100644
@@ -4,13 +4,7 @@ AM_CFLAGS += -fno-strict-aliasing

lib_LTLIBRARIES = liblttng-ust-fork.la
liblttng_ust_fork_la_SOURCES = ustfork.c
liblttng_ust_fork_la_LIBADD = \

liblttng-ust-fork/Makefile.am +2 -8
-	$(top_builddir)/liblttng-ust/liblttng-ust.la
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-liblttng_ust_fork_la_LIBADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-liblttng_ust_fork_la_LIBADD += -lc
-endif
+	$(top_builddir)/liblttng-ust/liblttng-ust.la \
+	$(DL_LIBS)

liblttng_ust_fork_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-fork $(AM_CFLAGS)

liblttng-ust-libc-wrapper/Makefile.am +7 -11
index e73b4d88..e510a11a 100644
@@ -3,28 +3,24 @@ AM_CFLAGS += -fno-strict-aliasing
 
 lib_LTLIBRARIES = liblttng-ust-libc-wrapper.la \
  liblttng-ust-pthread-wrapper.la
+
 liblttng_ust_libc_wrapper_la_SOURCES = \
 	lttng-ust-malloc.c \
 	ust_libc.h
+
 liblttng_ust_libc_wrapper_la_LIBADD = \
 	-L$(top_builddir)/liblttng-ust/.libs \
-	-llttng-ust
+	-llttng-ust \
+	$(DL_LIBS)
 
 liblttng_ust_pthread_wrapper_la_SOURCES = \
 	lttng-ust-pthread.c \
 	ust_pthread.h
+
 liblttng_ust_pthread_wrapper_la_LIBADD = \
 	-L$(top_builddir)/liblttng-ust/.libs \
-	-llttng-ust
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-liblttng_ust_libc_wrapper_la_LIBADD += -ldl
-liblttng_ust_pthread_wrapper_la_LIBADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-liblttng_ust_libc_wrapper_la_LIBADD += -lc
-liblttng_ust_pthread_wrapper_la_LIBADD += -lc
-endif
+	-llttng-ust \
+	$(DL_LIBS)
 

noinst_SCRIPTS = run
EXTRA_DIST = run

liblttng-ust/Makefile.am +4 -1
index 57df3aed..ea4c8f61 100644
@@ -12,20 +12,16 @@ liblttng_ust_tracepoint_la_SOURCES = \
 	lttng-tracer-core.h \
 	jhash.h \
 	error.h
+
 liblttng_ust_tracepoint_la_LIBADD = \
 	-lurcu-bp \
 	-lpthread \
-	$(top_builddir)/snprintf/libustsnprintf.la
+	$(top_builddir)/snprintf/libustsnprintf.la \
+	$(DL_LIBS)
+

liblttng_ust_tracepoint_la_LDFLAGS = -no-undefined -version-info $(LTTNG_UST_LIBRARY_VERSION)
liblttng_ust_tracepoint_la_CFLAGS = -DUST_COMPONENT="liblttng_ust_tracepoint" $(AM_CFLAGS)

liblttng-ust/Makefile.am +0 -7
-if LTTNG_UST_BUILD_WITH_LIBDL
-liblttng_ust_tracepoint_la_LIBADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-liblttng_ust_tracepoint_la_LIBADD += -lc
-endif
-
liblttng_ust_runtime_la_SOURCES = \
	lttng-ust-comm.c \
	lttng-ust-abi.c \
liblttng-ust/Makefile.am +2 -8
@@ -106,13 +102,7 @@ liblttng_ust_la_LIBADD = \
 	$(top_builddir)/snprintf/libustsnprintf.la \
 	$(top_builddir)/liblttng-ust-comm/liblttng-ust-comm.la \
 	liblttng-ust-tracepoint.la \
-	liblttng-ust-runtime.la liblttng-ust-support.la
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-liblttng_ust_la_LIBADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-liblttng_ust_la_LIBADD += -lc
-endif
+	liblttng-ust-runtime.la liblttng-ust-support.la \
+	$(DL_LIBS)
 
 liblttng_ust_la_CFLAGS = -DUST_COMPONENT="liblttng_ust" $(AM_CFLAGS)
tests/benchmark/Makefile.am +0 -1
index 4ea420c6..ef9635c0 100644
@@ -2,20 +2,12 @@ AM_CPPFLAGS = -I$(top_srcdir)/include
-I$(top_builddir)/include -Wsystem-headers
 

noinst_PROGRAMS = bench1 bench2 bench1_SOURCES = bench.c tp.c ust_tests_benchmark.h

tests/benchmark/Makefile.am +2 -1
-bench1_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
+bench1_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)
+

bench2_SOURCES = bench.c tp.c ust_tests_benchmark.h

tests/benchmark/Makefile.am +1 -1
-bench2_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
+bench2_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)

bench2_CFLAGS = -DTRACING $(AM_CFLAGS)

dist_noinst_SCRIPTS = test_benchmark ptime

extra_DIST = README

tests/benchmark/Makefile.am +0 -9
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-bench1_LDADD += -ldl
-bench2_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-bench1_LDADD += -lc
-bench2_LDADD += -lc
-endif
tests/ctf-types/Makefile.am +0 -1
index a9b40b6a..42d803f2 100644
@@ -2,12 +2,5 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
-Wsystem-headers
 

noinst_PROGRAMS = ctf-types
ctf_types_SOURCES = ctf-types.c tp.c ust_tests_ctf_types.h

tests/ctf-types/Makefile.am +1 -1
-ctf_types_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
+ctf_types_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)

ctf_types_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)

tests/ctf-types/Makefile.am +0 -7
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-ctf_types_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-ctf_types_LDADD += -lc
-endif
tests/hello-many/Makefile.am +0 -1
index 338b7986..ee648225 100644
@@ -2,12 +2,5 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
-Wsystem-headers
 

noinst_PROGRAMS = hello-many
hello_many_SOURCES = hello-many.c tp.c ust_tests_hello_many.h

tests/hello-many/Makefile.am +1 -1
-hello_many_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
+hello_many_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)

hello_many_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)

tests/hello-many/Makefile.am +0 -7
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-hello_many_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-hello_many_LDADD += -lc
-endif
tests/hello.cxx/Makefile.am +0 -1
index f8a8f46d..4b0fb234 100644
@@ -2,11 +2,4 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
-Wsystem-headers
 

noinst_PROGRAMS = hello
hello_SOURCES = hello.cpp tp-cpp.cpp ust_tests_hello.h

tests/hello.cxx/Makefile.am +1 -8
-hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-hello_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-hello_LDADD += -lc
-endif
+hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)
tests/hello/Makefile.am +0 -1
index cb4d4626..d5e42d33 100644
@@ -2,12 +2,5 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
-Wsystem-headers
 

noinst_PROGRAMS = hello
hello_SOURCES = hello.c tp.c ust_tests_hello.h

tests/hello/Makefile.am +1 -1
-hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
+hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)

hello_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)

tests/hello/Makefile.am +0 -7
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-hello_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-hello_LDADD += -lc
-endif
tests/same_line_tracepoint/Makefile.am +0 -1
index 5cb4f36b..ae1f773d 100644
@@ -2,11 +2,4 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
-Wsystem-headers
 

noinst_PROGRAMS = same_line_tracepoint same_line_tracepoint_SOURCES = same_line_tracepoint.c ust_tests_sameline.h

tests/same_line_tracepoint/Makefile.am +1 -8
-same_line_tracepoint_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-same_line_tracepoint_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-same_line_tracepoint_LDADD += -lc
-endif
+same_line_tracepoint_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la

$(DL_LIBS)

tests/test-app-ctx/Makefile.am +0 -1
index cb4d4626..d5e42d33 100644
@@ -2,12 +2,5 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
-Wsystem-headers
 

noinst_PROGRAMS = hello
hello_SOURCES = hello.c tp.c ust_tests_hello.h

tests/test-app-ctx/Makefile.am +1 -1
-hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
+hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)

hello_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)

tests/test-app-ctx/Makefile.am +0 -7
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-hello_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-hello_LDADD += -lc
-endif
tests/ust-variant/Makefile.am +0 -1
index 5d741bdf..28e62009 100644
@@ -2,12 +2,5 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
-Wsystem-headers
 

noinst_PROGRAMS = ust-variant
ust_variant_SOURCES = ust-variant.c

tests/ust-variant/Makefile.am +1 -1
-ust_variant_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
+ust_variant_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)

ust_variant_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)

tests/ust-variant/Makefile.am +0 -8
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-ust_variant_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-ust_variant_LDADD += -lc
-endif
--

2.17.1

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com