I've got a makefile rule that builds a zip/tarbar for distribution. In the recipe, it does some "value added" things, like ensure CR/LF's are correct, and ensures execute bits are correct before packaging.
The project has a buffet of files, but here are the requirements: (1) all files except GNUmakefile
need CR/LF
, (3) GNUmakefile
needs LF
only, (3) all files except GNUmakefile
needs a-x
.
Here's what the recipe looks like:
.PHONY: convert
convert:
chmod a-x *[^GNUmakefile*] TestData/*.dat TestVectors/*.txt
unix2dos --keepdate --quiet *[^GNUmakefile*] TestData/*.dat TestVectors/*.txt
dos2unix --keepdate --quiet GNUmakefile
I'm using *
and trying to avoid explicitly listing all the files in the buffet because some are non obvious, like IDE specific files. (*[^<somefile>*]
is a neat trick; I got that from Exclude one pattern from glob match).
The problem is I'm matching TestData
and TestVectors
when performing chmod a-x
, so I exclude myself from the directories.
I need to refine things, but I'm not sure how. I want to use the shell's "*" glob, but exclude one file and don't match directories.
How should I proceed?
SHELL ?= /bin/zsh
, but GNUmakefile takes away that freedom (how ironic; see Where is /bin/bash being changed to /bin/sh?). – Oct 05 '15 at 10:25zsh
, soSHELL ?= /bin/zsh
would not make sense. Note thatmake
's$SHELL
is never inherited from the environment's$SHELL
. Those two variables have different meanings (one for the shell used to interpret shell command lines inmake
(sh
by default), the other one for the user's preferred choice of interactive shell (for things likexterm
orvi
...)). – Stéphane Chazelas Oct 05 '15 at 10:40zsh
. As a result, you cannot even run configure with zsh. – schily Oct 05 '15 at 11:15echo ^GNUmakefile
is required by POSIX to output^GNUmakefile\n
whichzsh
obviously fails on here (as would the Bourne shell btw)). – Stéphane Chazelas Oct 05 '15 at 11:29