help-make
[Top][All Lists]
Advanced

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

Re: make similar to rsync -r -t --del


From: Paul Smith
Subject: Re: make similar to rsync -r -t --del
Date: Wed, 04 Jan 2012 10:49:26 -0500

On Wed, 2012-01-04 at 16:24 +0100, Warlich, Christof wrote:
> Hi,
> 
> using rsync, it is rather simple to synchronize two directories:
> 
> $ rsync -r -t --del sourcedir/ destdir
> 
> In this example, if a file is deleted fron sourcedir, it also gets deleted 
> from destdir.
> Any other files are updated as needed.
> 
> I want to accomplish almost the same with Make, but instead of just copying, 
> I need
> to process any source file (each in the same way) to become the corresponding
> destination file (which is why rsync cannot be used).
> 
> The difficulty arises when a file is deleted from sourcedir: An ordinary 
> Makefile
> would just leave the corresponding (now obsolete) file being there from a 
> previous
> run of Make in destdir.
> 
> As this problem does not seem too special to me, I wonder if anyone knows a
> good generic solution?

It seems pretty unusual to me (for make).

The only way I can think to do it is have a phony target that always
runs, where the recipe is a small script that compares the elements in
the source with the ones in the target and deletes anything in the
target that doesn't exist in the source.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]