Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
b4f91668 f819f703

+35 -46
+2
tools/lib/api/Build
··· 1 + libapikfs-y += fd/ 2 + libapikfs-y += fs/
+26 -36
tools/lib/api/Makefile
··· 1 1 include ../../scripts/Makefile.include 2 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 11 CC = $(CROSS_COMPILE)gcc 5 12 AR = $(CROSS_COMPILE)ar 6 13 7 - # guard against environment variables 8 - LIB_H= 9 - LIB_OBJS= 14 + MAKEFLAGS += --no-print-directory 10 15 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 16 + LIBFILE = $(OUTPUT)libapikfs.a 17 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 - 26 - LIBFILE = libapikfs.a 27 - 28 - CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC 29 - EXTLIBS = -lelf -lpthread -lrt -lm 30 - ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 31 - ALL_LDFLAGS = $(LDFLAGS) 18 + CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) 19 + CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -fPIC 20 + CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 32 21 33 22 RM = rm -f 34 23 35 - $(LIBFILE): $(LIB_OBJS) 36 - $(QUIET_AR)$(RM) $@ && $(AR) rcs $(OUTPUT)$@ $(LIB_OBJS) 24 + build := -f $(srctree)/tools/build/Makefile.build dir=. obj 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: 41 - $(QUIET_MKDIR)mkdir -p $(OUTPUT)fd $(OUTPUT)fs 29 + all: $(LIBFILE) 42 30 43 - $(OUTPUT)%.o: %.c libapi_dirs 44 - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< 45 - $(OUTPUT)%.s: %.c libapi_dirs 46 - $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $< 47 - $(OUTPUT)%.o: %.S libapi_dirs 48 - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< 31 + $(API_IN): FORCE 32 + @$(MAKE) $(build)=libapikfs 33 + 34 + $(LIBFILE): $(API_IN) 35 + $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN) 49 36 50 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) 52 40 53 - .PHONY: clean 41 + FORCE: 42 + 43 + .PHONY: clean FORCE
+1
tools/lib/api/fd/Build
··· 1 + libapikfs-y += array.o
+4
tools/lib/api/fs/Build
··· 1 + libapikfs-y += fs.o 2 + libapikfs-y += findfs.o 3 + libapikfs-y += debugfs.o 4 + libapikfs-y += tracefs.o
+2 -10
tools/perf/Makefile.perf
··· 375 375 install-traceevent-plugins: $(LIBTRACEEVENT) 376 376 $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) install_plugins 377 377 378 - LIBAPIKFS_SOURCES = $(wildcard $(LIB_PATH)fs/*.[ch] $(LIB_PATH)fd/*.[ch]) 379 - 380 - # if subdir is set, we've been called from above so target has been built 381 - # already 382 - $(LIBAPIKFS): $(LIBAPIKFS_SOURCES) 383 - ifeq ($(subdir),) 384 - $(QUIET_SUBDIR0)$(LIB_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libapikfs.a 385 - endif 378 + $(LIBAPIKFS): FORCE 379 + @$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapikfs.a 386 380 387 381 $(LIBAPIKFS)-clean: 388 - ifeq ($(subdir),) 389 382 $(call QUIET_CLEAN, libapikfs) 390 383 @$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null 391 - endif 392 384 393 385 help: 394 386 @echo 'Perf make targets:'