0

I have a directory with the following files

➜  hrrep git:(master) ✗ ls -l
total 1000
drwxrwxrwx  22 zmjones  staff    748 May 28 23:28 data
-rw-rw-rw-   1 zmjones  staff   7180 May 20 16:17 data.R
drwxrwxrwx   9 zmjones  staff    306 May 28 23:38 figures
-rw-r--r--   1 zmjones  staff  85841 May 28 23:23 hill_jones_hr.bib
-rw-r--r--   1 zmjones  staff  29193 May 28 22:23 hill_jones_hr.tex
-rw-r--r--   1 zmjones  staff    572 May 28 23:46 makefile
-rw-rw-rw-   1 zmjones  staff   9588 May 28 22:47 models.R
drwxrwxrwx   3 zmjones  staff    102 May 28 23:28 papers
drwxrwxrwx   9 zmjones  staff    306 May 28 23:28 tex
-rw-r--r--   1 zmjones  staff   1483 May 20 12:58 un_data.py

These files are described by a makefile (using GNU Make 3.81)

all: ./data/cat_un_data.csv ./data/rep.csv ./figures/*.png ./hj-hr.pdf

./data/cat_un_data.csv: un_data.py #refreshing one will refresh all
        python un_data.py

./data/rep.csv: data.R ./data/cat_un_data.csv
        R CMD BATCH --no-save --no-restore data.R

./figures/*.png: models.R ./data/rep.csv
        R CMD BATCH --no-save --no-restore models.R

TEXMCD := pdflatex -interaction=batchmode

hill_jones_hr.pdf: hill_jones_hr.tex ./figures/*.png
    $(TEXCMD) $<
    ]bibtex *.aux
    $(TEXCMD) $<
    $(TEXCMD) $<
    find . | egrep ".*((\.(aux|log|blg|bbl|out|Rout|Rhistory|DS_Store))|~)$$" | xargs rm
    rm -rf auto

The makefile seems to work fine until it gets to the hll_jones_hr.pdf target, where it fails with an error:

hill_jones_hr.tex
make: hill_jones_hr.tex: No such file or directory
make: *** [hill_jones_hr.pdf] Error 1

I don't understand what the problem is. The document compiles fine when I execute pdflatex and bibtex manually. I tried adding the ignore error flag to no avail. I presume this is some stupid make error that I am making. This folder is in Dropbox if that makes any difference. I also tried adding the ./ prefix to both the .tex file and the .pdf target; the error was the same.

Zach
  • 996
  • 12
  • 25

2 Answers2

3

The problem is that the $(TEXCMD) variable is not defined, so your command:

$(TEXCMD) $<

is expanding to just $< or just the filename, which is not a legal command by itself.

MadScientist
  • 92,819
  • 9
  • 109
  • 136
  • I was just mis-spelling it. facepalm. I don't understand how I was supposed to go from the error "file not found" to TEXCMD is undefined. I see how it works now though. Thanks! – Zach May 29 '13 at 14:40
  • 1
    Yes, make will print the command that it executes. If that's not the command you expected it to execute, as in this case where the `latex` or whatever command is not there, you need to look at the makefile rule and figure out what's wrong. There's also the `--warn-undefined-variables` option to GNU `make`, however note this may give you a lot of false positives if you rely on make's promise that undefined values are empty. – MadScientist May 29 '13 at 15:46
0

use ./hill_jones_hr.tex instead of hill_jones_hr.tex, and try again.

openxxs
  • 146
  • 3