makefile - Removing all directories in a path -
i have makefile lists several directories need stuff with, e.g.
dirs = dir1 dir2 path/to/dir3 all: $(foreach dir,$(dirs), somecommand --source=$(sourcedir)/$(dir) --dest=$(dir);) clean: rm -rf $(dirs)
currently clean
target removes dir1
, dir2
, , dir3
, remove dir1
, dir2
, path
. along lines of:
clean: $(foreach dir,$(dirs), rm -rf --parents $(dir);)
is there easy way this?
there no such flag available rm
. this:
clean: $(foreach dir,$(dirs),rm -rf $(firstword $(subst /, ,$(dir)));)
if you're absolutely sure want delete below first directory in every path in dirs
(sounds dangerous me, but...)
Comments
Post a Comment