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.
Asked
Active
Viewed 368 times
1

Sponge7331
- 11
1 Answers
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}

steeldriver
- 136,215
- 21
- 243
- 336