I'm writing a Makefile to ease latex file compilation. I am trying to create a clean
target to delete all files produced by pdflatex
, and I wrote this:
SHELL := /bin/bash
name = mydocument
all: show
$(name).pdf: $(name).tex
# We need to run it twice to update the TOC
pdflatex $<
pdflatex $<
show: $(name).pdf
gnome-open $<
clean:
ls -l $(name)!(.tex)
.PHONY: all clean show
The problem is the command ls -l $(name)!(.tex)
. If I run it from the terminal I get the list of files to delete (i.e. all files called "mydocument" that have an extension different from ".tex"), but if I run it with make clean
I get the following error:
ls -l mydocument!(.tex)
/bin/bash: -c: line 0: syntax error near unexpected token "("
/bin/bash: -c: line 0: `ls -l mydocument!(.tex)'
make: *** [clean] Error 1
Does anyone know how to fix this?