Commit 553873e1 authored by Borislav Petkov's avatar Borislav Petkov Committed by Arnaldo Carvalho de Melo

tools/: Convert to new topic libraries

Move debugfs.* to api/fs/. We have a common tools/lib/api/ place where
the Makefile lives and then we place the headers in subdirs.

For example, all the fs-related stuff goes to tools/lib/api/fs/ from
which we get libapikfs.a (acme got almost the naming he wanted :-)) and
we link it into the tools which need it - in this case perf and
tools/vm/page-types.

acme:

"Looking at the implementation, I think some tools can even link
directly to the .o files, avoiding the .a file altogether.

But that is just an optimization/finer granularity tools/lib/
cherrypicking that toolers can make use of."

Fixup documentation cleaning target while at it.
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Acked-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <rric@kernel.org>
Cc: Stanislav Fomichev <stfomichev@yandex-team.ru>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386605664-24041-2-git-send-email-bp@alien8.deSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent b283d2f3
...@@ -39,10 +39,10 @@ cpupower: FORCE ...@@ -39,10 +39,10 @@ cpupower: FORCE
cgroup firewire guest usb virtio vm net: FORCE cgroup firewire guest usb virtio vm net: FORCE
$(call descend,$@) $(call descend,$@)
liblk: FORCE libapikfs: FORCE
$(call descend,lib/lk) $(call descend,lib/api)
perf: liblk FORCE perf: libapikfs FORCE
$(call descend,$@) $(call descend,$@)
selftests: FORCE selftests: FORCE
...@@ -80,10 +80,10 @@ cpupower_clean: ...@@ -80,10 +80,10 @@ cpupower_clean:
cgroup_clean firewire_clean lguest_clean usb_clean virtio_clean vm_clean net_clean: cgroup_clean firewire_clean lguest_clean usb_clean virtio_clean vm_clean net_clean:
$(call descend,$(@:_clean=),clean) $(call descend,$(@:_clean=),clean)
liblk_clean: libapikfs_clean:
$(call descend,lib/lk,clean) $(call descend,lib/api,clean)
perf_clean: liblk_clean perf_clean: libapikfs_clean
$(call descend,$(@:_clean=),clean) $(call descend,$(@:_clean=),clean)
selftests_clean: selftests_clean:
......
include ../../scripts/Makefile.include include ../../scripts/Makefile.include
include ../../perf/config/utilities.mak # QUIET_CLEAN
CC = $(CROSS_COMPILE)gcc CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar AR = $(CROSS_COMPILE)ar
...@@ -7,11 +8,11 @@ AR = $(CROSS_COMPILE)ar ...@@ -7,11 +8,11 @@ AR = $(CROSS_COMPILE)ar
LIB_H= LIB_H=
LIB_OBJS= LIB_OBJS=
LIB_H += debugfs.h LIB_H += fs/debugfs.h
LIB_OBJS += $(OUTPUT)debugfs.o LIB_OBJS += $(OUTPUT)fs/debugfs.o
LIBFILE = liblk.a LIBFILE = libapikfs.a
CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC
EXTLIBS = -lelf -lpthread -lrt -lm EXTLIBS = -lelf -lpthread -lrt -lm
...@@ -25,14 +26,17 @@ $(LIBFILE): $(LIB_OBJS) ...@@ -25,14 +26,17 @@ $(LIBFILE): $(LIB_OBJS)
$(LIB_OBJS): $(LIB_H) $(LIB_OBJS): $(LIB_H)
$(OUTPUT)%.o: %.c libapi_dirs:
$(QUIET_MKDIR)mkdir -p $(OUTPUT)fs/
$(OUTPUT)%.o: %.c libapi_dirs
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
$(OUTPUT)%.s: %.c $(OUTPUT)%.s: %.c libapi_dirs
$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $< $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
$(OUTPUT)%.o: %.S $(OUTPUT)%.o: %.S libapi_dirs
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
clean: clean:
$(RM) $(LIB_OBJS) $(LIBFILE) $(call QUIET_CLEAN, libapi) $(RM) $(LIB_OBJS) $(LIBFILE)
.PHONY: clean .PHONY: clean
#ifndef __LK_DEBUGFS_H__ #ifndef __API_DEBUGFS_H__
#define __LK_DEBUGFS_H__ #define __API_DEBUGFS_H__
#define _STR(x) #x #define _STR(x) #x
#define STR(x) _STR(x) #define STR(x) _STR(x)
...@@ -26,4 +26,4 @@ char *debugfs_mount(const char *mountpoint); ...@@ -26,4 +26,4 @@ char *debugfs_mount(const char *mountpoint);
extern char debugfs_mountpoint[]; extern char debugfs_mountpoint[];
#endif /* __LK_DEBUGFS_H__ */ #endif /* __API_DEBUGFS_H__ */
...@@ -86,7 +86,7 @@ FLEX = flex ...@@ -86,7 +86,7 @@ FLEX = flex
BISON = bison BISON = bison
STRIP = strip STRIP = strip
LK_DIR = $(srctree)/tools/lib/lk/ LIB_DIR = $(srctree)/tools/lib/api/
TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/ TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
# include config/Makefile by default and rule out # include config/Makefile by default and rule out
...@@ -127,20 +127,20 @@ strip-libs = $(filter-out -l%,$(1)) ...@@ -127,20 +127,20 @@ strip-libs = $(filter-out -l%,$(1))
ifneq ($(OUTPUT),) ifneq ($(OUTPUT),)
TE_PATH=$(OUTPUT) TE_PATH=$(OUTPUT)
ifneq ($(subdir),) ifneq ($(subdir),)
LK_PATH=$(OUTPUT)/../lib/lk/ LIB_PATH=$(OUTPUT)/../lib/api/
else else
LK_PATH=$(OUTPUT) LIB_PATH=$(OUTPUT)
endif endif
else else
TE_PATH=$(TRACE_EVENT_DIR) TE_PATH=$(TRACE_EVENT_DIR)
LK_PATH=$(LK_DIR) LIB_PATH=$(LIB_DIR)
endif endif
LIBTRACEEVENT = $(TE_PATH)libtraceevent.a LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
export LIBTRACEEVENT export LIBTRACEEVENT
LIBLK = $(LK_PATH)liblk.a LIBAPIKFS = $(LIB_PATH)libapikfs.a
export LIBLK export LIBAPIKFS
# python extension build directories # python extension build directories
PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/ PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/
...@@ -151,7 +151,7 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP ...@@ -151,7 +151,7 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBLK) PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPIKFS)
$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
$(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \ $(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
...@@ -441,7 +441,7 @@ BUILTIN_OBJS += $(OUTPUT)builtin-inject.o ...@@ -441,7 +441,7 @@ BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o
BUILTIN_OBJS += $(OUTPUT)builtin-mem.o BUILTIN_OBJS += $(OUTPUT)builtin-mem.o
PERFLIBS = $(LIB_FILE) $(LIBLK) $(LIBTRACEEVENT) PERFLIBS = $(LIB_FILE) $(LIBAPIKFS) $(LIBTRACEEVENT)
# We choose to avoid "if .. else if .. else .. endif endif" # We choose to avoid "if .. else if .. else .. endif endif"
# because maintaining the nesting to match is a pain. If # because maintaining the nesting to match is a pain. If
...@@ -730,19 +730,19 @@ $(LIBTRACEEVENT)-clean: ...@@ -730,19 +730,19 @@ $(LIBTRACEEVENT)-clean:
install-traceevent-plugins: $(LIBTRACEEVENT) install-traceevent-plugins: $(LIBTRACEEVENT)
$(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) install_plugins $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) install_plugins
LIBLK_SOURCES = $(wildcard $(LK_PATH)*.[ch]) LIBAPIKFS_SOURCES = $(wildcard $(LIB_PATH)fs/*.[ch])
# if subdir is set, we've been called from above so target has been built # if subdir is set, we've been called from above so target has been built
# already # already
$(LIBLK): $(LIBLK_SOURCES) $(LIBAPIKFS): $(LIBAPIKFS_SOURCES)
ifeq ($(subdir),) ifeq ($(subdir),)
$(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) liblk.a $(QUIET_SUBDIR0)$(LIB_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libapikfs.a
endif endif
$(LIBLK)-clean: $(LIBAPIKFS)-clean:
ifeq ($(subdir),) ifeq ($(subdir),)
$(call QUIET_CLEAN, liblk) $(call QUIET_CLEAN, libapikfs)
@$(MAKE) -C $(LK_DIR) O=$(OUTPUT) clean >/dev/null @$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
endif endif
help: help:
...@@ -881,12 +881,11 @@ config-clean: ...@@ -881,12 +881,11 @@ config-clean:
$(call QUIET_CLEAN, config) $(call QUIET_CLEAN, config)
@$(MAKE) -C config/feature-checks clean >/dev/null @$(MAKE) -C config/feature-checks clean >/dev/null
clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean config-clean clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
$(call QUIET_CLEAN, core-objs) $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS) $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf
$(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
$(call QUIET_CLEAN, Documentation) $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
@$(MAKE) -C Documentation O=$(OUTPUT) clean >/dev/null
$(python-clean) $(python-clean)
# #
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "util/parse-options.h" #include "util/parse-options.h"
#include "util/trace-event.h" #include "util/trace-event.h"
#include "util/debug.h" #include "util/debug.h"
#include <lk/debugfs.h> #include <api/fs/debugfs.h>
#include "util/tool.h" #include "util/tool.h"
#include "util/stat.h" #include "util/stat.h"
#include "util/top.h" #include "util/top.h"
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include "util/strfilter.h" #include "util/strfilter.h"
#include "util/symbol.h" #include "util/symbol.h"
#include "util/debug.h" #include "util/debug.h"
#include <lk/debugfs.h> #include <api/fs/debugfs.h>
#include "util/parse-options.h" #include "util/parse-options.h"
#include "util/probe-finder.h" #include "util/probe-finder.h"
#include "util/probe-event.h" #include "util/probe-event.h"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "util/quote.h" #include "util/quote.h"
#include "util/run-command.h" #include "util/run-command.h"
#include "util/parse-events.h" #include "util/parse-events.h"
#include <lk/debugfs.h> #include <api/fs/debugfs.h>
#include <pthread.h> #include <pthread.h>
const char perf_usage_string[] = const char perf_usage_string[] =
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "evsel.h" #include "evsel.h"
#include "evlist.h" #include "evlist.h"
#include "fs.h" #include "fs.h"
#include <lk/debugfs.h> #include <api/fs/debugfs.h>
#include "tests.h" #include "tests.h"
#include <linux/hw_breakpoint.h> #include <linux/hw_breakpoint.h>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Released under the GPL v2. (and only v2, not any later version) * Released under the GPL v2. (and only v2, not any later version)
*/ */
#include "util.h" #include "util.h"
#include <lk/debugfs.h> #include <api/fs/debugfs.h>
#include <poll.h> #include <poll.h>
#include "cpumap.h" #include "cpumap.h"
#include "thread_map.h" #include "thread_map.h"
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <byteswap.h> #include <byteswap.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <lk/debugfs.h> #include <api/fs/debugfs.h>
#include <traceevent/event-parse.h> #include <traceevent/event-parse.h>
#include <linux/hw_breakpoint.h> #include <linux/hw_breakpoint.h>
#include <linux/perf_event.h> #include <linux/perf_event.h>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "symbol.h" #include "symbol.h"
#include "cache.h" #include "cache.h"
#include "header.h" #include "header.h"
#include <lk/debugfs.h> #include <api/fs/debugfs.h>
#include "parse-events-bison.h" #include "parse-events-bison.h"
#define YY_EXTRA_TYPE int #define YY_EXTRA_TYPE int
#include "parse-events-flex.h" #include "parse-events-flex.h"
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include "color.h" #include "color.h"
#include "symbol.h" #include "symbol.h"
#include "thread.h" #include "thread.h"
#include <lk/debugfs.h> #include <api/fs/debugfs.h>
#include "trace-event.h" /* For __maybe_unused */ #include "trace-event.h" /* For __maybe_unused */
#include "probe-event.h" #include "probe-event.h"
#include "probe-finder.h" #include "probe-finder.h"
......
...@@ -25,7 +25,7 @@ cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ...@@ -25,7 +25,7 @@ cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter'
build_lib = getenv('PYTHON_EXTBUILD_LIB') build_lib = getenv('PYTHON_EXTBUILD_LIB')
build_tmp = getenv('PYTHON_EXTBUILD_TMP') build_tmp = getenv('PYTHON_EXTBUILD_TMP')
libtraceevent = getenv('LIBTRACEEVENT') libtraceevent = getenv('LIBTRACEEVENT')
liblk = getenv('LIBLK') libapikfs = getenv('LIBAPIKFS')
ext_sources = [f.strip() for f in file('util/python-ext-sources') ext_sources = [f.strip() for f in file('util/python-ext-sources')
if len(f.strip()) > 0 and f[0] != '#'] if len(f.strip()) > 0 and f[0] != '#']
...@@ -34,7 +34,7 @@ perf = Extension('perf', ...@@ -34,7 +34,7 @@ perf = Extension('perf',
sources = ext_sources, sources = ext_sources,
include_dirs = ['util/include'], include_dirs = ['util/include'],
extra_compile_args = cflags, extra_compile_args = cflags,
extra_objects = [libtraceevent, liblk], extra_objects = [libtraceevent, libapikfs],
) )
setup(name='perf', setup(name='perf',
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include "../perf.h" #include "../perf.h"
#include "trace-event.h" #include "trace-event.h"
#include <lk/debugfs.h> #include <api/fs/debugfs.h>
#include "evsel.h" #include "evsel.h"
#define VERSION "0.5" #define VERSION "0.5"
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
#include <linux/magic.h> #include <linux/magic.h>
#include "types.h" #include "types.h"
#include <sys/ttydefaults.h> #include <sys/ttydefaults.h>
#include <lk/debugfs.h> #include <api/fs/debugfs.h>
#include <termios.h> #include <termios.h>
#include <linux/bitops.h> #include <linux/bitops.h>
......
...@@ -2,21 +2,21 @@ ...@@ -2,21 +2,21 @@
# #
TARGETS=page-types slabinfo TARGETS=page-types slabinfo
LK_DIR = ../lib/lk LIB_DIR = ../lib/api
LIBLK = $(LK_DIR)/liblk.a LIBS = $(LIB_DIR)/libapikfs.a
CC = $(CROSS_COMPILE)gcc CC = $(CROSS_COMPILE)gcc
CFLAGS = -Wall -Wextra -I../lib/ CFLAGS = -Wall -Wextra -I../lib/
LDFLAGS = $(LIBLK) LDFLAGS = $(LIBS)
$(TARGETS): liblk $(TARGETS): $(LIBS)
liblk: $(LIBS):
make -C $(LK_DIR) make -C $(LIB_DIR)
%: %.c %: %.c
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
clean: clean:
$(RM) page-types slabinfo $(RM) page-types slabinfo
make -C ../lib/lk clean make -C $(LIB_DIR) clean
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <sys/statfs.h> #include <sys/statfs.h>
#include "../../include/uapi/linux/magic.h" #include "../../include/uapi/linux/magic.h"
#include "../../include/uapi/linux/kernel-page-flags.h" #include "../../include/uapi/linux/kernel-page-flags.h"
#include <lk/debugfs.h> #include <api/fs/debugfs.h>
#ifndef MAX_PATH #ifndef MAX_PATH
# define MAX_PATH 256 # define MAX_PATH 256
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment