ocf/tests/functional/Makefile
Krzysztof Majzerowicz-Jaszcz 23abad76a8 Add script for running PyOCF with sanitization
GCC/Clang sanitizer can be used together with PyOCF to catch some errors during
testing.

CC was purposely removed from the Makefile. It always points to GCC on Linux
by default. This allows to change the compiler and its options during the run
of the script

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-03-14 16:54:30 +01:00

55 lines
1.3 KiB
Makefile

#
# Copyright(c) 2019-2022 Intel Corporation
# Copyright(c) 2025 Huawei Technologies
# SPDX-License-Identifier: BSD-3-Clause
#
PWD=$(shell pwd)
OCFDIR=$(PWD)/../../
ADAPTERDIR=$(PWD)/pyocf
SRCDIR=$(ADAPTERDIR)/ocf/src
INCDIR=$(ADAPTERDIR)/ocf/include
WRAPDIR=$(ADAPTERDIR)/c/wrappers
HELPDIR=$(ADAPTERDIR)/c/helpers
CFLAGS=-g -Wall -I$(INCDIR) -I$(SRCDIR)/ocf/env $(OPT_CFLAGS)
LDFLAGS=-pthread #-lz
SRC=$(shell find $(SRCDIR) $(WRAPDIR) $(HELPDIR) -name \*.c)
OBJS=$(patsubst %.c, %.o, $(SRC))
OCFLIB=$(ADAPTERDIR)/libocf.so
all: | sync config_random
$(MAKE) $(OCFLIB)
$(OCFLIB): $(OBJS)
@echo "Building $@"
@$(CC) -coverage -shared -o $@ $(CFLAGS) $^ -fPIC $(LDFLAGS)
%.o: %.c
@echo "Compiling $@"
@$(CC) -coverage -c $(CFLAGS) -o $@ -fPIC $^ $(LDFLAGS)
sync:
@echo "Syncing OCF sources"
@mkdir -p $(ADAPTERDIR)/ocf
@$(MAKE) -C $(OCFDIR) inc O=$(ADAPTERDIR)/ocf
@$(MAKE) -C $(OCFDIR) src O=$(ADAPTERDIR)/ocf
@$(MAKE) -C $(OCFDIR) env O=$(ADAPTERDIR)/ocf OCF_ENV=posix
config_random:
@python3 utils/configure_random.py
clean:
@rm -rf $(OCFLIB) $(OBJS)
@echo " CLEAN "
distclean: clean
@rm -rf $(OCFLIB) $(OBJS)
@rm -rf $(SRCDIR)/ocf
@rm -rf $(INCDIR)/ocf
@find . -name *.gc* -delete
@echo " DISTCLEAN "
.PHONY: all clean sync config_random distclean