LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@redhat.com>,
	Pekka Enberg <penberg@kernel.org>,
	Andi Kleen <ak@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/5] perf tools: Separate out GTK codes to libperf-gtk.so
Date: Thu, 15 Nov 2012 01:47:42 +0900
Message-ID: <1352911664-24620-4-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1352911664-24620-1-git-send-email-namhyung@kernel.org>

Separate out GTK codes to a shared object called libperf-gtk.so.
In order to do that all objects are compiled as PIC like libtraceevent.
For now whole libperf and libtraceevent are built into it.

Cc: Andi Kleen <ak@linux.intel.com>
Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/Makefile |   36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index cd1f346a9f8b..502080cc1b3d 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -105,7 +105,7 @@ endif
 
 CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
 EXTLIBS = -lpthread -lrt -lelf -lm
-ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -fPIC
 ALL_LDFLAGS = $(LDFLAGS)
 STRIP ?= strip
 
@@ -639,17 +639,27 @@ ifndef NO_GTK2
 		msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
 	else
 		ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
-			BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
+			GTK_CFLAGS = -DHAVE_GTK_INFO_BAR
 		endif
-		BASIC_CFLAGS += -DGTK2_SUPPORT
-		BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
-		EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
-		LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/setup.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/util.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/progress.o
-	endif
+		GTK_CFLAGS += $(ALL_CFLAGS) -DGTK2_SUPPORT
+		GTK_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
+		GTK_LIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
+		GTK_OBJS := $(OUTPUT)ui/gtk/browser.o
+		GTK_OBJS += $(OUTPUT)ui/gtk/setup.o
+		GTK_OBJS += $(OUTPUT)ui/gtk/util.o
+		GTK_OBJS += $(OUTPUT)ui/gtk/helpline.o
+		GTK_OBJS += $(OUTPUT)ui/gtk/progress.o
+		GTK_H := ui/gtk/gtk.h
+
+$(GTK_OBJS): %.o: %.c $(LIB_H) $(GTK_H)
+	$(QUIET_CC)$(CC) -o $@ -c $(GTK_CFLAGS) $<
+
+$(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS)
+	$(QUIET_LINK)$(CC) -o $@ -shared $(GTK_CFLAGS) $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) $(GTK_LIBS)
+
+all: $(OUTPUT)libperf-gtk.so
+
+endif
 endif
 
 ifdef NO_LIBPERL
@@ -1098,8 +1108,8 @@ $(INSTALL_DOC_TARGETS):
 ### Cleaning rules
 
 clean: $(LIBTRACEEVENT)-clean
-	$(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS)
-	$(RM) $(ALL_PROGRAMS) perf
+	$(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(GTK_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS)
+	$(RM) $(ALL_PROGRAMS) $(OUTPUT)libperf-gtk.so
 	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope*
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
 	$(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS
-- 
1.7.9.2


  parent reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14 16:47 [RFC 0/5] perf ui/gtk: Separate out GTK codes to a shared object Namhyung Kim
2012-11-14 16:47 ` [PATCH 1/5] perf ui: Always compile error printing code Namhyung Kim
2013-01-24 18:36   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-11-14 16:47 ` [PATCH 2/5] perf ui/helpline: Introduce ui_helpline__vshow() Namhyung Kim
2013-01-24 18:37   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-11-14 16:47 ` Namhyung Kim [this message]
2012-11-14 16:47 ` [PATCH 4/5] perf tools: Setup GTK browser dynamically Namhyung Kim
2012-11-14 16:47 ` [PATCH 5/5] perf report: Run dynamic loaded GTK browser Namhyung Kim
2012-11-15  7:43 ` [RFC 0/5] perf ui/gtk: Separate out GTK codes to a shared object Pekka Enberg
2012-11-15  8:51   ` Namhyung Kim

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=1352911664-24620-4-git-send-email-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=acme@ghostprotocols.net \
    --cc=ak@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=penberg@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git