Hi, I'm trying to do asset versioning with make, but the solution I came up with isn't perfect.
I want to minify `src/foo.js` and then copy the minified content to `dist/foo.[hash].js`, where `[hash]` is the sha1 hash of minified content. Right now I do it like this: ```make .DEFAULT_GOAL = all src=src/foo.js stage/%: src/% | stage jsmin $< >$@ %.dist.d: % | stage makehashdep $(patsubst stage/%,dist/%,$<) $< dist -include $(src:src/%=stage/%.dist.d) .PHONY: all all: $(dist) $(dist): | dist cp $< $@ .PHONY: clean clean: rm -r stage dist stage dist: mkdir $@ ``` where `makehashdep` is ```bash target=$1 src=$2 var=$3 hashed=${target%.*}.$(sha1sum $src).${target##*.} echo $hashed: $src echo $var += $hashed ``` With this config, executing `make` does what I want. But there are two issues: 1. `make clean` will try to build the files in `stage` first and then remove the directories. 2. I need to maintain a make variable in `makehashdep`, which feels out of place. Any idea how I can do asset versioning without these issues? Thank you. _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make