Lars Eighner's The Main Blog Archives


Skip to: Main Menu or page information.


FreeBSD Recipes

Copy only newer files Makefile

24 March 2005

Cartoon of mixing bowl and spoon
Now we're cookin'!

Sweated bullets for several days over this one. GNU make (like, I guess, all makes) exist to put together programs from source files. It can do a whole lot of other things, but the documentation for idiots is mostly directed toward idiots who want to compile C programs and do reasonable things with them and their parts.

This Makefile copies *.chml files from directory test to directory test2 and preserves permissions and ownership, but only if the file in test is newer than any file with the same name in test2. Run it with gmake target.


%'#' Makefile for gnu make (gmake) 
%'#' Copies only newer *.chml files 
srcdir = test
objdir = test2
sources := $(wildcard $(srcdir)/*.chml)
objects := $(patsubst $(srcdir)%,$(objdir)%,$(sources))
$(objdir)/%.chml : $(srcdir)/%.chml
    cp -pf $< $@
target : $(objects)

Posted by Lars | | Permalink | Categories: FreeBSD Recipes | Mail Public Comments


Skip to: Top or page information.

Amazon Honor System Click Here to Pay Learn More

Donate by Mail!

Lars Eighner
APT 1191
8800 N IH 35
AUSTIN TX 78753
USA

Donate by PayPal!

Donations are not tax deductible and do not buy access, products, or services.