From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Cc: Daniel Wagner <wagi@monom.org>
Subject: [PATCH] libtracefs: Add meson build targets to Makefile
Date: Wed, 24 Jul 2024 13:47:48 -0400 [thread overview]
Message-ID: <20240724134748.52c18018@gandalf.local.home> (raw)
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Add make targets for building with meson:
make meson
make meson_install
make meson_docs
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
Makefile | 15 ++++++++++++++-
Makefile.meson | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 1 deletion(-)
create mode 100644 Makefile.meson
diff --git a/Makefile b/Makefile
index 7f4f5c3f752c..b0553c341c93 100644
--- a/Makefile
+++ b/Makefile
@@ -400,7 +400,7 @@ sqlhist: samples/sqlhist
samples: libtracefs.a force
$(Q)$(call descend,$(src)/samples,all)
-clean:
+clean: clean_meson
$(Q)$(call descend_clean,utest)
$(Q)$(call descend_clean,src)
$(Q)$(call descend_clean,samples)
@@ -410,6 +410,19 @@ clean:
$(VERSION_FILE) \
$(BUILD_PREFIX))
+meson:
+ $(MAKE) -f Makefile.meson
+
+meson_install:
+ $(MAKE) -f Makefile.meson install
+
+meson_docs:
+ $(MAKE) -f Makefile.meson docs
+
+PHONY += clean_meson
+clean_meson:
+ $(Q)$(MAKE) -f Makefile.meson $@
+
.PHONY: clean
# libtracefs.a and libtracefs.so would concurrently enter the same directory -
diff --git a/Makefile.meson b/Makefile.meson
new file mode 100644
index 000000000000..71d6bf36c654
--- /dev/null
+++ b/Makefile.meson
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: GPL-2.0
+
+undefine CFLAGS
+
+# Makefiles suck: This macro sets a default value of $(2) for the
+# variable named by $(1), unless the variable has been set by
+# environment or command line. This is necessary for CC and AR
+# because make sets default values, so the simpler ?= approach
+# won't work as expected.
+define allow-override
+ $(if $(or $(findstring environment,$(origin $(1))),\
+ $(findstring command line,$(origin $(1)))),,\
+ $(eval $(1) = $(2)))
+endef
+
+$(call allow-override,MESON,meson)
+$(call allow-override,MESON_BUILD_DIR,build)
+
+
+all: compile
+
+PHONY += compile
+compile: $(MESON_BUILD_DIR) force
+ $(MESON) compile -C $(MESON_BUILD_DIR)
+
+$(MESON_BUILD_DIR):
+ $(MESON) setup --prefix=$(prefix) $(MESON_BUILD_DIR)
+
+install: compile
+ $(MESON) install -C $(MESON_BUILD_DIR)
+
+docs: $(MESON_BUILD_DIR)
+ $(MESON) compile -C build docs
+
+PHONY += clean_meson
+clean_meson:
+ $(Q)$(RM) -rf $(MESON_BUILD_DIR)
+
+PHONY += force
+force:
--
2.43.0
reply other threads:[~2024-07-24 17:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240724134748.52c18018@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=wagi@monom.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).