diff options
| author | Jiri Olsa <jolsa@kernel.org> | 2015-01-09 10:38:25 -0500 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-02-12 15:54:39 -0500 |
| commit | b4f9166847354cb839c275c062c6b17afba49211 (patch) | |
| tree | f06b122fd7db299d60c31ba918ad683f89b2761f /tools/lib | |
| parent | f819f703a42eed63443cef796b1852e6baf985bd (diff) | |
tools lib api: Use tools build framework
Move the libapikfs library building under tools build framework.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Tested-by: Will Deacon <will.deacon@arm.com>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-xjo8r7nuqy9mvlfrmx9zcfwb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib')
| -rw-r--r-- | tools/lib/api/Build | 2 | ||||
| -rw-r--r-- | tools/lib/api/Makefile | 62 | ||||
| -rw-r--r-- | tools/lib/api/fd/Build | 1 | ||||
| -rw-r--r-- | tools/lib/api/fs/Build | 4 |
4 files changed, 33 insertions, 36 deletions
diff --git a/tools/lib/api/Build b/tools/lib/api/Build new file mode 100644 index 000000000000..64dd8d466d2c --- /dev/null +++ b/tools/lib/api/Build | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | libapikfs-y += fd/ | ||
| 2 | libapikfs-y += fs/ | ||
diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile index 212aa4fd65a0..1aa47c271313 100644 --- a/tools/lib/api/Makefile +++ b/tools/lib/api/Makefile | |||
| @@ -1,53 +1,43 @@ | |||
| 1 | include ../../scripts/Makefile.include | 1 | include ../../scripts/Makefile.include |
| 2 | include ../../perf/config/utilities.mak # QUIET_CLEAN | 2 | include ../../perf/config/utilities.mak # QUIET_CLEAN |
| 3 | 3 | ||
| 4 | ifeq ($(srctree),) | ||
| 5 | srctree := $(patsubst %/,%,$(dir $(shell pwd))) | ||
| 6 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
| 7 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
| 8 | #$(info Determined 'srctree' to be $(srctree)) | ||
| 9 | endif | ||
| 10 | |||
| 4 | CC = $(CROSS_COMPILE)gcc | 11 | CC = $(CROSS_COMPILE)gcc |
| 5 | AR = $(CROSS_COMPILE)ar | 12 | AR = $(CROSS_COMPILE)ar |
| 6 | 13 | ||
| 7 | # guard against environment variables | 14 | MAKEFLAGS += --no-print-directory |
| 8 | LIB_H= | ||
| 9 | LIB_OBJS= | ||
| 10 | |||
| 11 | LIB_H += fs/debugfs.h | ||
| 12 | LIB_H += fs/tracefs.h | ||
| 13 | LIB_H += fs/findfs.h | ||
| 14 | LIB_H += fs/fs.h | ||
| 15 | # See comment below about piggybacking... | ||
| 16 | LIB_H += fd/array.h | ||
| 17 | |||
| 18 | LIB_OBJS += $(OUTPUT)fs/debugfs.o | ||
| 19 | LIB_OBJS += $(OUTPUT)fs/tracefs.o | ||
| 20 | LIB_OBJS += $(OUTPUT)fs/findfs.o | ||
| 21 | LIB_OBJS += $(OUTPUT)fs/fs.o | ||
| 22 | # XXX piggybacking here, need to introduce libapikfd, or rename this | ||
| 23 | # to plain libapik.a and make it have it all api goodies | ||
| 24 | LIB_OBJS += $(OUTPUT)fd/array.o | ||
| 25 | 15 | ||
| 26 | LIBFILE = libapikfs.a | 16 | LIBFILE = $(OUTPUT)libapikfs.a |
| 27 | 17 | ||
| 28 | CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC | 18 | CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) |
| 29 | EXTLIBS = -lelf -lpthread -lrt -lm | 19 | CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -fPIC |
| 30 | ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 | 20 | CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 |
| 31 | ALL_LDFLAGS = $(LDFLAGS) | ||
| 32 | 21 | ||
| 33 | RM = rm -f | 22 | RM = rm -f |
| 34 | 23 | ||
| 35 | $(LIBFILE): $(LIB_OBJS) | 24 | build := -f $(srctree)/tools/build/Makefile.build dir=. obj |
| 36 | $(QUIET_AR)$(RM) $@ && $(AR) rcs $(OUTPUT)$@ $(LIB_OBJS) | 25 | API_IN := $(OUTPUT)libapikfs-in.o |
| 37 | 26 | ||
| 38 | $(LIB_OBJS): $(LIB_H) | 27 | export srctree OUTPUT CC LD CFLAGS V |
| 39 | 28 | ||
| 40 | libapi_dirs: | 29 | all: $(LIBFILE) |
| 41 | $(QUIET_MKDIR)mkdir -p $(OUTPUT)fd $(OUTPUT)fs | ||
| 42 | 30 | ||
| 43 | $(OUTPUT)%.o: %.c libapi_dirs | 31 | $(API_IN): FORCE |
| 44 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< | 32 | @$(MAKE) $(build)=libapikfs |
| 45 | $(OUTPUT)%.s: %.c libapi_dirs | 33 | |
| 46 | $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $< | 34 | $(LIBFILE): $(API_IN) |
| 47 | $(OUTPUT)%.o: %.S libapi_dirs | 35 | $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN) |
| 48 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< | ||
| 49 | 36 | ||
| 50 | clean: | 37 | clean: |
| 51 | $(call QUIET_CLEAN, libapi) $(RM) $(LIB_OBJS) $(LIBFILE) | 38 | $(call QUIET_CLEAN, libapikfs) $(RM) $(LIBFILE); \ |
| 39 | find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM) | ||
| 40 | |||
| 41 | FORCE: | ||
| 52 | 42 | ||
| 53 | .PHONY: clean | 43 | .PHONY: clean FORCE |
diff --git a/tools/lib/api/fd/Build b/tools/lib/api/fd/Build new file mode 100644 index 000000000000..4ddcb0ff7f49 --- /dev/null +++ b/tools/lib/api/fd/Build | |||
| @@ -0,0 +1 @@ | |||
| libapikfs-y += array.o | |||
diff --git a/tools/lib/api/fs/Build b/tools/lib/api/fs/Build new file mode 100644 index 000000000000..5f0fe4dfaae6 --- /dev/null +++ b/tools/lib/api/fs/Build | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | libapikfs-y += fs.o | ||
| 2 | libapikfs-y += findfs.o | ||
| 3 | libapikfs-y += debugfs.o | ||
| 4 | libapikfs-y += tracefs.o | ||
