I'm writing a makefile for a website.
I have a directory called src/
and build/
Basically, I want to take files like this:
src/index.html
src/blog/title1/index.html
src/blog/title2/index.html
And copy them to the build/
directory like this:
build/index.html
build/blog/title1/index.html
build/blog/title2/index.html
I tried writing a rule, but I'm not really sure how to debug this:
src_html := src/**/*.html
build_html := $(shell find src -name '*.html' | sed 's/src/build/')
$(src_html): $(build_html)
@cp $< $@
You could use rsync if you have it installed.
default:
rsync -r --include '*/' --include='*.html' --exclude='*' src/ build/