2012-01-11 9 views
12

E 'possibile dire a make di costruire una destinazione solo se è stato modificato il checksum md5 delle fonti (invece del tempo di modifica)?Marca: crea solo qualcosa se il checksum md5 della sorgente è stato modificato

Sto usando make per compilare i miei file .tex e ho bisogno di impedirgli di costruire tutto il doppio tutto il tempo.

Ho provato a usare Scons, ma ritengo che questo non sia adattabile alle altre esigenze che ho.

+0

Mi è stato recentemente risolvere un problema simile con makefile generati usando CMake, vedere http://stackoverflow.com/questions/36600111/come se-cmake-detect-cambiato-files. –

risposta

4

No, questo non è supportato da Make - come hai scoperto, il supporto per this feature è uno dei motivi per cui esistono strumenti come Scons.

Ho trovato un manuale recipe per fare GNU, tuttavia. Forse puoi usarlo come soluzione.

+0

il problema con le focaccine è principalmente che sarei l'unico dei miei dintorni ad utilizzarlo. Nessuno che conosca lo usa, mi sentirei molto di più per qualche hacking di makefile (usando forse alcune affermazioni se?). – romeovs

+1

Vorrei andare con Scons a prescindere, è un bel sistema. Se è solo per la compilazione di un documento LaTeX, allora userei qualcosa come [latex-mk] (http://latex-mk.sourceforge.net/). –

+0

sì, ho appena trovato una soluzione usando latexmk. Grazie per la punta delle focaccine. Ci riprenderò quando sarà il momento giusto. – romeovs

1

Forse il mio scons lattice e org-mode ricetta vi aiuta:

## I need a couple of special builders for my projects 
# the $SOURCE replacement only uses the first source file. $SOURCES gives all. 
# specifying all source files makes it possible to rerun the build if a single source file changed. 
orgexportpdf = 'emacs --batch --visit "$SOURCE" --funcall org-export-as-pdf' 
pyxplot = 'pyxplot $SOURCE' 
# pdflatex is quite dirty. I directly clean up after it with rm. 
pdflatex = 'pdflatex $SOURCE -o $TARGET; rm -f *_flymake* flymake* *.log *.out *.toc *.aux *.snm *.nav *.vrb' 

# build the PhD thesis from emacs org-mode. 
Command("doktorarbeit.pdf", "doktorarbeit.org", 
     orgexportpdf) 

# create plots 
Command(["images/comp-t3-s07-tem-boas.png", 
     "images/comp-t3-s07-tem-bona.png"], 
     ["nee-comp.pyx", 
     "nee-comp.txt"], 
     pyxplot) 

# build my sink.pdf 
Command("sink.pdf", 
     ["sink.tex", 
     "images/comp-t3-s07-tem-boas.png", 
     "images/comp-t3-s07-tem-bona.png", 
     "images/bona-marble.png", 
     "images/boas-marble.png"], 
     pdflatex) 

# My editors leave tempfiles around. I want them gone after a build clean. This is not yet supported! 
tempfiles = Glob('*~') + Glob('#*#') + Glob('*.bak') 
# using this here would run the cleaning on every run. 
#Command("clean", [], Delete(tempfiles)) 

E 'la controparte per il mio Makefile:

all: doktorarbeit.pdf sink.pdf 

sink.pdf : sink.tex images/comp-t3-s07-tem-boas.png images/comp-t3-s07-tem-bona.png images/bona-marble.png images/boas-marble.png 
    pdflatex sink.tex 
    rm -f *_flymake* flymake* *.log *.out *.toc *.aux *.snm *.nav *.vrb # kill litter 

comp-t3-s07-tem-boas.png comp-t3-s07-tem-bona.png : nee-comp.pyx nee-comp.txt 
    pyxplot nee-comp.pyx 

# http://www.reddit.com/r/emacs/comments/dy9yt/anyone_know_of_a_script_that_i_can_feed_an/ 
# http://blog.nguyenvq.com/2010/10/30/bash-batch-script-to-convert-org-mode-file-to-html/comment-page-1/#comment-27013 
doktorarbeit.pdf : doktorarbeit.org 
    emacs --batch --visit "doktorarbeit.org" --funcall org-export-as-pdf 

# this is not what clean is intended to do, but I do it anyway. 
clean : 
    rm -f \#* *~ *.bak # kill editor backups 

# alternatively run scons. Should I switch to SCons, just put this in all :) 
sconsrun : scons 
    python scons/bootstrap.py -Q 

scons : 
    hg clone https://bitbucket.org/ArneBab/scons 
Problemi correlati