Score:1

Using braces in rm in makefiles

in flag

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.

Score:1
hr flag

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

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.