After building something with make I want to move all the files that end in .cache.{js,woff} to a sub folder.

(cd $(PFROOT)/PVWR2/gwt/pdfwebviewer/; \
mkdir -p cache_files; \
mv *.cache.{js,woff} sub_folder)

The problem is, when running make it seems to interpret *.cache.{js,woff} as a file name and not something dynamic and of course there is no file that has the explicit name *.cache.{js,woff}. When I just navigate to the folder and move it manually from the shell with above command it works without a hitch.

I understand it has to do with globbing but I don't know how to fix this.


{...} is bash-specific syntax for brace expansion, but make uses /bin/sh by default instead of bash.

From info make, section 5.3.2:

The program used as the shell is taken from the variable SHELL. If this variable is not set in your makefile, the program /bin/sh is used as the shell.

If you want to use bash to parse shell constructs in your Makefile, you can add the following to the top:

SHELL := /bin/bash

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.