open-cas-linux/Makefile
Amir Haroush 14aea0eda0 Fix compilation distclean race where several tries to rm
If we run 'make -j' all 3 targets [modules, casadm, utils] will run in parallel.
modules & casadm will then call sync, and then call distcleandir from
ocf/Makefile. The distcleandir will try to remove empty directories, but now we
have two instances of make trying to do that. Also, what if one of them just
created directory to put files in it, and the other just removes it.
Make casadm target dependent on modules target will ensure that it will start
running only after modules target is done.

Signed-off-by: Amir Haroush <amir.haroush@huawei.com>
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-09-10 14:36:43 +02:00

46 lines
735 B
Makefile

#
# Copyright(c) 2012-2022 Intel Corporation
# Copyright(c) 2024 Huawei Technologies
# SPDX-License-Identifier: BSD-3-Clause
#
PWD:=$(shell pwd)
default: all
DIRS:=modules casadm utils
.PHONY: default all clean distclean $(DIRS)
all $(MAKECMDGOALS): $(DIRS)
$(DIRS):
ifneq ($(MAKECMDGOALS),archives)
ifneq ($(MAKECMDGOALS),rpm)
ifneq ($(MAKECMDGOALS),srpm)
ifneq ($(MAKECMDGOALS),deb)
ifneq ($(MAKECMDGOALS),dsc)
cd $@ && $(MAKE) $(MAKECMDGOALS)
casadm: modules
cd $@ && $(MAKE) $(MAKECMDGOALS)
endif
endif
endif
endif
endif
archives:
@tools/pckgen.sh $(PWD) tar zip
rpm:
@tools/pckgen.sh $(PWD) rpm --debug
srpm:
@tools/pckgen.sh $(PWD) srpm
deb:
@tools/pckgen.sh $(PWD) deb --debug
dsc:
@tools/pckgen.sh $(PWD) dsc