Skip to content

Commit

Permalink
Makefile: make will continue when it encounters a subfolder making fa…
Browse files Browse the repository at this point in the history
…iled

When make in the lkvs root path encounters a subfolder that fails to make, it
will continue and all subfolders that make failed will be listed at the end.

Signed-off-by: Pengfei Xu <[email protected]>
  • Loading branch information
xupengfe authored and ysun committed Nov 30, 2023
1 parent 539d0a3 commit 3aa21ab
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ SUBDIRS = $(shell ls -d */)

PROXY :=

MAKE_LKVS_LOG = /tmp/make_lkvs.log

ifneq ($(https_proxy),)
PROXY := $(https_proxy)
else ifneq ($(HTTPS_PROXY),)
Expand All @@ -16,18 +18,30 @@ PROXY := $(ALL_PROXY)
endif

all:
@for dir in $(SUBDIRS) ; do \
@cat /dev/null > ${MAKE_LKVS_LOG};
@for dir in $(SUBDIRS); do \
if [ -f "$$dir/Makefile" ]; then \
cd $$dir && \
make && \
cd .. || exit 2; \
make || { \
echo " - Make subfolder $${dir} failed." >> ${MAKE_LKVS_LOG}; \
cd ..; \
continue; \
}; \
cd ..; \
fi \
done
cat $(MAKE_LKVS_LOG)
ifeq ($(shell cat $(MAKE_LKVS_LOG)),)
@exit 0
else
@exit 2
endif

clean:
for dir in $(SUBDIRS) ; do \
if [ -f "$$dir/Makefile" ]; then \
make -C $$dir clean || exit 2; \
fi \
@for dir in $(SUBDIRS); do \
if [ -f "$$dir/Makefile" ]; then \
make -C $$dir clean || continue; \
fi \
done
docker_clean:
docker run -it --rm -v $(PWD):/src --name ubuntu_2204_lkvs ubuntu:22.04 make clean
Expand Down

0 comments on commit 3aa21ab

Please sign in to comment.