mirror of
https://git.disroot.org/80486DX2-66/polonium.git
synced 2024-12-28 16:10:58 +05:30
Makefile: remove multiple directories in one call
This commit is contained in:
parent
d404c4ff3a
commit
5a5d10b67d
18
Makefile
18
Makefile
@ -51,18 +51,20 @@ define rmfiles_if_exist
|
|||||||
done
|
done
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define rmdir_if_empty
|
define rmdirs_if_empty
|
||||||
@if [ -d "$1" ]; then \
|
@for dir in $1; do \
|
||||||
if [ -z "$$(find "$1" -mindepth 1 -maxdepth 1 -print -quit)" ]; then \
|
if [ -d "$$dir" ]; then \
|
||||||
echo "Removing empty directory $1"; \
|
if [ -z "$$(find "$$dir" -mindepth 1 -maxdepth 1 -print -quit)" ]; \
|
||||||
rm -r $1; \
|
then \
|
||||||
|
echo "Removing empty directory $$dir"; \
|
||||||
|
rm -r $$dir; \
|
||||||
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
fi
|
done
|
||||||
endef
|
endef
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(call rmfiles_if_exist,$(EXECPATH) $(DEP) $(OBJ))
|
$(call rmfiles_if_exist,$(EXECPATH) $(DEP) $(OBJ))
|
||||||
$(call rmdir_if_empty,$(BINDIR))
|
$(call rmdirs_if_empty,$(BINDIR) $(OBJDIR))
|
||||||
$(call rmdir_if_empty,$(OBJDIR))
|
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
Loading…
Reference in New Issue
Block a user