1

So I'm learning about Makefiles and in an example, I was to remove files in the clean part. I wanted to do something along the lines of rm paper.{aux,pdf,bib,bbl}, but when I did make clean it didn't recognize any files like that. Doing that remove command outside of the makefile works just fine. Do makefiles not play nice with braces like this? I didn't find much about braces in makefiles in contexts like this.

1 Answers1

1

That's because make uses /bin/sh as the shell by default - brace expansion is a feature of more complex shells such as /bin/bash.

You could set the shell explicitly within the Makefile ex.

SHELL := /bin/bash

.PHONY: clean

clean: @echo rm paper.{aux,pdf,bib,bbl}

See The GNU make manual: 5.3.2 Choosing the Shell

steeldriver
  • 136,215
  • 21
  • 243
  • 336