Why Bash-in-Makefile expression doesn't work? -
directly pasted shell, following tries each of 3 regex , works (see *.{jpg,png,gis.tif}):
for file in ./output/india/*.{jpg,png,gis.tif}; echo $file; openssl base64 -in $file -out ./output/india/`basename $file`.b64; done; as makefile process, fails , returns :
task: file in ./output/india/*.{png,jpg,gis.tif} ; \ echo $$file ; openssl base64 -in $$file -out ./output/india/`basename $$file`.b64; \ done and returns :
47910543179104:error:02001002:system library:fopen:no such file or directory:bss_file.c:398:fopen('./output/india/*.{png,jpg,gis.tif}','r') why expression doesn't work when bash in makefile ?
i have been prompted give sketch of how make heavy lifting you.
so, want convert source files (.jpg, .png, .gis.tif) in output/india/ base64 encoded equivalents. sketch:
.phony: all: # default target dir := output/india/ exts := jpg png gis.tif wildcards := $(addprefix ${dir}*.,${exts}) sources := $(wildcard ${wildcards}) targets := $(addsuffix .b64,${sources}) ${targets}: %.b64: % openssl base64 -in $< -out $@ all: ${targets} all: ; : $@ success this more verbose needs be, , rail against use of $(wildcard …). oh well.
so advantages have here on shell version?
make -j55 conversions @ once. if have 4 cpus- the conversion stops on first error (like disk full say)
- files have not changed since last conversion not re-converted
- no dodgy shell syntax (though sh big part of make)
untested btw. sorry.
Comments
Post a Comment