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

Re: [ns] Mundane ns/Makefile question



On Tue, 8 Jan 2002, Stanley M Bielski wrote:

> Is there an easier way to recompile ns-2 than a 'make' if you have only
> changed a few files? e.g. like a command line option to only recompile a
> certain set of files and simply link from there - on - in, as opposed to a
> full recompile and relinkage?

'make' should do this selectively, since it compares timestamps on .o
and .cc/.c files to see what has changed and must be recompiled.


> While I'm on cusp of asking borderline non-ns-specific questions, what's
> the easiest way to grep through source code for 2 search terms? Is there a
> program that I can pipe the output of 2 greps to and receive their common
> replies?

A and B:
grep --line-number rtt_ ns-2-snapshot-blah/*.cc | grep interval_ > ~/common_lines.txt
or
grep -r --line-number rtt_ ns-2-snapshot-blah | grep interval_ > ~/common_lines.txt

or, if that's not what you meant, A or B:
grep rtt_ *.cc >> ~/common_lines.txt
grep interval_ *.cc > ~/common_lines.txt
sort common_lines.txt

For multiple directories you will may want to use grep combined with
find with its -exec option if the overhead/output of grep -r dirname
is judged sucky (object files, ugh - another possible application of
dup symlinks) or is not available (since it, like --line-number,
seems to be a gnu option).

man find
man man
man grep

L.

<[email protected]>PGP<http://www.ee.surrey.ac.uk/Personal/L.Wood/>