Should handle empty vars: $(if $(filter-out 1,$(words "$(PATH_TO_CHECK)")),$(error spaces found))
On Wed, Dec 15, 2021 at 7:14 AM Paul Smith <psm...@gnu.org> wrote: > On Wed, 2021-12-15 at 15:05 +0100, R. Diez wrote: > > Is there a better way? > > I think if $(words $(PATH_TO_CHECK)) is 1, then it's OK and if it's >1 > then it contains whitespace. > > You can write a test using $(if ...) rather than using ifeq, then it > can be put anywhere: > > $(if $(filter-out 1,$(words $(PATH_TO_CHECK))),$(error spaces found)) > > Just to note this will also say "spaces found" if the variable is > empty... you'll have to check that separately if it's something to be > concerned about. > > >