
Hey guys, I'm wanting to make a target in a make file called "backup" that creates a folder with a time stamp that will back up a few files. Any thoughts on how to do this? I'm pretty sure it will involved a mkdir and cp to copy the files over, but otherwise Im not sure how to do the rest.
Any help greatly appreciated!
You probably need a bash
You probably need a bash script since you need to store the directory name as a variable... something like
dir="`date`"
mkdir "$dir"
cp STUFF "$dir"
and then just run that script from your backup rule in the makefile.
A better option would be svn though.
Josh
It's been awhile since I
It's been awhile since I built a makefile, but I wonder if it isn't possible to embed the shell script elements inline?
At first my suggestion was exactly what Josh described, but then I started to think about the technical limitations of coding it all in the makefile. Technically, i _think_ you should be able to do this. But realistically, I do not think you would want to since it would lead to rather ugly rule implementations. You really want a macro/function of some sort, but then the solution really starts screaming 'this problem is not a nail...'.
SVN is a great little tool, despite some of the quirkines regarding branching. In fact, and SCM tool would probably be wise to get familiar with.
Actually it turns out that
Actually it turns out that pretty much what you said works
TSTAMP = ` /bin/date +'%b-%d-%H-%M'`
date:
mkdir ${TSTAMP}
cp STUFF ${TSTAMP}