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?

  1. make -j5 5 conversions @ once. if have 4 cpus
  2. the conversion stops on first error (like disk full say)
  3. files have not changed since last conversion not re-converted
  4. no dodgy shell syntax (though sh big part of make)

untested btw. sorry.


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -