I have follow folder with Dockerfile
- build
- path1
- v1
- Dockerfile
- v2
- Dockerfile
- v1
- path2
- v1
- Dockerfile
- v1
- path1
I collect it as $(DOCKER_TARGES) ---> build-path1-v1 build-path1-v2 build-path2-v2
Now my target
build-%: build/$(subst -,/,%))/Dockerfile $(shell find build -type f)
I try to replace string in %
but it could not work. any suggestion?
build-path1/v1
andbuild-path2/v2
etc.? There's no rule against make variables containing/
in their names, or almost any other special character for that matter. If you did that you might not need to play tricks with converting filenames.$(shell build -type f)
really right? If it is, that doesn't depend on anything related to a specific target and I urge you to assign it into a separate variable with:=
so it's only invoked one time:BUILD_FILES := $(shell find build -type f)
then use that variable as the prerequisite. But probably, you meant do have it only depend on the files in a particular subdirectory and this is wrong (will rebuild everything if anything changes)