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>
This commit is contained in:
parent
f819f703a4
commit
b4f9166847
|
@ -0,0 +1,2 @@
|
||||||
|
libapikfs-y += fd/
|
||||||
|
libapikfs-y += fs/
|
|
@ -1,53 +1,43 @@
|
||||||
include ../../scripts/Makefile.include
|
include ../../scripts/Makefile.include
|
||||||
include ../../perf/config/utilities.mak # QUIET_CLEAN
|
include ../../perf/config/utilities.mak # QUIET_CLEAN
|
||||||
|
|
||||||
|
ifeq ($(srctree),)
|
||||||
|
srctree := $(patsubst %/,%,$(dir $(shell pwd)))
|
||||||
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
||||||
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
||||||
|
#$(info Determined 'srctree' to be $(srctree))
|
||||||
|
endif
|
||||||
|
|
||||||
CC = $(CROSS_COMPILE)gcc
|
CC = $(CROSS_COMPILE)gcc
|
||||||
AR = $(CROSS_COMPILE)ar
|
AR = $(CROSS_COMPILE)ar
|
||||||
|
|
||||||
# guard against environment variables
|
MAKEFLAGS += --no-print-directory
|
||||||
LIB_H=
|
|
||||||
LIB_OBJS=
|
|
||||||
|
|
||||||
LIB_H += fs/debugfs.h
|
LIBFILE = $(OUTPUT)libapikfs.a
|
||||||
LIB_H += fs/tracefs.h
|
|
||||||
LIB_H += fs/findfs.h
|
|
||||||
LIB_H += fs/fs.h
|
|
||||||
# See comment below about piggybacking...
|
|
||||||
LIB_H += fd/array.h
|
|
||||||
|
|
||||||
LIB_OBJS += $(OUTPUT)fs/debugfs.o
|
CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
|
||||||
LIB_OBJS += $(OUTPUT)fs/tracefs.o
|
CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -fPIC
|
||||||
LIB_OBJS += $(OUTPUT)fs/findfs.o
|
CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
||||||
LIB_OBJS += $(OUTPUT)fs/fs.o
|
|
||||||
# XXX piggybacking here, need to introduce libapikfd, or rename this
|
|
||||||
# to plain libapik.a and make it have it all api goodies
|
|
||||||
LIB_OBJS += $(OUTPUT)fd/array.o
|
|
||||||
|
|
||||||
LIBFILE = libapikfs.a
|
|
||||||
|
|
||||||
CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC
|
|
||||||
EXTLIBS = -lelf -lpthread -lrt -lm
|
|
||||||
ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
|
||||||
ALL_LDFLAGS = $(LDFLAGS)
|
|
||||||
|
|
||||||
RM = rm -f
|
RM = rm -f
|
||||||
|
|
||||||
$(LIBFILE): $(LIB_OBJS)
|
build := -f $(srctree)/tools/build/Makefile.build dir=. obj
|
||||||
$(QUIET_AR)$(RM) $@ && $(AR) rcs $(OUTPUT)$@ $(LIB_OBJS)
|
API_IN := $(OUTPUT)libapikfs-in.o
|
||||||
|
|
||||||
$(LIB_OBJS): $(LIB_H)
|
export srctree OUTPUT CC LD CFLAGS V
|
||||||
|
|
||||||
libapi_dirs:
|
all: $(LIBFILE)
|
||||||
$(QUIET_MKDIR)mkdir -p $(OUTPUT)fd $(OUTPUT)fs
|
|
||||||
|
|
||||||
$(OUTPUT)%.o: %.c libapi_dirs
|
$(API_IN): FORCE
|
||||||
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
|
@$(MAKE) $(build)=libapikfs
|
||||||
$(OUTPUT)%.s: %.c libapi_dirs
|
|
||||||
$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
|
$(LIBFILE): $(API_IN)
|
||||||
$(OUTPUT)%.o: %.S libapi_dirs
|
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
|
||||||
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(call QUIET_CLEAN, libapi) $(RM) $(LIB_OBJS) $(LIBFILE)
|
$(call QUIET_CLEAN, libapikfs) $(RM) $(LIBFILE); \
|
||||||
|
find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM)
|
||||||
|
|
||||||
.PHONY: clean
|
FORCE:
|
||||||
|
|
||||||
|
.PHONY: clean FORCE
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
libapikfs-y += array.o
|
|
@ -0,0 +1,4 @@
|
||||||
|
libapikfs-y += fs.o
|
||||||
|
libapikfs-y += findfs.o
|
||||||
|
libapikfs-y += debugfs.o
|
||||||
|
libapikfs-y += tracefs.o
|
|
@ -375,20 +375,12 @@ $(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
|
||||||
|
|
||||||
LIBAPIKFS_SOURCES = $(wildcard $(LIB_PATH)fs/*.[ch] $(LIB_PATH)fd/*.[ch])
|
$(LIBAPIKFS): FORCE
|
||||||
|
@$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapikfs.a
|
||||||
# if subdir is set, we've been called from above so target has been built
|
|
||||||
# already
|
|
||||||
$(LIBAPIKFS): $(LIBAPIKFS_SOURCES)
|
|
||||||
ifeq ($(subdir),)
|
|
||||||
$(QUIET_SUBDIR0)$(LIB_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libapikfs.a
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(LIBAPIKFS)-clean:
|
$(LIBAPIKFS)-clean:
|
||||||
ifeq ($(subdir),)
|
|
||||||
$(call QUIET_CLEAN, libapikfs)
|
$(call QUIET_CLEAN, libapikfs)
|
||||||
@$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
|
@$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
|
||||||
endif
|
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo 'Perf make targets:'
|
@echo 'Perf make targets:'
|
||||||
|
|
Loading…
Reference in New Issue