Skip to content

Commit

Permalink
ocf: Move ocf configuration to Makefile
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Pelplinski <[email protected]>
Change-Id: I116b53319152b229900e56afc6277340a9daa988
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/445261
Tested-by: SPDK CI Jenkins <[email protected]>
Reviewed-by: Vitaliy Mysak <[email protected]>
Reviewed-by: Darek Stojaczyk <[email protected]>
Reviewed-by: Jim Harris <[email protected]>
Reviewed-by: Tomasz Zawadzki <[email protected]>
  • Loading branch information
Piotr Pelplinski authored and jimharris committed Mar 8, 2019
1 parent 1fc4165 commit d6c4518
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 26 deletions.
17 changes: 0 additions & 17 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -467,23 +467,6 @@ if [[ "${CONFIG[OCF]}" = "y" ]]; then
else
CONFIG[CUSTOMOCF]=n
fi

# If OCF_PATH is not a library, we need to do sources export procedure using OCF Makefile
if [[ ${CONFIG[CUSTOMOCF]} = "n" ]]; then
echo "configuring OCF..."
rootdir=$(readlink -f $(dirname $0))

if pushd "${CONFIG[OCF_PATH]}" > /dev/null && \
make inc O="$rootdir/lib/bdev/ocf/env/" && \
make src O="$rootdir/lib/bdev/ocf/env/" CMD=cp 1>/dev/null && \
popd > /dev/null
then
echo "done configuring OCF"
else
echo "Could not configure OCF"
exit 1
fi
fi
fi

if [[ "${CONFIG[PGO_CAPTURE]}" = "y" && "${CONFIG[PGO_USE]}" = "y" ]]; then
Expand Down
45 changes: 36 additions & 9 deletions lib/bdev/ocf/env/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,29 +44,56 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

LIBNAME := ocfenv

ifeq ($(CONFIG_CUSTOMOCF),n)

CFLAGS += $(ENV_CFLAGS) -I$(CURDIR) -I$(CURDIR)/include -w
C_SRCS = $(shell find -name \*.c)

include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk
LIB = $(call spdk_lib_list_to_static_libs,$(LIBNAME))

else

LIB = $(call spdk_lib_list_to_static_libs,$(LIBNAME))
ifeq ($(CONFIG_CUSTOMOCF),y)

all: $(LIB)
.PHONY: all clean install

$(LIB):
cp $(CONFIG_OCF_PATH) $(LIB)
all:
$(Q)$(MAKE) $(LIB)

clean:
$(Q)rm -f $(LIB)

$(LIB):
cp $(CONFIG_OCF_PATH) $(LIB)

install:

else

.PHONY: all clean install ocf_inc ocf_src ocf_distclean all exportlib

all: ocf_inc ocf_src
$(Q)$(MAKE) $(LIB)

ocf_inc:
$(Q)$(MAKE) -C "$(CONFIG_OCF_PATH)" inc O="$(SPDK_ROOT_DIR)/lib/bdev/ocf/env/" --quiet

ocf_src:
$(Q)$(MAKE) -C "$(CONFIG_OCF_PATH)" src O="$(SPDK_ROOT_DIR)/lib/bdev/ocf/env/" CMD=cp --quiet

ocf_distclean:
$(Q)$(MAKE) -C "$(CONFIG_OCF_PATH)" distclean O="$(SPDK_ROOT_DIR)/lib/bdev/ocf/env/" --quiet

clean: ocf_distclean
$(Q)rm -rf "$(SPDK_ROOT_DIR)/lib/bdev/ocf/env/include" \
"$(SPDK_ROOT_DIR)/lib/bdev/ocf/env/src" \
$(LIB) $(OBJS);

$(LIB): $(OBJS)
$(LIB_C)

install:

endif

exportlib: $(LIB)
exportlib: all
@ if [ -z $(O) ]; then echo "No output specified"; exit 1; fi
cp $(LIB) $(O)

Expand Down

0 comments on commit d6c4518

Please sign in to comment.