To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 7978
7977  |  7979
Subject: 
Re: pictures at tracker
Newsgroups: 
lugnet.cad
Date: 
Thu, 16 May 2002 04:02:12 GMT
Viewed: 
774 times
  
Steve Bliss wrote:

> In lugnet.cad, Larry Pieniazek writes:
>
>
>>Hey... this is starting to sound like build/make dependency analysis. Any
>>chance of getting good old "make" itself to do the work of figuring out what
>>needs to be regenned when a file is uploaded?
>>
>
> That seems reasonable.  The dependencies are fairly straightforward, and can
> be checked by simple mod-date comparision.
>

To really make Make work you'd need a program that read in a file, and output
a file full of make style dependencies. for example it might make a file called
3001.dep that contained:

3001.pic: 3001.dat stud4.dat box5.dat stud.dat

and another called stud.dep that would have:

stud.pic: stud.dat 4-4edge.dat 4-4cyli.dat 4-4disc.dat

Then you'd just 'include' all the .dep files in your Makefile. Another
way to do it is to just append the contents of each file to the Makefile.

Once you had that the guts of your Makefile would be:

%.pic: %.dat
<commands to remake picture>



Or something like that.

The program to make these 'dependency' files might be as simple as:
(I'm sure someone could do better in perl)

#!/bin/ksh
#
# Usage: makeDATdepend <file.dat>
#
DATFILE=$1
DEPFILE=`echo $1 | sed "s/\.dat/\.dep/"`
PICFILE=`echo $1 | sed "s/\.dat/\.pic/"`

DEPLIST=`grep $DATFILE "^[ ]*1[ ]" | awk '{print $15}' | sort -u | tr '\012' ' '"

echo $PICFILE: $DATFILE $DEPLIST
echo $PICFILE: $DATFILE $DEPLIST > $DEPFILE


Of course you'd want to edit it to put things in the right directories.
But basically when a new file showed up you just run that on it to update/create
that files dependencies, and then run the Makefile through Make.


>>The dependency calculation seems straightforward (just scan the file to find
>>first level dependencies) and the various dirs seem a lot like include path
>>analysis...
>>
>
> Hmm.  Can it deal with files being in subdirectories?  Like, if the search
> path is /home/tracker/unofficial;/home/tracker/official, and the directory
> structure is:
>


Yes, GnuMake can (which is probably all you have on a Linux box. :)

Most makes have a VPATH variable that they search for everything in. GnuMake
also has a 'vpath' command that lets you give a pattern and a path to search
for file that match that pattern in.


> /home
>    /tracker
>       /official
>          /p
>             /48
>          /parts
>             /s
>       /unofficial
>          /p
>             /48
>          /parts
>             /s
>
> Can make find stud.dat under the right /p/ directory?
>


So you'd have something like:
OFF_DIR = /home/tracker/official
UNOFF_DIR = /home/tracker/unofficial

vpath %.pic $(UNOFF_DIR}/p/pics:$(UNOFF_DIR)/parts/pics:$(OFF_DIR)/p/pics:$(OFF_DIR)/parts/pics

vpath %.dep $(UNOFF_DIR}/p/deps:$(UNOFF_DIR)/parts/deps:$(OFF_DIR)/p/deps:$(OFF_DIR)/parts/deps

vpath %.dat $(UNOFF_DIR}/p:$(UNOFF_DIR)/parts:$(OFF_DIR)/p:$(OFF_DIR)/parts

You can use other functions (like $(foreach ...)) to do more complicated things like
construct these paths from one or two other lists of directories.

-Kyle





--
                                    _
-------------------------------ooO( )Ooo-------------------------------
Kyle J. McDonald                 (o o)
                                  |||||

                                  \\\//
                                  (o o)            kmcdonald@BigFoot.COM
-------------------------------ooO(_)Ooo-------------------------------



Message has 2 Replies:
  Re: pictures at tracker
 
(...) Lots of this stuff can be done different ways, but I think I should have written those as: in 3001.dep: 3001.pic: 3001.dat stud4.pic box5.pic stud.pic and in stud.dep: stud.pic: stud.dat 4-4edge.pic 4-4cyli.pic 4-4disc.pic [Note .dat changed (...) (23 years ago, 16-May-02, to lugnet.cad)
  Re: pictures at tracker
 
(...) Hmm. I don't think that would quite work -- files with duplicate names can exist in different subdirectories of the library. Sometimes this is on purpose, sometimes it's accidental. Would it make a difference (good or bad) if the files are (...) (23 years ago, 16-May-02, to lugnet.cad)

Message is in Reply To:
  Re: pictures at tracker
 
(...) That seems reasonable. The dependencies are fairly straightforward, and can be checked by simple mod-date comparision. (...) Hmm. Can it deal with files being in subdirectories? Like, if the search path is /home/tracker/unoffi.../official, and (...) (23 years ago, 16-May-02, to lugnet.cad)

77 Messages in This Thread:



















Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR