Mailing List Archive


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

Re: [tlug] Make question?



On Fri, 11 Apr 2003 16:17, Jim Breen wrote:
> I have a file, which I'll refer to as the "manifest" file.
> That file contains information about a set of other files:
> "foo", "bah", "bletch", etc. etc.
>
> What I want to do is check automatically if any of "foo", "bah",
> etc. have been touched more recently than "manifest". I could put
> this test in a script run by cron to warn me that "manifest" needs
> attention.

This might be what you're asking... maybe.

---------------
all: manifest

manifestdepend.mk: manifest
        printf "manifest: %s\n" `cat manifest` > manifestdepend.mk
        printf "\techo manifest needs updating\n" >> manifestdepend.mk

-include manifestdepend.mk
---------------

What this does (I think):

When the manifest changes then the manifestdepend.mk file is recreated by 
catting the manifest into it. This is formatted as a dependency rule. (printf 
is used, with the shell builtin or otherwise, maybe echo would do as good)

I found the contents of the manifestdepend.mk file ended up being:
manifest: foo
manifest: bah
manifest: bletch
	echo manifest needs updating

The following would probably the lines from manifest so don't end up with as 
many lines in the dependency include file.
cat  manifest | tr "\n" " "

And thus, the manifest file is dependent on the files listed in its contents.
If files are added to the manifest then the dependency file gets recreated.
If the manifest has more than just the filenames in it then maybe some 
combination of pipes (cut) would get just the filenames.

Also could avoid seeing the commands being run... make does this somehow.

-- Sam

-- 
--
Sam Tilders
sam@example.com

Cogito Ergo Sum - I think, therefore I am.  (Descartes)

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links