bug-make
[Top][All Lists]
Advanced

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

Re: [FEATURE Request] Please add an option to list all dependencies ofa


From: Martin Quinson
Subject: Re: [FEATURE Request] Please add an option to list all dependencies ofa target (recursively)
Date: Thu, 28 Aug 2003 11:40:24 +0200
User-agent: Mutt/1.5.4i

Hello, 

I'm the one which asked for this feature in the debian bug tracking system.
Manoj, thanks for taking care of this bug that way and keeping me in CC. And
sorry for not steping in the discution sooner, I was away from mails.

Others, I did report this to the debian BTS and not here directly to benefit
of its sorted archiving mechanism. If you want more context, please check 
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=206746

On Wed, Aug 27, 2003 at 05:14:50PM -0400, Noel Yap wrote:
> Manoj Srivastava wrote:
> 
> >  If we found a security hole in a structure or function: how
> > many projects would be impacted? All these are what if scenarios).
> > 
> >         In any case, is this really necessary? Should every feature
> >  requester have to rigorously defend the need for a well defined,
> >  distinct feature?
> 
> No, and yes.
> 
> This is open source.  You're welcome to make the changes yourself without
> asking for approval or justifying it. 

You're quite rude and unfair to Manoj. As debian maintainer of make he
certainly contributed more to make than me. I dunno about you, though...

> OTOH, every added feature leads to more complex software.  More complex
> software leads to security holes and other problems.

Bullshit. Missing features lead to hackism around the project, leading to
dupplicated complicated scripts.

> 
> > This is not information that is readily available,
> >  and it should be relatively easy for make to disseminate this
> >  information.
> 
> I agree.  I'm not sure I agree that make should provide this information.
> In most cases, it won't be 100%.  For example, what if the OS version
> changes?  What if the compiler version changes?

I'm not looking for gold here. 

Let me explain why I asked for this feature first. I want to get my latex
document automatically recompiled when I save parts of it. I have a rather
complicated makefile (not relevant here, I guess), which parse the .tex
files, looking for dependencies and able to reexport .eps files when .fig
files changed, and all such features you can dream about.

Then, in use scenario, I edit my files in an emacs buffer, with a gv
watching the resulting file on the screen. I also keep a shell somewhere
running "while true ; do echo X|make ps; sleep 3; done".

This brings me very close to a wysiwyg solution, with the confort of latex
and without the incompatibilities of lyx or the limitations of texmacs.

The next step on this road is to trigger the recompilation not every 3 sec
even if nothing has changed (what make will detect at the price of reparsing
the quite big makefile and checking the changed time of each node of the
node), but immediatly when something changed.

For that, I plan to use the File Alteration Monitor, and relaunch make when
any dependency did change. I still have issues with the command line
argument of FAM, but that also is not relevant to this discussion. 

The only relevant issue is that I have to provide the FAM daemon with the
list of files I want to monitor. That is to say, all nodes of the DAG rooted
at my ps file.

For now, I use this shell script to get this:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#!/bin/sh
# make_watch: automatically relaunch the make when a target changed

# Author: Martin Quinson <address@hidden>
# version: 0.1

debug() {
  echo $1
  :
}

target=$1
if [ -z $target ] ; then
  target="all"
fi
echo "Target: $target"

# Search for dependencies
deps() {
  res=`make -pnq $1 2>/dev/null | egrep "^[^:]*$1(:| [^:]*:)"|sed 's/^[^:]*://'`
  debug "$1 depends on: $res"
}
deps $target
dep_todo="$res"
rm -f .fileschanged.input
touch .fileschanged.input
while [ -n "$dep_todo" ] ; do
    # keep in dep_todo only what is not already in .fileschanged.input
    all="$dep_todo";dep_todo=""
    for n in $all ; do
        if cat .fileschanged.input | grep $n >/dev/null; then
           debug "  Already there: $n"
        else
           debug "  Add: $n"
           dep_todo="$n $dep_todo"
           echo $n >> .fileschanged.input
        fi
    done
    # Put the new ones in dep_all, and look for their dependencies
    if [ -n "$dep_todo" ] ; then
                all="$dep_todo";dep_todo
        for n in $all ; do
           deps $n
           dep_todo="$dep_todo $res"
        done
    fi                          
done
echo "Dependencies:"
cat .fileschanged.input
echo

# Track stupid users doing "make bla.tex" instead of "make bla.ps"
if [ ! -s .fileschanged.input ] ; then
  echo "$target depends on nothing..."
  exit 1
fi
for n in $all_dep ; do 
  deps="$deps `pwd`/$n"
done

echo "I'm watching, go back to work"
echo
fileschanged .fileschanged.input |    \
  while read line ; do     \
    echo "$line changed";  \
    echo X|make $target;   \
  done
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

So, most of my code is only to get recursively all targets of the makefile
parsing the output of "make -pnq".

Here is an example of execution on one of my articles (only 1 figure and not
inclusion of other tex files: a rather simple one):
>>>>>>>>>>>>>>
Target: rr-gras.ps
rr-gras.ps depends on: rr-gras.dvi
Add: rr-gras.dvi
rr-gras.dvi depends on: rr-gras.tex rr-gras.tex Biblio.bib rr-gras.bbl
fig/gras-overview.fig fig/gras-overview.pstex fig/gras-overview.pstex_t
Already there: rr-gras.dvi
Add: rr-gras.tex
Already there: rr-gras.tex
Add: Biblio.bib
Add: rr-gras.bbl
Add: fig/gras-overview.fig
Add: fig/gras-overview.pstex
Add: fig/gras-overview.pstex_t
fig/gras-overview.pstex_t depends on: fig/gras-overview.fig
fig/gras-overview.pstex depends on: fig/gras-overview.fig
fig/gras-overview.fig depends on:
rr-gras.bbl depends on: Biblio.bib
Biblio.bib depends on:
rr-gras.tex depends on:
Already there: fig/gras-overview.pstex_t
Already there: fig/gras-overview.pstex
Already there: fig/gras-overview.fig
Already there: rr-gras.bbl
Already there: Biblio.bib
Already there: rr-gras.tex
Already there: fig/gras-overview.fig
Already there: fig/gras-overview.fig
Already there: Biblio.bib
Dependencies:
rr-gras.dvi
rr-gras.tex
Biblio.bib
rr-gras.bbl
fig/gras-overview.fig
fig/gras-overview.pstex
fig/gras-overview.pstex_t

I'm watching, go back to work
<<<<<<<

That's rather anoying to have to rebuild in such a complicated manner an
information that make obviously have. That's why I was asking for it.


> OTOH, I hope thinking of the problem differently will solve the real
> problem at hand, that is, tracking all dependencies of projects. 

$ wc /usr/include/LaTeX.mk /usr/bin/texdepends
    445    1707   14482 /usr/include/LaTeX.mk
    337    1122    9361 /usr/bin/texdepends

Your solution is /ways/ too simplistic for that case... It would be
possible, but damn. Make have this information, doesn't it ?

Thanks, Mt.


-- 
Les rebelles disaient que les débutants avaient le droit d'utiliser un
"éditeur", qui ressemblait à MSWord comme sa mère à Pamela Anderson.
"Vihaille" comme les rebelles l'appellaient, était sans doute un bizutage
          -- L'histoire des pingouins




reply via email to

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