All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Subject: [PATCH v2 13/15] libtracefs: Build in the same directories as the source
Date: Fri, 17 Dec 2021 00:50:39 -0500	[thread overview]
Message-ID: <20211217055041.19559-14-rostedt@goodmis.org> (raw)
In-Reply-To: <20211217055041.19559-1-rostedt@goodmis.org>

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Modify the descend macro to create the same directory as the source is in
and build the objects in that directory.

Sort out the "lib" directory to only have the libraries built in that
directory.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile         | 18 ++++++++++--------
 scripts/utils.mk |  3 ++-
 src/Makefile     |  3 ---
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index bf085bfdb800..6e18e0a015f5 100644
--- a/Makefile
+++ b/Makefile
@@ -119,13 +119,16 @@ srctree		:= $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR))
 objtree		:= $(BUILD_OUTPUT)
 src		:= $(srctree)
 obj		:= $(objtree)
-bdir		:= $(obj)/lib/tracefs
+bdir		:= $(obj)/lib
 
 export prefix src obj bdir
 
 LIBTRACEFS_STATIC = $(bdir)/libtracefs.a
 LIBTRACEFS_SHARED = $(bdir)/libtracefs.so.$(TRACEFS_VERSION)
 
+LIBTRACEFS_SHARED_SO = $(bdir)/libtracefs.so
+LIBTRACEFS_SHARED_VERSION = $(bdir)/libtracefs.so.$(TFS_VERSION)
+
 PKG_CONFIG_SOURCE_FILE = libtracefs.pc
 PKG_CONFIG_FILE := $(addprefix $(obj)/,$(PKG_CONFIG_SOURCE_FILE))
 
@@ -134,6 +137,7 @@ LIBS = $(LIBTRACEEVENT_LIBS) -lpthread
 export LIBS
 export LIBTRACEFS_STATIC LIBTRACEFS_SHARED
 export LIBTRACEEVENT_LIBS LIBTRACEEVENT_INCLUDES
+export LIBTRACEFS_SHARED_SO LIBTRACEFS_SHARED_VERSION
 
 export Q SILENT VERBOSE EXT
 
@@ -165,12 +169,12 @@ LIB_TARGET  = libtracefs.a libtracefs.so.$(TRACEFS_VERSION)
 LIB_INSTALL = libtracefs.a libtracefs.so*
 LIB_INSTALL := $(addprefix $(bdir)/,$(LIB_INSTALL))
 
-TARGETS = $(LIBTRACEFS_SHARED) $(LIBTRACEFS_STATIC)
+TARGETS = libtracefs.so libtracefs.a
 
 all_cmd: $(TARGETS) $(PKG_CONFIG_FILE)
 
-libtracefs.a: $(LIBTRACEFS_STATIC)
-libtracefs.so: $(LIBTRACEFS_SHARED)
+libtracefs.a: $(bdir) $(LIBTRACEFS_STATIC)
+libtracefs.so: $(bdir) $(LIBTRACEFS_SHARED)
 
 libs: libtracefs.a libtracefs.so
 
@@ -357,19 +361,17 @@ $(VERSION_FILE): force
 	$(Q)$(call update_version.h)
 
 $(LIBTRACEFS_STATIC): force
-	$(Q)mkdir -p $(bdir)
 	$(Q)$(call descend,$(src)/src,$@)
 
 $(bdir)/libtracefs.so.$(TRACEFS_VERSION): force
-	$(Q)mkdir -p $(bdir)
 	$(Q)$(call descend,$(src)/src,libtracefs.so)
 
-samples/sqlhist: $(LIBTRACEFS_STATIC)
+samples/sqlhist: libtracefs.a
 	$(Q)$(call descend,$(src)/samples,sqlhist)
 
 sqlhist: samples/sqlhist
 
-samples: $(LIBTRACEFS_STATIC) force
+samples: libtracefs.a force
 	$(Q)$(call descend,$(src)/samples,all)
 
 clean:
diff --git a/scripts/utils.mk b/scripts/utils.mk
index 0f6225d3ee68..3bf59c550b1d 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -120,7 +120,8 @@ endif
 #
 descend = \
 	($(print_descend)		\
-	$(MAKE) $(PRINT_DIR) -C $(1) $(2))
+	mkdir -p $(obj)/$(BASE1); \
+	$(MAKE) $(PRINT_DIR) bdir=$(obj)/$(BASE1) -C $(1) $(2))
 
 
 define make_version.h
diff --git a/src/Makefile b/src/Makefile
index f284c70a640a..985744ba1118 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -22,9 +22,6 @@ OBJS += tracefs-sqlhist.o
 OBJS := $(OBJS:%.o=$(bdir)/%.o)
 DEPS := $(OBJS:$(bdir)/%.o=$(bdir)/.%.d)
 
-LIBTRACEFS_SHARED_SO = $(bdir)/libtracefs.so
-LIBTRACEFS_SHARED_VERSION = $(bdir)/libtracefs.so.$(TFS_VERSION)
-
 $(LIBTRACEFS_STATIC): $(OBJS)
 	$(Q)$(call do_build_static_lib)
 
-- 
2.33.0


  parent reply	other threads:[~2021-12-17  5:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17  5:50 [PATCH v2 00/15] libtracefs: Updates to the Makefile Steven Rostedt
2021-12-17  5:50 ` [PATCH v2 01/15] libtracefs: Update gitignore file Steven Rostedt
2021-12-17  5:50 ` [PATCH v2 02/15] libtracefs: Have make tags and TAGS honor O= build directory Steven Rostedt
2021-12-17  5:50 ` [PATCH v2 03/15] libtracefs: Fix stream example Steven Rostedt
2021-12-17  5:50 ` [PATCH v2 04/15] libtracefs: Fix samples Makefile Steven Rostedt
2021-12-17  5:50 ` [PATCH v2 05/15] libtracefs: Remove unused "bindir" from Makefile Steven Rostedt
2021-12-17  5:50 ` [PATCH v2 06/15] libtracefs: Remove unneeded blkflags " Steven Rostedt
2021-12-17  5:50 ` [PATCH v2 07/15] libtracefs: Add "DESCEND" output when descending into directories during build Steven Rostedt
2021-12-17  5:50 ` [PATCH v2 08/15] libtracefs: Have make clean output cleaner Steven Rostedt
2021-12-17  5:50 ` [PATCH v2 09/15] libtracefs: Quiet mv: cannot stat message for libtracefs.a Steven Rostedt
2021-12-17  5:50 ` [PATCH v2 10/15] libtracefs: Quiet "Nothing to be done for" messages Steven Rostedt
2021-12-17  5:50 ` [PATCH v2 11/15] libtracefs: Have sample build look cleaner Steven Rostedt
2021-12-17  5:50 ` [PATCH v2 12/15] libtracefs: Have samples build in separate directory from bin Steven Rostedt
2021-12-17  5:50 ` Steven Rostedt [this message]
2021-12-17  5:50 ` [PATCH v2 14/15] libtracefs: Add clean descend Steven Rostedt
2021-12-17  5:50 ` [PATCH v2 15/15] libtracefs: Remove build_prefix file on make clean Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211217055041.19559-14-rostedt@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.