All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladislav Valtchev (VMware)" <vladislav.valtchev@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com,
	"Vladislav Valtchev (VMware)" <vladislav.valtchev@gmail.com>
Subject: [PATCH v2 05/24] trace-cmd: Extract part of Makefile in scripts/utils.mk
Date: Tue,  6 Feb 2018 10:48:47 +0200	[thread overview]
Message-ID: <20180206084906.9854-6-vladislav.valtchev@gmail.com> (raw)
In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com>

This patch extracts useful functions for Makefile in order to allow the new
Makefiles that will be introduced in the next steps to reuse them.

Signed-off-by: Vladislav Valtchev (VMware) <vladislav.valtchev@gmail.com>
---
 Makefile         | 57 +++----------------------------------------------
 scripts/utils.mk | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 54 deletions(-)
 create mode 100644 scripts/utils.mk

diff --git a/Makefile b/Makefile
index 3c21a27..3b5045e 100644
--- a/Makefile
+++ b/Makefile
@@ -204,10 +204,6 @@ VERSION		= $(KS_VERSION)
 PATCHLEVEL	= $(KS_PATCHLEVEL)
 EXTRAVERSION	= $(KS_EXTRAVERSION)
 
-GUI		= 'GUI '
-GOBJ		= $@
-GSPACE		=
-
 REBUILD_GUI	= /bin/true
 G		=
 N 		= @/bin/true ||
@@ -223,10 +219,6 @@ VERSION		= $(TC_VERSION)
 PATCHLEVEL	= $(TC_PATCHLEVEL)
 EXTRAVERSION	= $(TC_EXTRAVERSION)
 
-GUI		=
-GSPACE		= "    "
-GOBJ		= $(GSPACE)$@
-
 REBUILD_GUI	= $(MAKE) -f $(src)/Makefile BUILDGUI=1 $@
 G		= $(REBUILD_GUI); /bin/true ||
 N		=
@@ -234,6 +226,9 @@ endif
 
 export Q VERBOSE
 
+# Include the utils
+include scripts/utils.mk
+
 TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION)
 KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION)
 
@@ -280,52 +275,6 @@ endif
 override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) $(VAR_DIR)
 override CFLAGS += $(udis86-flags) $(blk-flags)
 
-ifeq ($(VERBOSE),1)
-  Q =
-  print_compile =
-  print_app_build =
-  print_fpic_compile =
-  print_shared_lib_compile =
-  print_plugin_obj_compile =
-  print_plugin_build =
-  print_install =
-else
-  Q = @
-  print_compile =		echo '  $(GUI)COMPILE            '$(GOBJ);
-  print_app_build =		echo '  $(GUI)BUILD              '$(GOBJ);
-  print_fpic_compile =		echo '  $(GUI)COMPILE FPIC       '$(GOBJ);
-  print_shared_lib_compile =	echo '  $(GUI)COMPILE SHARED LIB '$(GOBJ);
-  print_plugin_obj_compile =	echo '  $(GUI)COMPILE PLUGIN OBJ '$(GOBJ);
-  print_plugin_build =		echo '  $(GUI)BUILD PLUGIN       '$(GOBJ);
-  print_static_lib_build =	echo '  $(GUI)BUILD STATIC LIB   '$(GOBJ);
-  print_install =		echo '  $(GUI)INSTALL     '$(GSPACE)$1'	to	$(DESTDIR_SQ)$2';
-endif
-
-do_fpic_compile =					\
-	($(print_fpic_compile)				\
-	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) -fPIC $< -o $@)
-
-do_app_build =						\
-	($(print_app_build)				\
-	$(CC) $^ -rdynamic -o $@ $(LDFLAGS) $(CONFIG_LIBS) $(LIBS))
-
-do_compile_shared_library =			\
-	($(print_shared_lib_compile)		\
-	$(CC) --shared $^ -o $@)
-
-do_compile_plugin_obj =				\
-	($(print_plugin_obj_compile)		\
-	$(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $<)
-
-do_plugin_build =				\
-	($(print_plugin_build)			\
-	$(CC) $(CFLAGS) $(LDFLAGS) -shared -nostartfiles -o $@ $<)
-
-do_build_static_lib =				\
-	($(print_static_lib_build)		\
-	$(RM) $@;  $(AR) rcs $@ $^)
-
-
 define check_gui
 	if [ $(BUILDGUI) -ne 1 -a ! -z "$(filter $(gui_objs),$(@))" ];	then	\
 		$(REBUILD_GUI);							\
diff --git a/scripts/utils.mk b/scripts/utils.mk
new file mode 100644
index 0000000..39cb387
--- /dev/null
+++ b/scripts/utils.mk
@@ -0,0 +1,64 @@
+
+# Utils
+
+ifeq ($(BUILDGUI), 1)
+  GUI		= 'GUI '
+  GOBJ		= $@
+  GSPACE	=
+else
+  GUI		=
+  GSPACE	= "    "
+  GOBJ		= $(GSPACE)$@
+endif
+
+
+ifeq ($(VERBOSE),1)
+  Q =
+  print_compile =
+  print_app_build =
+  print_fpic_compile =
+  print_shared_lib_compile =
+  print_plugin_obj_compile =
+  print_plugin_build =
+  print_install =
+else
+  Q = @
+  print_compile =		echo '  $(GUI)COMPILE            '$(GOBJ);
+  print_app_build =		echo '  $(GUI)BUILD              '$(GOBJ);
+  print_fpic_compile =		echo '  $(GUI)COMPILE FPIC       '$(GOBJ);
+  print_shared_lib_compile =	echo '  $(GUI)COMPILE SHARED LIB '$(GOBJ);
+  print_plugin_obj_compile =	echo '  $(GUI)COMPILE PLUGIN OBJ '$(GOBJ);
+  print_plugin_build =		echo '  $(GUI)BUILD PLUGIN       '$(GOBJ);
+  print_static_lib_build =	echo '  $(GUI)BUILD STATIC LIB   '$(GOBJ);
+  print_install =		echo '  $(GUI)INSTALL     '$(GSPACE)$1'	to	$(DESTDIR_SQ)$2';
+endif
+
+
+do_compile =				\
+	($(print_compile)			\
+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) $< -o $@)
+
+do_fpic_compile =					\
+	($(print_fpic_compile)				\
+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) -fPIC $< -o $@)
+
+do_app_build =						\
+	($(print_app_build)				\
+	$(CC) $^ -rdynamic -o $@ $(LDFLAGS) $(CONFIG_LIBS) $(LIBS))
+
+do_build_static_lib =				\
+	($(print_static_lib_build)		\
+	$(RM) $@;  $(AR) rcs $@ $^)
+
+do_compile_shared_library =			\
+	($(print_shared_lib_compile)		\
+	$(CC) --shared $^ -o $@)
+
+do_compile_plugin_obj =				\
+	($(print_plugin_obj_compile)		\
+	$(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $<)
+
+do_plugin_build =				\
+	($(print_plugin_build)			\
+	$(CC) $(CFLAGS) $(LDFLAGS) -shared -nostartfiles -o $@ $<)
+
-- 
2.14.1

  parent reply	other threads:[~2018-02-06  8:49 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06  8:48 [PATCH v2 00/24] trace-cmd: restructure the project's source tree Vladislav Valtchev (VMware)
2018-02-06  8:48 ` [PATCH v2 01/24] trace-cmd: Rename libparsevent to libtraceevent Vladislav Valtchev (VMware)
2018-02-06  8:48 ` [PATCH v2 02/24] trace-cmd: Move libtraceevent headers in include/traceevent Vladislav Valtchev (VMware)
2018-02-06  8:48 ` [PATCH v2 03/24] trace-cmd: Move trace-cmd headers in include/trace-cmd Vladislav Valtchev (VMware)
2018-02-06  8:48 ` [PATCH v2 04/24] trace-cmd: Move event-utils.h in lib/traceevent/include Vladislav Valtchev (VMware)
2018-02-06  8:48 ` Vladislav Valtchev (VMware) [this message]
2018-02-06  8:48 ` [PATCH v2 06/24] trace-cmd: Move libtraceevent *.c files in lib/traceevent Vladislav Valtchev (VMware)
2018-02-06  8:48 ` [PATCH v2 07/24] trace-cmd: Move trace-hash-local.h in lib/trace-cmd/include Vladislav Valtchev (VMware)
2018-02-06  8:48 ` [PATCH v2 08/24] trace-cmd: Move libtracecmd *.c files in lib/trace-cmd Vladislav Valtchev (VMware)
2018-02-06  8:48 ` [PATCH v2 09/24] trace-cmd: Move GUI headers in kernel-shark/include Vladislav Valtchev (VMware)
2018-02-06  8:48 ` [PATCH v2 10/24] trace-cmd: Move GUI *.c files in kernel-shark/ Vladislav Valtchev (VMware)
2018-02-06  8:48 ` [PATCH v2 11/24] trace-cmd: Move plugin_* files in plugins/ Vladislav Valtchev (VMware)
2018-02-06  8:48 ` [PATCH v2 12/24] trace-cmd: Fix the broken target ctracecmdgui.so Vladislav Valtchev (VMware)
2018-02-06  8:48 ` [PATCH v2 13/24] trace-cmd: Move python-related files in python/ Vladislav Valtchev (VMware)
2018-02-07 19:22   ` Steven Rostedt
2018-02-07 19:36     ` Steven Rostedt
2018-02-08  7:17       ` Vladislav K. Valtchev
2018-02-07 20:11     ` Steven Rostedt
2018-02-08  7:29       ` Vladislav K. Valtchev
2018-02-06  8:48 ` [PATCH v2 14/24] trace-cmd: Move tracecmd headers in tracecmd/include Vladislav Valtchev (VMware)
2018-02-06  8:48 ` [PATCH v2 15/24] trace-cmd: Move version.h in include/ Vladislav Valtchev (VMware)
2018-02-06  8:48 ` [PATCH v2 16/24] trace-cmd: Move trace-cmd app files in tracecmd/ Vladislav Valtchev (VMware)
2018-02-06  8:48 ` [PATCH v2 17/24] trace-cmd: Fix the logic behind SWIG_DEFINED in the Makefile Vladislav Valtchev (VMware)
2018-02-06  8:49 ` [PATCH v2 18/24] trace-cmd: Make the build to tell when python-dev is missing Vladislav Valtchev (VMware)
2018-02-06  8:49 ` [PATCH v2 19/24] trace-cmd: Make libtraceevent builable out-of-tree Vladislav Valtchev (VMware)
2018-02-06  8:49 ` [PATCH v2 20/24] trace-cmd: Make the plugins buildable out-of-tree Vladislav Valtchev (VMware)
2018-02-06  8:49 ` [PATCH v2 21/24] trace-cmd: Make libtracecmd " Vladislav Valtchev (VMware)
2018-02-06  8:49 ` [PATCH v2 22/24] trace-cmd: Make the trace-cmd target " Vladislav Valtchev (VMware)
2018-02-06  8:49 ` [PATCH v2 23/24] trace-cmd: Make the python targets " Vladislav Valtchev (VMware)
2018-02-06  8:49 ` [PATCH v2 24/24] trace-cmd: Make the GUI " Vladislav Valtchev (VMware)
2018-02-07  0:27 ` [PATCH v2 00/24] trace-cmd: restructure the project's source tree Steven Rostedt
2018-02-07 13:15   ` Vladislav Valtchev

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=20180206084906.9854-6-vladislav.valtchev@gmail.com \
    --to=vladislav.valtchev@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=y.karadz@gmail.com \
    /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.