From: Nick Dokos <nicholas.dokos@hp.com>
To: Holger Hoefling <hhoeflin@gmail.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org,
Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: Not overwriting unchanged source code files when tangling
Date: Fri, 18 Nov 2011 23:00:05 -0500 [thread overview]
Message-ID: <5462.1321675205@alphaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Holger Hoefling <hhoeflin@gmail.com> of "Sat, 19 Nov 2011 01:51:12 +0100." <CAFDswJt=S03yXbrzeqsE_N9C0Nt5DogjUGUGLNMXTXC8aEyzrQ@mail.gmail.com>
Holger Hoefling <hhoeflin@gmail.com> wrote:
> I think you misunderstood me there - I am actually not worried about how
> computationally intensive the tangling process is. This always works very
> quickly, so even if they have to be copied around and take a bit longer, I
> would not mind.
>
Ah, ok - so you are talking about
tangle compile
org -------> bunch of files -------------> output
The tangling step produces a bunch of files that are (re)compiled (or in
any case require some sort of lengthy processing) to produce some output file.
IMO, the best way to deal with it is still make: let's say
foo.org ----> a.x b.x c.x ------> foo.out
where the first arrow is the tangle and the second arrow is some processor, call it X.
The standard way to set up a makefile is schematically:
--8<---------------cut here---------------start------------->8---
foo.out: a.x b.x c.x
X a.x b.c c.x -o foo.out
a.x b.x c.x: foo.org
tangle foo.org
--8<---------------cut here---------------end--------------->8---
Rewrite the make file as follows:
--8<---------------cut here---------------start------------->8---
foo.out: a.y b.y c.y
X a.y b.y c.y -o foo.out
a.y: a.x
cmp --silent a.x a.y || cp a.x a.y
b.y: b.x
cmp --silent b.x b.y || cp b.x b.y
c.y: c.x
cmp --silent c.x c.y || cp c.x c.y
a.x b.x c.x: foo.org
tangle foo.org
--8<---------------cut here---------------end--------------->8---
So if the *contents* of (say) a.x have not changed by the tangling, it compares
equal to a.y and the copy is skipped. That leaves a.y untouched.
OTOH, if the contents of a.x change (or a.y does not exist in the first
place), the comparison fails and we copy a.x to a.y. That updates a.y
and forces further updates on anything that depends on it.
Using some make fu (works for GNU make, but not necessarily for other makes),
you can write it more compactly:
--8<---------------cut here---------------start------------->8---
foo.out: a.y b.y c.y
X a.y b.y c.y -o foo.out
%.y: %.x
-cmp --silent $< $@ || cp $< $@
a.x b.x c.x: foo.org
tangle foo.org
--8<---------------cut here---------------end--------------->8---
HTH,
Nick
next prev parent reply other threads:[~2011-11-19 4:00 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-18 13:17 Not overwriting unchanged source code files when tangling Holger Hoefling
2011-11-18 14:23 ` Brian Wightman
2011-11-18 16:46 ` Tom Prince
2011-11-18 17:14 ` Brian Wightman
2011-11-18 14:27 ` Sebastien Vauban
2011-11-18 17:02 ` Carsten Dominik
2011-11-18 17:28 ` Brian Wightman
2011-11-18 19:42 ` Eric Schulte
2011-11-18 20:10 ` Achim Gratz
2011-11-18 20:24 ` Eric Schulte
2011-11-19 0:49 ` Holger Hoefling
2011-11-18 19:01 ` Holger Hoefling
2011-11-18 19:32 ` Nick Dokos
2011-11-19 0:51 ` Holger Hoefling
2011-11-19 4:00 ` Nick Dokos [this message]
2011-11-19 6:58 ` Holger Hoefling
2011-11-19 18:32 ` Holger Hoefling
2011-11-22 21:17 ` Allen S. Rout
2011-11-22 21:43 ` Nick Dokos
2011-11-19 18:06 ` cberry
2011-11-18 19:51 ` Achim Gratz
-- strict thread matches above, loose matches on Subject: below --
2011-11-19 15:31 Rustom Mody
2011-11-19 15:51 ` Rustom Mody
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5462.1321675205@alphaville.dokosmarshall.org \
--to=nicholas.dokos@hp.com \
--cc=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=hhoeflin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.