[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#225833: [OT] Re: Bug#225833: 225833: letter vs A4 in TeX



Florent Rougon a écrit :
> And if you want your documents to be ready for both dvips, pdftex and
> whatnot, well, you can use a Makefile. I'm attaching a standard Makefile
> of mine for this purpose, with the accompanying little script, to be put
> somewhere in $PATH (can be replaced with a sed command, except that I
> wouldn't know how to implement the --maxrepl option in sed, and not
> limiting the number of replacements to 1 in this context is too ugly for
> my taste).

Here is a modified version of your Makefile that should be able to
automatically handle bibtex, index, glossary, ... for any number of
LaTeX sources in the directory.
You can do 'make ; make clean ; make'
The last make should not rebuild anything
And 'make distclean' should remove all build files.
  Note that most of my LaTeX makefiles only have one line :
include LaTeX.mk
(but I do not have substitution as for you)
  Of course, in order for this to work, you need to install the latex-make
package (and more exactly the last version I will upload now because the
Makefile I propose here trigger a bug present in the current version)

  Best regards,
    Vincent
SOURCES:=$(shell grep -l '\\documentclass' *.tex | sed -e 's/\.tex$$//' | egrep -v '_(pdf|ps)$$')
PDF:=$(addsuffix .pdf,$(SOURCES))
PS:=$(addsuffix .ps,$(SOURCES))

all: $(PDF) $(PS)

MASTERS_PS:=$(addsuffix _ps,$(SOURCES))
MASTERS_PDF:=$(addsuffix _pdf,$(SOURCES))
LU_MASTERS:=$(MASTERS_PS) $(MASTERS_PDF)
GEN_SOURCES:=$(addsuffix .tex,$(LU_MASTERS))

$(foreach master,$(MASTERS_PS),$(eval LU_$(master)_FLAVORS:=PS))
$(foreach master,$(MASTERS_PDF),$(eval LU_$(master)_FLAVORS:=PDF))

include LaTeX.mk

%_ps.tex: %.tex
	./replace-in-file.py --from="*FloTeXDriver*" --to=dvips --maxrepl=1 \
          '--output=$@' '$<'

%_pdf.tex: %.tex
	./replace-in-file.py --from="*FloTeXDriver*" --to=pdftex --maxrepl=1 \
          '--output=$@' '$<'

$(PDF): %.pdf: %_pdf.pdf
	ln -s $< $@

$(PS): %.ps: %_ps.ps
	ln -s $< $@

.SECONDARY: $(GEN_SOURCES)
clean::
	$(RM) $(GEN_SOURCES)

distclean::
	$(RM) $(PDF) $(PS)

Reply to: