[XeTeX] using xetex in make

Nikola Lecic nlecic at EUnet.yu
Thu Aug 16 09:22:05 CEST 2007


On Wed, 15 Aug 2007 22:35:27 -0400
Mike Maxwell <maxwell at umiacs.umd.edu> wrote:

> I have a makefile that is supposed to automate a lot of the process
> of producing a .pdf file (out of a DocBook file, but that's a long
> story; suffice to say that by the time of the problem, the file
> exists in the appropriate format for xetex).  For some reason xetex
> works fine if I run it directly from the command line, but won't work
> if it's run inside of make.
> 
> Here's the make recipe:
> -----------
> %.pdf: %.xetex
> 	pwd ; \
> 	ls -l $^ ; \
> 	$(XETEX) $< -o $@
> -----------
> The 'pwd' and 'ls' are just in there to make sure make didn't change 
> directories or something.
> 
> When I run make, this is what I get:
> -----------
>  > make test.pdf
> pwd ; \
> ls -l test.xetex ; \
> /usr/share/bin/x86_64-linux/xelatex test.xetex -o test.pdf
> /home/mmaxwell/Data/XeTeX
> -rw-rw-r--  1 mmaxwell mmaxwell 598519 Aug 15 22:04 test.xetex
> This is XeTeXk, Version 3.141592-2.2-0.996 (Web2C 7.5.6)
>   %&-line parsing enabled.
> entering extended mode
> ! I can't find file `test.xetex'.
> <*> test.xetex
>                 -o test.pdf
> Please type another input file name:
> ! I can't find file `test'.
> <*> test.xetex
>                 -o test.pdf
> Please type another input file name:
> -----------
> 
> You'll notice that 'ls' finds the file just fine.  (I hit the <Enter> 
> key after the first prompt; I'm not sure why it switches from asking
> for 'test.xetex' the first time to asking for 'test' the second time.)
> 
> If I copy the command line from the above and paste it directly in to 
> the bash prompt, xetex finds the input file and proceeds to run.
> 
> I suppose xetex could be expecting the file suffix to be .latex
> or .tex instead, but then why would it run OK on the bash prompt, but
> not inside make?  Nope, just tried renaming the source file and
> changing the recipe accordingly.
> 
> This is in RedHat Linux, Gnu make v3.80.  I'm running the bash shell, 
> although I've tried running the xetex command using 'sh' and it works 
> fine.  (I was thinking that because 'make' uses 'sh' instead of
> 'bash', this might be cause of the problem.)
> 
> Mysterification.  I've never had a problem misbehave just because I
> ran it from make.  There is a v3.81 of make...nope, just downloaded
> and built it, and I get the same result.

Hello,

Just a couple of ideas:

(1) What is the output of

    % make --debug=j SHELL='/bin/sh -v -x' test.pdf

(2) Try different shell:

    % make --debug=j SHELL='/bin/bash' test.pdf
    (or wherever is bash)
  
(3) It looks like that, when invoked in a child process, xetex
    binary 'forgets' where it was called from :) (since it works and
    correctly searches ./ when called by hand inside /bin/sh). So, try
    to separate commands like this:

    %.pdf: %.xetex
          pwd
          ls -l $^
          $(XETEX) $< -o $@

    and run verbose command from (1).

(4) Despite  '; \' unite commands, shell is called for every piece
    separately; try this:

    %.pdf: %.xetex
        pwd && ls -l $^ && $(XETEX) $< -o $@

(5) Try to copy test.xetex to home dir and see what will happen.

BTW, your original Makefile works for me:

  % gmake --version
  GNU Make 3.81
  Copyright (C) 2006  Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.
  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
  PARTICULAR PURPOSE.

  This program built for i386-portbld-freebsd6.2

with ancient BSD sh. It also works without difference with

  %/compat/linux/bin/sh --version
  GNU bash, version 3.00.16(1)-release (i386-redhat-linux-gnu)
  Copyright (C) 2004 Free Software Foundation, Inc.

running with Linux binary compatibility.

Nikola Lečić


More information about the XeTeX mailing list