From: Mathieu Desnoyers Date: Thu, 20 Jun 2013 12:50:33 +0000 (-0400) Subject: Fix: examples Makefile on FreeBSD X-Git-Tag: v0.8.0~64 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c50fdd7ca0b4b3fb0c4bee53780040b415e059bf;p=userspace-rcu.git Fix: examples Makefile on FreeBSD Support BSD-style make. Fixes #565 Signed-off-by: Mathieu Desnoyers --- diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am index 646213b..6f427c0 100644 --- a/doc/examples/Makefile.am +++ b/doc/examples/Makefile.am @@ -1,17 +1,24 @@ -if NO_SHARED -# Don't build examples if shared libraries support was explicitly -# disabled. -else -SUBDIRS = qsbr-minimal - doc_examplesdir = ${docdir}/examples doc_examples_qsbr_minimaldir = ${doc_examplesdir}/qsbr-minimal -doc_examples_qsbr_minimal_DATA = \ +dist_doc_examples_qsbr_minimal_DATA = \ qsbr-minimal/Makefile \ qsbr-minimal/qsbr-minimal.c -BUILD_EXAMPLES_FROM_TREE = 1 -export +if NO_SHARED +# Don't build examples if shared libraries support was explicitly +# disabled. +else +SUBDIRS_PROXY = qsbr-minimal + +all-local: + for subdir in $(SUBDIRS_PROXY); do \ + cd $$subdir && $(MAKE) AM_CPPFLAGS="-I../../../urcu/ -I../../../" AM_LDFLAGS='-L../../../.libs/ -Wl,-rpath="$(PWD)/../../.libs/"' $(AM_MAKEFLAGS) all; \ + done + +clean-local: + for subdir in $(SUBDIRS_PROXY); do \ + cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) clean; \ + done endif diff --git a/doc/examples/qsbr-minimal/Makefile b/doc/examples/qsbr-minimal/Makefile index 53f1380..b0400cb 100644 --- a/doc/examples/qsbr-minimal/Makefile +++ b/doc/examples/qsbr-minimal/Makefile @@ -8,35 +8,23 @@ # Permission to modify the code and to distribute modified code is # granted, provided the above notices are retained, and a notice that # the code was modified is included with the above copyright notice. +# +# This makefile is purposefully kept simple to support GNU and BSD make. CC = gcc LIBS = -lurcu-qsbr CFLAGS = -g -O2 -Wall - -# Only necessary when building from the source tree and userspace RCU is -# not installed -ifdef BUILD_EXAMPLES_FROM_TREE -LOCAL_CPPFLAGS += -I../../../urcu/ -I../../../ -LIBURCU_QSBR_PATH = ../../../.libs/ -override LDFLAGS += -L$(LIBURCU_QSBR_PATH) -Wl,-rpath='$$ORIGIN/$(LIBURCU_QSBR_PATH)' - -# Third-party Makefiles have to define these targets to integrate with an -# automake project -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 +OBJECTS = qsbr-minimal.o all: qsbr-minimal -qsbr-minimal: qsbr-minimal.o - $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) +qsbr-minimal: $(OBJECTS) + $(CC) $(CFLAGS) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) \ + $(LIBS) -o $@ $(OBJECTS) qsbr-minimal.o: qsbr-minimal.c - $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $< + $(CC) $(CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) $(AM_CFLAGS) \ + -c -o $@ $< .PHONY: clean clean: