List Info

Thread: make: compilation firewall




make: compilation firewall
country flaguser name
United States
2007-02-16 14:16:35
I have a medium sized project and have been working to
lessen total
compilation time.  The biggest outstanding problem is some
auto-
generated code.  We have a program that I'll call
'generate,' which
takes a proprietary internal format and generates C++ code
(you can
imagine lex or yacc if that helps).  We have a rule along
the lines:

out.h out.cc: in.our_format generate
     generate --input in.our_format --output out

In turn out.h is #included in a lot of downstream files, so
whenever
this rule runs, it causes many, many .cc files to recompile,
and takes
about 5-10 minutes.

We're doing some refactoring and maintenance on 'generate.' 
If we
make any change (even changing a comment), recompiling takes
the full
time.

One possibility is to eliminate the dependance on generate,
but then
if we make a real change, either on purpose or by accident,
we won't
find it.

What I'd like to do is something like this:

out.h out.cc: in.our_format generate
     generate -i in.our_format -o tmp
     if (tmp.h != out.h OR tmp.cc != out.cc) {
         cp tmp.h out.h
         cp tmp.cc out.cc
     }

The idea would be that whenever generate is run, 2 diffs are
run (one
on .h and one on .cc), and only if they've changed does it
do the full
recompile.

Of course, this doesn't work as written.  Has anyone done
anything
like this, and if so how?

Michael

_______________________________________________
help-gnu-utils mailing list
help-gnu-utilsgnu.org

http://lists.gnu.org/mailman/listinfo/help-gnu-utils

Re: make: compilation firewall
user name
2007-02-16 14:45:08
"Michael" <mchlgibsaol.com> wrote:
> out.h out.cc: in.our_format generate
>      generate -i in.our_format -o tmp
>      if (tmp.h != out.h OR tmp.cc != out.cc) {
>          cp tmp.h out.h
>          cp tmp.cc out.cc
>      }

	if { cmp tmp.h out.h && cmp tmp.cc out.cc; } >
/dev/null 2>&1; 
	  then :; 
	  else cp tmp.h out.h && cp tmp.cc out.cc; 
	fi

You could also incorporate this conditional update into
generate
itself, to keep the Makefile simpler.


paul


_______________________________________________
help-gnu-utils mailing list
help-gnu-utilsgnu.org

http://lists.gnu.org/mailman/listinfo/help-gnu-utils

Re: make: compilation firewall
country flaguser name
United States
2007-02-16 14:54:18
On Feb 16, 12:45 pm, p...po.cwru.edu (Paul Jarc)
wrote:
> "Michael" <mchlg...aol.com> wrote:
> > out.h out.cc: in.our_format generate
> >      generate -i in.our_format -o tmp
> >      if (tmp.h != out.h OR tmp.cc != out.cc) {
> >          cp tmp.h out.h
> >          cp tmp.cc out.cc
> >      }
>
>         if { cmp tmp.h out.h && cmp tmp.cc
out.cc; } > /dev/null 2>&1; 
>           then :; 
>           else cp tmp.h out.h && cp tmp.cc
out.cc; 
>         fi
>
> You could also incorporate this conditional update into
generate
> itself, to keep the Makefile simpler.
>
> paul

I actually tried something like this, but it recompiled
everything
whenever generate changed (i.e., whenever the rule for out.h
and
out.cc fired), not just when out.h and out.cc actually
changed.  I
think I'm missing something to get the dependencies right.

Michael

_______________________________________________
help-gnu-utils mailing list
help-gnu-utilsgnu.org

http://lists.gnu.org/mailman/listinfo/help-gnu-utils

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )